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

Incorrect Sublime EOL and BOL cursor movement when Phantoms are present. #6098

Closed
facelessuser opened this issue Aug 16, 2023 · 12 comments
Closed

Comments

@facelessuser
Copy link

facelessuser commented Aug 16, 2023

Description of the bug

When an inline phantom is present, on platforms like Windows that use the move_to command to navigate to the EOL and BOL, the cursor does not move as expected.

This seems to only affect Windows and maybe Linux (did not test). Mac does not seem to have a binding to jump to EOL and BOL using move_to on Mac as it does not have a home or end key. I guess Sublime let's mac manage the cursor behavior.

Steps to reproduce

  1. Create a new file.

  2. Insert the following text:

    Here is some text
    Here is some more text
    
  3. Run the following commands to inject a phantom on the first line.

    >>> view = sublime.active_window().active_view()
    >>> view.add_phantom('test', sublime.Region(7), '<span>phantom</span>', 0)
  4. Place cursor on second line.

    Here is<phantom> some text
    Here is some more text<cursor>
    
  5. Press home key to navigate to the BOL.

Cursor will incorrectly jump to the start of the line with the phantom instead of the line it is on.

<cursor>Here is<phantom> some text
Here is some more text

Cursor should appear here:

Here is<phantom> some text
<cursor>Here is some more text

Expected behavior

See reproduction for expectation vs actual behavior.

Actual behavior

See reproduction for expectation vs actual behavior.

Sublime Text build number

4154

Operating system & version

Windows 10 Enterprise 21H2, maybe Linux (not an issue on Mac)

(Linux) Desktop environment and/or window manager

No response

Additional information

No response

OpenGL context information

No response

@facelessuser facelessuser changed the title Sublime EOL and BOL cursor movement when Phantoms are present. Incorrect Sublime EOL and BOL cursor movement when Phantoms are present. Aug 16, 2023
@u1735067
Copy link

Thanks for the issue, I thought I had a more general issue before really looking into this. The package Highlight Dodgy Chars is also affected by this (when a buffer contains a "dodgy" character). It happens on v4152 (Win) and I think it also happened on v4143.

@facelessuser
Copy link
Author

@deathaxe why is this an enhancement and not a bug? This seems to be a bug to me. This does not seem like intended behavior at all.

@facelessuser
Copy link
Author

I'll clarify a bit more. I'd like to see this not languish as a "nice to have" as this affects people's workflow and causes frustration for the user, so much so, that they consider turning off plugins so they can just navigate code properly.

@predragnikolic
Copy link

@deathaxe
Copy link
Collaborator

I can reproduce strange caret movement over phantoms, but it may or may not be a separate issue.

I can't however reproduce home or end key to behave unexpectedly, neither with steps provided in OP nor with multiple carets in a stylesheet. (ST4154 & Win11)

Animation

Animation

@facelessuser
Copy link
Author

@deathaxe I have been able to reproduce this on multiple Windows systems even using a portable sublime with no plugins. This behavior has been isolated and reproduced. While you may not have been able to reproduce it, I would not discount this as multiple people have experienced it and I have reproduced it on multiple Windows systems.

@facelessuser
Copy link
Author

I think I've been in the community long enough to have some credibility here 🙂.

@deathaxe
Copy link
Collaborator

I don't want to deny that, but as I also just set up a new vanilla portable ST4154 without any plugins beside ColorHelper, I wonder what's the difference or what else may be involved.

@facelessuser
Copy link
Author

facelessuser commented Aug 18, 2023

As I mentioned, I just reproduced it on a portable Sublime with no plugins. Not even Package Control installed. I would flag it as a bug and let the Sublime team demote it it cannot be reproduced. I will note, and I should have noted this in the opening, work has me on Windows 10. I can update the opening post. I'd be interested to hear system info of others experiencing this.

@u1735067
Copy link

u1735067 commented Aug 19, 2023

I tried to reproduce too and failed at first, but by reproducing my usual environment, I was able to find that I had to change the font_size setting to reproduce. With the default value (11) it works as expected, but with 8, 10, 12, 17, 21, 34, the home and end keys also add a virtual up keystroke.

This is on a screen with 150% scale, Win10 (19045.3324). Default font is Consolas. Reproduced in 4143 too.

7dbdd1f2-d150-47ce-83c7-5d3f8bce1fac.webm

(@deathaxe, may I ask what you used to record the screen with keystrokes?)

@facelessuser
Copy link
Author

facelessuser commented Aug 19, 2023

That's an interesting find. I think I may be scaling at 150% on Windows as well. I'd have to check my font size, but that is interesting that it has an effect.

@valeriesubl valeriesubl self-assigned this Aug 19, 2023
@BenjaminSchaaf
Copy link
Member

Fixed in build 4161.

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

No branches or pull requests

6 participants