[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Nano-devel] [BUGS?] indenting shift selections
From: |
Benno Schulenberg |
Subject: |
Re: [Nano-devel] [BUGS?] indenting shift selections |
Date: |
Fri, 8 Dec 2017 20:33:45 +0100 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 |
Op 08-12-17 om 02:21 schreef Brand Huntsman:
Marked selections always persist after indenting/unindenting.
Yes, that is how the hard mark is supposed to work: to persist as long
as the selection isn't cut or copied.
And shift selections always persist when unindenting.
Depends where the cursor is. Try with NEWS: put the cursor somewhere in
the middle of a paragraph, shift-select a couple of lines, then unindent.
The selection is dropped because the cursor has moved.
Shift selections only persist after an indent if the cursor line is blank,
because any content would cause the cursor to indent(move) and reset the
selection.
Is this behavior intended
It is a result of the simple rule that unshifted cursor movement cancels the
softmark.
or should indenting shift selections always persist like marked selections
It would be nice and handy if it did.
Would it be possible for do_indent() to update the cursor position in the
selection so it doesn't get reset?
I noticed the problem too, yesterday, when playing with Liu's patches,
and have thought a bit about how to do this, and have come up with the
attached trick.
Also notice when indenting a marked or shift selection, the indent on the
first line isn't added to the selection. It doesn't matter if only indenting,
and unindenting after works fine too, but copying or cutting the selection
won't get that first line's indentation. Is this behavior intended or a bug?
It's intentional. If you indent a single line, the idea is that the cursor
should move as if you inserted a tab. If you indent a marked region, and
the mark and/or the cursor are somewhere in the middle of some text, it
would be odd if the mark and/or cursor would move in the text to compensate
for the added/lost indentation. That's why they move with the indentation.
But... maybe an exception could/should be made when the mark/cursor are at
the head of a line?
If it is decided to fix this, are there any other features that work on
selections and cause the cursor to move?
Commenting/uncommenting (M-3). Would be nice if it maintained a softmark
too.
Benno
fake-shifted-movement-when-indenting.patch
Description: Text Data
- [Nano-devel] [BUGS?] indenting shift selections, Brand Huntsman, 2017/12/07
- Re: [Nano-devel] [BUGS?] indenting shift selections,
Benno Schulenberg <=
- Re: [Nano-devel] [BUGS?] indenting shift selections, Brand Huntsman, 2017/12/08
- Re: [Nano-devel] [BUGS?] indenting shift selections, Brand Huntsman, 2017/12/08
- Re: [Nano-devel] [BUGS?] indenting shift selections, Benno Schulenberg, 2017/12/10
- Re: [Nano-devel] [BUGS?] indenting shift selections, Brand Huntsman, 2017/12/10
- Re: [Nano-devel] [BUGS?] indenting shift selections, Benno Schulenberg, 2017/12/11
- Re: [Nano-devel] [BUGS?] indenting shift selections, Brand Huntsman, 2017/12/11
- [Nano-devel] RFC: change the behavior when indenting/commenting a marked region?, Benno Schulenberg, 2017/12/12
- Re: [Nano-devel] RFC: change the behavior when indenting/commenting a marked region?, Benno Schulenberg, 2017/12/15
- Re: [Nano-devel] [BUGS?] indenting shift selections, Benno Schulenberg, 2017/12/10