nano-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Global tabgives and spacestotab config option


From: Peter Magnusson
Subject: Re: Global tabgives and spacestotab config option
Date: Tue, 8 Jun 2021 17:30:04 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.9.0


On 01/06/2021 10:51, Benno Schulenberg wrote:
If I ^K a line and ^U the tab will still be there.
If I do the same with the mouse and cut and paste it will do tabstospaces.
Using the mouse (under X) to select stuff in the terminal will copy the
text as it is displayed on the terminal.  And nano never sends tabs to
the terminal, but always the relevant number of spaces, even though the
buffer itself contains tabs.  You can see this by opening a file that
contains tabs, switch on whitespacedisplay (M-P), and slowly select a
couple of tabs.  You will see that the selection happens space by space
and never a tab jump at a time.  For example in:

    »   »   »   »   some text;

Nano has always done this.  If nano would send real tabs to the terminal,
it would depend on the tab setting of the terminal how the text would be
displayed, and nano wouldn't know in which column the cursor actually is.

I like tabs and want to be able to copy text with tabs from one host to
and other host without acutally moving the file.
Sorry, this is not possible.

Interesting, didnt know that nano could do things like M-P.

Would it be possible to track if the user copy something with the
mouse -> do a meta-command that look up what was copied and if there 
is actually tabs in the buffer it will replace the spaces with tabs
where they should be -> user can paste the text to some other host
and now it will be with tabs, tabs that are undefined in tabsize
but if tabsize isnt set it will default to 8 chars tabs in nano ->
problem solved -> Great party!

Would something like this be possible?

In theory a --spacestotab option would be possible, but it would be
wildly complicated because of Undo -- nano would need to backtrack
and change not only the typed spaces in the buffer to a tab but also
the spaces in the undo stack, and not forget to adjust the file size.
Sounds feasible, but is complicated.  Do you have a patch?  :)


No, sorry no patch right now :)

/Peter

reply via email to

[Prev in Thread] Current Thread [Next in Thread]