[ jEdit-devel ] [jedit:bugs] #3831 Move lines up and down macros move too many lines

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[ jEdit-devel ] [jedit:bugs] #3831 Move lines up and down macros move too many lines

Steve

If my cursor is on a line with nothing selected, I expect that line to be affected by any *_lines command. If I have selected any text, I expect all the lines with at least one selected character to be affected. But, if I have selected 1 full line and the cursor is in position 0 on the next line, I expect 1 and only 1 line to be affected. That is consistent behavior through most editors, and makes it easy to use. The move line macros and the TextTools Toggle Line Comment all do this wrong and take the line with the cursor as well.


[bugs:#3831] Move lines up and down macros move too many lines

Status: open
Labels: macros
Created: Thu Sep 19, 2013 06:32 PM UTC by Dale Anson
Last Updated: Sat Jan 11, 2014 09:32 PM UTC
Owner: nobody

The move lines up and move lines down macros move too many lines and alters the selection.

To reproduce:
1. Open a buffer with several lines of text
2. Using the keyboard, move the caret to the start of the first line
3. Using the keyboard, select the first 2 lines (shift + down arrow twice). The caret will now be on the start of the third line.
4. Run the move lines down macro. Notice the first 3 lines move, even though only the first 2 lines were selected.

I expect only the 2 lines that I selected will be moved. Same issue with move lines up.

Also, the selection is extended. To see this, paste this example text into a buffer:

// if nothing is selected, select current line
if (selection == null || selections.length == 0) {
selections = new Selection[1];
int start_offset = textArea.getLineStartOffset(line);
int end_offset = textArea.getLineEndOffset(line);
selections[0] = new Selection.Range(start_offset, end_offset);
textArea.addToSelection(selections[0]);
}

Same as above, use the keyboard (shift + down arrow twice) to select the first 2 lines. The caret will be at the start of the third line, the whitespace before "selections - new Selection[1]" is not selected. Run the move lines down macro. See that the 3rd line moved and the whitespace at the start of the 3rd line is now selected.


Sent from sourceforge.net because [hidden email] is subscribed to https://sourceforge.net/p/jedit/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/jedit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel
Reply | Threaded
Open this post in threaded view
|

[ jEdit-devel ] [jedit:bugs] Re: #3831 Move lines up and down macros move too many lines

Steve

(I also expect my selection to not be altered for any of the three scenarios I listed above. The build-in Line Comment leaves me with nothing selected, which also is wrong, IMHO.)


[bugs:#3831] Move lines up and down macros move too many lines

Status: open
Labels: macros
Created: Thu Sep 19, 2013 06:32 PM UTC by Dale Anson
Last Updated: Mon Jan 13, 2014 04:04 PM UTC
Owner: nobody

The move lines up and move lines down macros move too many lines and alters the selection.

To reproduce:
1. Open a buffer with several lines of text
2. Using the keyboard, move the caret to the start of the first line
3. Using the keyboard, select the first 2 lines (shift + down arrow twice). The caret will now be on the start of the third line.
4. Run the move lines down macro. Notice the first 3 lines move, even though only the first 2 lines were selected.

I expect only the 2 lines that I selected will be moved. Same issue with move lines up.

Also, the selection is extended. To see this, paste this example text into a buffer:

// if nothing is selected, select current line
if (selection == null || selections.length == 0) {
selections = new Selection[1];
int start_offset = textArea.getLineStartOffset(line);
int end_offset = textArea.getLineEndOffset(line);
selections[0] = new Selection.Range(start_offset, end_offset);
textArea.addToSelection(selections[0]);
}

Same as above, use the keyboard (shift + down arrow twice) to select the first 2 lines. The caret will be at the start of the third line, the whitespace before "selections - new Selection[1]" is not selected. Run the move lines down macro. See that the 3rd line moved and the whitespace at the start of the 3rd line is now selected.


Sent from sourceforge.net because [hidden email] is subscribed to https://sourceforge.net/p/jedit/bugs/

To unsubscribe from further messages, a project admin can change settings at https://sourceforge.net/p/jedit/admin/bugs/options. Or, if this is a mailing list, you can unsubscribe from the mailing list.


------------------------------------------------------------------------------
CenturyLink Cloud: The Leader in Enterprise Cloud Services.
Learn Why More Businesses Are Choosing CenturyLink Cloud For
Critical Workloads, Development Environments & Everything In Between.
Get a Quote or Start a Free Trial Today.
http://pubads.g.doubleclick.net/gampad/clk?id=119420431&iu=/4140/ostg.clktrk
--
-----------------------------------------------
jEdit Developers' List
[hidden email]
https://lists.sourceforge.net/lists/listinfo/jedit-devel