Skip to content

Cursor does not go to the end of line when pressing "End" with word wrap enabled #19644

Closed

Description

  • VSCode Version: 1.8.1
  • OS Version: Windows 10

Steps to Reproduce:

  1. Enable the word wrapping: "editor.wordWrap": true
  2. Write a line long enough so that it covers multiple lines
  3. Put the cursor at the beginning of the line
  4. Press the End button

The cursor does not go to the EOL character.

Example here

Activity

  1. added
    feature-request
    on Feb 1, 2017
  2. rebornix commented on Feb 1, 2017

    @rebornix
    Contributor

    We have defined a bunch of target positions for cursorMove command as below

    export const CursorMovePosition = {
    	Left: 'left',
    	Right: 'right',
    	Up: 'up',
    	Down: 'down',
    
    	WrappedLineStart: 'wrappedLineStart',
    	WrappedLineFirstNonWhitespaceCharacter: 'wrappedLineFirstNonWhitespaceCharacter',
    	WrappedLineColumnCenter: 'wrappedLineColumnCenter',
    	WrappedLineEnd: 'wrappedLineEnd',
    	WrappedLineLastNonWhitespaceCharacter: 'wrappedLineLastNonWhitespaceCharacter',
    
    	ViewPortTop: 'viewPortTop',
    	ViewPortCenter: 'viewPortCenter',
    	ViewPortBottom: 'viewPortBottom',
    
    	ViewPortIfOutside: 'viewPortIfOutside'
    };
    

    Apparently we should add lineEnd and lineStart as well. A good contribution candidate for beginners.

  3. added
    good first issue
    help wanted
    on Feb 1, 2017
  4. flowmemo commented on Feb 13, 2017

    @flowmemo

    It seems like #15121 reported a similar issue.
    So, what is the expected behavior of 'Home' and 'End' with word-wrap?

  5. clemtoy commented on Feb 14, 2017

    @clemtoy
    Author

    flowmemo (@flowmemo)
    At least:

    • The cursor should go to the column 0 when 'Home' is pressed, instead of the start of the wrapped line.
    • The cursor should go to the EOL character when 'End' is pressed, instead of the end of the wrapped line.

    Better (as Sublime Text does):

    • 'Home': the cursor goes to the start of the wrapped line at first press and to the column 0 at the second press
    • 'End': the cursor goes to the end of the wrapped line at first press end to the EOL character at the second press.
  6. flowmemo commented on Feb 14, 2017

    @flowmemo

    Clément Michard (@clemtoy)
    It seems like different editors have their own way to deal with this situation.
    I just tested this behavior in Visual Studio 2015 Community, and the result is same as in VSCode.

    What is the opinion from VSCode team?

  7. misoguy commented on Feb 15, 2017

    @misoguy
    Contributor

    I am currently looking at this issue and trying to change the behavior of the end button.
    However, I think it is important to understand the opinion from the VSCode team as flowmemo (@flowmemo) has mentioned. Is the opinion from the VSCode team equal with what Clément Michard (@clemtoy) suggests?

  8. clemtoy commented on Feb 21, 2017

    @clemtoy
    Author

    Peng Lyu (@rebornix) What is your opinion?

  9. rebornix commented on Feb 21, 2017

    @rebornix
    Contributor

    Clément Michard (@clemtoy) Soo Jae Hwang (@misoguy) thanks for your continuous input on this. I can see reasons that why going to the start/end of both line and screen line is necessary. So instead of raising other users' concern, I prefer the second proposal: double press Home/End.

  10. 2 remaining items

  11. misoguy commented on Mar 14, 2017

    @misoguy
    Contributor

    Peng Lyu (@rebornix) It's been a while since this code has been implemented and added to the PR #21338. It'd be nice to get some kind of feedback when you get the chance :) Thanks!

  12. rebornix commented on Mar 14, 2017

    @rebornix
    Contributor
  13. misoguy commented on Mar 15, 2017

    @misoguy
    Contributor

    Peng Lyu (@rebornix) That's wierd...because I can't find any comment at https://github.com/Microsoft/vscode/pull/21338/files#r103243328
    Could you check it one more time and make sure that your review has been submitted?
    Regarding the test, do you mean the test code for editorStacksModel? If so, it is implemented as commit 039a54d

  14. rebornix commented on Mar 15, 2017

    @rebornix
    Contributor

    screen shot 2017-03-15 at 10 39 37 am

    It's about invokeAll, we need to support multiple cursors :)

    screen shot 2017-03-15 at 10 40 43 am

    See above screenshot :)

  15. misoguy commented on Mar 16, 2017

    @misoguy
    Contributor

    Peng Lyu (@rebornix) Thanks for the comments! I'll see what I can do about them.
    For the comment on navigating between view parts, that was a minor bug in the code and I had them fixed before being merged :) It should be consistent now.
    BTW, I think it's best that you submit the reviews by clicking the Finish your review button seen on the screenshot :) So that I can see them on github and reply to the comments directly.

  16. rebornix commented on Mar 16, 2017

    @rebornix
    Contributor

    Sorry for making you wait for so long Soo Jae Hwang (@misoguy) now I finally know the difference between A Single Comment and Start a Review :(

  17. misoguy commented on Mar 20, 2017

    @misoguy
    Contributor

    Peng Lyu (@rebornix) No problem~ I was working on another issue and didn't really have the time to take a second look at it anyways :) I'll try get on the comments for #21338 this week~

  18. misoguy commented on Mar 20, 2017

    @misoguy
    Contributor

    Clément Michard (@clemtoy) Peng Lyu (@rebornix) flowmemo (@flowmemo) After implementing the changes to the behavior of Home and End button commands, it seems to me that there are some type of different situations that should be clarified.

    1. Currently when you press Home at the first non whitespace column of a line which has indentation, it goes to the beginning of a line(column 0).
      Should this behavior be kept?
      (If it should be kept situation 2, which is the multi cursor mode will look more complex)

    2. multi cursor mode.
      Home command

      1. multi cursor in different file lines with different indentation.
        Should all the cursors go to the first non whitespace?
      2. multi cursor in different wrapped lines of a file line.
        Should all the cursors go to the first non whitespace of the file line or the wrapped line?

    End command also has the same issue just vice versa.

    I'm not sure if this explanation is enough to understand...Please comment for further explanation :)

  19. marcushv commented on Mar 30, 2017

    @marcushv

    Sublime Text on my macOS works as follows with wrapped lines:

    • cmd+right -> end of wrapped line
      • cmd+right x2 -> end of line
    • cmd+left -> first character of wrapped line
      • cmd+right x2 -> first character of line
      • cmd+right x3 -> column 0
    • ctrl+E -> end of line
    • ctrl+A -> column 0

    I would like to be able to set up my keybindings so that I can use it the same way.
    Note: ctrl+E/A are basically system wide on macOS, except for some programs (such as VSCode)

  20. clemtoy commented on Jun 2, 2017

    @clemtoy
    Author

    Thank you very much !

  21. locked and limited conversation to collaborators on Nov 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

editor-corefeature-requestgood first issuehelp wanted

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions