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

Ctrl-Up and Ctrl-Down don't advance cursor when hits page limit #2091

Closed
fractos opened this issue Jan 18, 2016 · 13 comments
Closed

Ctrl-Up and Ctrl-Down don't advance cursor when hits page limit #2091

fractos opened this issue Jan 18, 2016 · 13 comments
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities
Milestone

Comments

@fractos
Copy link

fractos commented Jan 18, 2016

I use the Ctrl-Up and Ctrl-Down feature very often, so I can scroll a limited amount of distance without losing my place. This has the advantage of allowing me to use the mouse less for view adjustment.

I've noticed that there is a difference between how this behaves in the full Visual Studio and in Code. In Visual Studio, when you use Ctrl-Up/Down and the view moves such that the cursor is at the limit of the screen, then the editor will advance the cursor such that it remains on the last line visible. Code, however, does not do this, so the next time you hit a key (e.g. a cursor key without pressing Ctrl) then the view resets back to the line you were originally on which is quite jarring.

@weinand weinand added bug Issue identified by VS Code Team member as probable bug editor labels Jan 18, 2016
@rob3c
Copy link

rob3c commented Feb 19, 2016

First of all, I just wanted to say it's great to finally have keyboard scrolling in VS Code! That said, this unexpected behavior can be quite frustrating for some of us as it breaks your flow when coding in addition to not matching the feature in other editors.

However, I can see how others might like the current behavior so they can scroll a bit to see some code for reference and then snap back to the original context that's possibly offscreen (maybe that's why the original author did it that way?)

Perhaps this is best made into a configuration flag instead of just 'fixing' it as a bug?

@Tyriar
Copy link
Member

Tyriar commented Feb 19, 2016

I agree it would be good to have this configurable, I prefer the current method.

@alexdima alexdima removed the bug Issue identified by VS Code Team member as probable bug label Feb 22, 2016
@rob3c
Copy link

rob3c commented Mar 31, 2016

I think it should still be labeled a bug, as the current behavior doesn't allow for you to remain in the newly-scrolled screen without using the mouse to put focus in the new position. This is because the cursor stays put even when it completely scrolls out of view. Since this is all about keyboard navigation, then requiring the mouse seems counter to the spirit of it.

Most editors have the cursor follow along at the top or bottom of the screen (depending on scroll direction) when scrolling beyond the current view. In that way, there's no jarring snap back to another location off-screen when you start moving the cursor with arrow keys again or start typing.

However, some editors additionally allow you to hit ESC to snap back to the original position in the cases where you're scrolling just to take a peek instead of wanting to stay in the new location.

@rob3c
Copy link

rob3c commented May 10, 2016

@alexandrudima I can understand this may not be a high priority item and hasn't been addressed yet, even though it's quite frustrating for some of us on a daily basis. However, would you mind explaining why you removed the bug label in light of my previous comment?

@Tyriar Tyriar added the feature-request Request for new features or functionality label May 12, 2016
@Tyriar
Copy link
Member

Tyriar commented May 12, 2016

@rob3c it's not a bug as it's working as intended currently, making this configurable would be adding functionality rather than fixing it.

This is probably the sort of thing we'd accept a PR for because of the priority of it, @alexandrudima do you want to add the help wanted label?

@alexdima alexdima added the help wanted Issues identified as good community contribution opportunities label May 13, 2016
@jkristia
Copy link

jkristia commented Jun 7, 2016

+1 for adding this functionality and have it configurable (or enabled).
This will provide same behavior as in Visual Studio, and will allow you to stay on the keyboard and not use the mouse.

@rob3c
Copy link

rob3c commented Jun 7, 2016

In addition to Visual Studio, it would also provide the same behavior as in many other editors like Sublime Text, Notepad++, etc.

JetBrains editors (IntelliJ IDEA, WebStorm, etc.) use the current VSCode behavior by default. It's clear that they've recognized it as non-obvious and disorienting for many users since they attempt to make it less jarring by leading the eye with a smooth reverse scrolling animation back to the offscreen cursor position. They also offer separate "move if necessary" versions of each up/down scroll command to get the behavior desired in this thread.

@Bill-Stewart
Copy link

I like that we now have editorScroll function for scrolling up and down with revealCursor parameter set to true. However I would like to disable the behavior of how the cursor jumps to the first non-whitespace character of the next line when scrolling down or previous line when scrolling up. I will open a separate issue for my idea.

@alexdima
Copy link
Member

To keep the number of issues in our inbox at a manageable level, we're closing issues that have been on the backlog for a long time but haven't gained traction: we look at the number of votes the issue has received and the number of duplicate issues filed. Thank you for your time and understanding.

P.S. If you disagree and feel that this issue is crucial: we're happy to listen and to reconsider.


For this particular issue, the following "workaround" exists (in keybindings.json). e.g. for going down:

    {
        "key": "ctrl+down",
        "command": "editorScroll",
        "args": {
            "to": "down",
            "by": "line",
            "revealCursor": true
        }
    }

@fractos
Copy link
Author

fractos commented Nov 22, 2017

@alexandrudima Ah! I didn't know there was a workaround. Will try that and feedback. Thanks.

@fractos
Copy link
Author

fractos commented Nov 22, 2017

@alexandrudima Pretty much ideal with the workaround, for me (although when scrolling up the cursor stays on the penultimate line for some reason). Anyway - thanks for posting that!

@jkristia
Copy link

Thank you so much for the work around. I have been waiting for this 'fix'

@ghost
Copy link

ghost commented Nov 23, 2017

Just tried the workaround:

	{
		"key": "ctrl+up",
		"command": "editorScroll",
		"when": "editorTextFocus",
		"args": 
		{
			"to": "up",
			"by": "line",
			"revealCursor": true
		}
	},
	{
		"key": "ctrl+down",
		"command": "editorScroll",
		"when": "editorTextFocus",
		"args": 
		{
			"to": "down",
			"by": "line",
			"revealCursor": true
		}
	}

Up works fine; down sometimes scrolls several lines than stops as if it has reached the end of the file; most of the time down does not respond at all.

Visual Studio Code version: 1.18.1, 2017-11-16

  • Happens in a js file with folded functions; without folding seems to work fine.

@vscodebot vscodebot bot locked and limited conversation to collaborators Jan 6, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
editor-core Editor basic functionality feature-request Request for new features or functionality help wanted Issues identified as good community contribution opportunities
Projects
None yet
Development

No branches or pull requests

7 participants