-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Select Line + Move Line Up = Line disappears at top of editor #5226
Comments
@TomMalbran - I think you worked on this awhile ago - would you be up for looking at it? |
Also, I wonder whether this is a regression. |
@lkcampbell I can not reproduce this in the latest master. Can you still reproduce it, and if so can you give more specific instructions, like in which file it might happen, and if you are scrolling or maybe which line you try to move and up to which point... |
@TomMalbran, yes I can still reproduce it in the latest Dev build, all extensions disabled. Make sure you are using Select Line to select the line. If you select the line using clicking and dragging, or using shortcut selection keys, you won't be able to reproduce the problem. Also, make sure line 1 is not visible at the top when you select the line. Line 1 should be scrolled upwards off the editor screen. As soon as you move the line up to the top of the editor window, the selected line should move past the top border of the editor window. |
Yes, I can see the issue now, the problem is with the scroll not scrolling enough to show the line. I can easily reproduce with this steps in windows in a document where you can scroll
Result: The scroll doesn't show the selected line. It seems an issue with line selection and not move line. You can see the problem by moving the cursor out of view and then pressing Ctrl+L. If the cursor is above the first visible line, you don't partially see the selected line, if it is below the last visible one, you can see the selected line and the following one. It seems that CM scrolls using the cursor as if it was in the next line, in the same way as if you use Shift+Down when the cursor is out of view. |
I think that there might be an issue to fix in CM in the way it handles line selections. @njx What do you think? |
Sounds plausible. I'll nominate this for 1.0 since it seems like the kind of thing that, while not necessarily common, would be very annoying if I ran into it. |
I think the issue here is that CM uses the cursor at the end of the selection to scroll the page and since when we highlight one line, that cursor is actually on the character 0 of the next line, it scrolls so that that line is in view, but the highlighted line isn't. |
Yup, that's kind of what I was assuming was going on. (It might be that he uses the head of the selection, rather than the end of it specifically, but the head is usually the end.) It seems instead like it should try to scroll the whole selection into view, but if the selection is bigger than the visible viewport, prefer to keep the head end on screen. |
The issue can be reproduced here: http://codemirror.net/demo/sublime.html The only difference is that you can see the mouse, but it looks like there is no selection at all. |
Ah, cool. I'd suggest filing a bug with Marijn on that, since it's easy to reproduce in vanilla CM, but point out that it's a more general issue with scrolling, not just the ST functionality. |
Reviewed. It seems like this might have changed in v4 - see #7458, which says this bug now happens on Move Line Up but not Move Line Down. Leaving this one open for 1.0 - we should fix whichever bug still exists :) |
Marking "last reviewed" as the last of the 1.0 bugs we've reviewed so far. |
@njx, both bugs still exist, although I would categorize #7458 as much worse than this bug. The main difference is that, in this bug, you have to specifically use Select Line (Ctrl+L) before this bug will repro. You can tell the difference because the select highlight extends all the way to the right edge of the editor. If you just put the cursor on a line with no selection, or partial line selection, and move the line up, you won't see this issue. You will, however, continue to see issue #7458. |
@TomMalbran , I would like to try and fix this issue. Can I take it over from you? Just reassign it to me if it is okay. |
Oh, good catch -- I missed step 2 in the repro here. |
@lkcampbell Sure, go ahead. But as I mentioned before this is not an issue with Move Line but with how Line Selections work, and is an issue in CodeMirror too. So, we need to fill an issue in CM first. |
@TomMalbran, yes, sounds goods. I will get a CodeMirror bug submitted and turn this issue into a CodeMirror Tracking issue after I do. |
Cool, thanks. |
Fix submitted. |
Confirmed. Closing. |
OS: Windows 7
Brackets Build: sprint 31 development build 0.31.0-0 (master ad9a603)
Repro Steps:
Observed Results:
Selected line disappears beyond the top edge of the editor.
Expected Results:
Selected line should be visible on the top line of the editor.
Other notes:
You can also repro this with the Move Line Down as well. Selected line stays one line above the bottom line of the editor instead of going to the bottom line.
The text was updated successfully, but these errors were encountered: