Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Select Line + Move Line Up = Line disappears at top of editor #5226

Closed
lkcampbell opened this issue Sep 16, 2013 · 21 comments
Closed

Select Line + Move Line Up = Line disappears at top of editor #5226

lkcampbell opened this issue Sep 16, 2013 · 21 comments
Assignees
Milestone

Comments

@lkcampbell
Copy link
Contributor

OS: Windows 7

Brackets Build: sprint 31 development build 0.31.0-0 (master ad9a603)

Repro Steps:

  1. Open any document in Brackets that is long enough to have vertical scrolling.
  2. Navigate to any line and Select Line (Edit > Select Line or Ctrl+L).
  3. Move line up to the top of the editor window (Edit > Move Line Up or Ctrl+Shift+Up Arrow).

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.

@ghost ghost assigned TomMalbran Sep 16, 2013
@njx
Copy link
Contributor

njx commented Sep 16, 2013

@TomMalbran - I think you worked on this awhile ago - would you be up for looking at it?

@njx
Copy link
Contributor

njx commented Sep 19, 2013

Also, I wonder whether this is a regression.

@TomMalbran
Copy link
Contributor

@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...

@lkcampbell
Copy link
Contributor Author

@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.

@TomMalbran
Copy link
Contributor

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

  1. Ctrl+Home to scroll to the start of the document
  2. Ctrl+Down 2 times so that the first visible line is the second one.
  3. Ctrl+L to select the complete line.
  4. Ctrl+Shift+Up to mode the line upwards.

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.

@TomMalbran
Copy link
Contributor

I think that there might be an issue to fix in CM in the way it handles line selections. @njx What do you think?

@njx njx added this to the Brackets 1.0 milestone Mar 24, 2014
@njx
Copy link
Contributor

njx commented Mar 24, 2014

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.

@TomMalbran
Copy link
Contributor

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.

@njx
Copy link
Contributor

njx commented Mar 24, 2014

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.

@TomMalbran
Copy link
Contributor

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.

@njx
Copy link
Contributor

njx commented Mar 24, 2014

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.

@njx
Copy link
Contributor

njx commented Apr 11, 2014

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 :)

@njx
Copy link
Contributor

njx commented Apr 11, 2014

Marking "last reviewed" as the last of the 1.0 bugs we've reviewed so far.

@lkcampbell
Copy link
Contributor Author

@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.

@lkcampbell
Copy link
Contributor Author

@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.

@peterflynn
Copy link
Member

Oh, good catch -- I missed step 2 in the repro here.

@TomMalbran
Copy link
Contributor

@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.

@lkcampbell lkcampbell assigned lkcampbell and unassigned TomMalbran May 1, 2014
@lkcampbell
Copy link
Contributor Author

@TomMalbran, yes, sounds goods. I will get a CodeMirror bug submitted and turn this issue into a CodeMirror Tracking issue after I do.

@TomMalbran
Copy link
Contributor

Cool, thanks.

@lkcampbell
Copy link
Contributor Author

Fix submitted.

@redmunds
Copy link
Contributor

Confirmed. Closing.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants