Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CLOSED] Select Line + Move Line Up = Line disappears at top of editor #4809

Open
core-ai-bot opened this issue Aug 29, 2021 · 21 comments
Open

Comments

@core-ai-bot
Copy link
Member

Issue by lkcampbell
Monday Sep 16, 2013 at 18:19 GMT
Originally opened as adobe/brackets#5226


OS: Windows 7

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

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.

@core-ai-bot
Copy link
Member Author

Comment by njx
Monday Sep 16, 2013 at 18:48 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by njx
Thursday Sep 19, 2013 at 16:22 GMT


Also, I wonder whether this is a regression.

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Saturday Mar 15, 2014 at 22:24 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by lkcampbell
Saturday Mar 15, 2014 at 23:59 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Sunday Mar 16, 2014 at 00:17 GMT


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.

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Saturday Mar 22, 2014 at 03:17 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by njx
Monday Mar 24, 2014 at 18:26 GMT


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.

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Monday Mar 24, 2014 at 20:08 GMT


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.

@core-ai-bot
Copy link
Member Author

Comment by njx
Monday Mar 24, 2014 at 20:12 GMT


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.

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Monday Mar 24, 2014 at 20:16 GMT


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.

@core-ai-bot
Copy link
Member Author

Comment by njx
Monday Mar 24, 2014 at 20:25 GMT


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.

@core-ai-bot
Copy link
Member Author

Comment by njx
Friday Apr 11, 2014 at 17:00 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by njx
Friday Apr 11, 2014 at 17:00 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by lkcampbell
Thursday May 01, 2014 at 14:03 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by lkcampbell
Thursday May 01, 2014 at 16:28 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by peterflynn
Thursday May 01, 2014 at 17:59 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Thursday May 01, 2014 at 19:32 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by lkcampbell
Thursday May 01, 2014 at 19:57 GMT


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

@core-ai-bot
Copy link
Member Author

Comment by TomMalbran
Thursday May 01, 2014 at 19:58 GMT


Cool, thanks.

@core-ai-bot
Copy link
Member Author

Comment by lkcampbell
Monday May 12, 2014 at 20:32 GMT


Fix submitted.

@core-ai-bot
Copy link
Member Author

Comment by redmunds
Friday May 23, 2014 at 00:05 GMT


Confirmed. Closing.

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

No branches or pull requests

1 participant