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

Mouse fails to set cursor position at end of line in command mode #1469

Open
1 of 3 tasks
Manuzor opened this issue Oct 24, 2016 · 4 comments
Open
1 of 3 tasks

Mouse fails to set cursor position at end of line in command mode #1469

Manuzor opened this issue Oct 24, 2016 · 4 comments

Comments

@Manuzor
Copy link

Manuzor commented Oct 24, 2016

Summary

When command_mode is active, using the mouse to change the cursor position does not work as expected in a certain case. This case is when clicking on the very last clickable position in a line, i.e. on the newline character.

It seems like the mouse click is unable to set the actual cursor position but succeeds in setting the rendered cursor position in this case.

I've already posted about this in the forums. Here's the link: https://forum.sublimetext.com/t/command-mode-cursor-jumps-back/23733

Expected behavior

When clicking beyond the last character in a line with the mouse, i.e. on the newline character, the cursor should jump and stay to the left of the newline character. Trying to insert a new character at that point should insert it before the newline character, just like when the cursor is anywhere else on that line. Also, when leaving command mode, the cursor should stay where it is.

Actual behavior

When clicking beyond the last character in a line with the mouse, i.e. clicking on the newline character, the cursor should jump to the left of the newline character. However, the cursor then jumps to the left by one textpoint. Clicking on the same spot again, the cursor appears to be in the correct position.

  • Trying to insert a new character at that point puts the cursor one to the left again and inserts the character in the wrong position, i.e. before the last non-newline character in the line.
  • Leaving command mode at this point, the cursor is set back one character to the left as well. Entering and leaving command mode then does not change the cursor position at all, though.

Animated image showing the described issue

Steps to reproduce

  1. Enter command mode: view.settings().set('command_mode', True)
  2. Use the mouse to click on the end of some line.
  3. Watch the cursor jump to the left by 1 character.
  4. Click on the same spot again to see the cursor jumping to the desired position.
  5. Either insert a character somehow (plugin, command) or leave command mode: view.settings().set('command_mode', False)
  6. Watch the cursor jump back one character again, placing it before the last non-newline char in that line.

Environment

  • Operating system and version:
    • Windows 10 Education, Version 1607, OS Build 14393.321
    • Mac OS NOT TESTED
    • Linux NOT TESTED
  • Sublime Text:
    • Build 3126
@keith-hall
Copy link
Collaborator

When clicking beyond the last character in a line with the mouse, i.e. clicking on the newline character, the cursor should jump to the left of the newline character. However, the cursor then jumps to the left by one textpoint.

Confirmed on Windows 7 and Ubuntu 16.04. Left mouse button down = correct caret position, button up/release = move back one character. Seems like a bug in the built in drag_select command.

@keith-hall keith-hall changed the title Mouse fails to set cursor position in command mode Mouse fails to set cursor position at end of line in command mode Oct 24, 2016
@Manuzor
Copy link
Author

Manuzor commented Nov 6, 2016

I have observed another detail. First you have to bring the cursor in the situation described above (click past last char once, then do it again). When you save the document now (if doesn't matter if you had changes or not), the cursor jumps back to the actual position after a short period of time.

Just thought I'd share my observation. Hope it helps.

@LandisTwo
Copy link

LandisTwo commented Feb 7, 2019

me too. was driving me crazy.
I disabled or removed a lot of packages, trying to figure out if it was due to a key binding.


It turns out that hitting 'Esc' key, when there's nothing to 'escape' from (eg, Package Panel, Console etc) enters or 'turns on' Vintage Mode (a vi emulator or 'command mode').
The way out or back to 'Visual Mode' is by,
Pressing 'i' key (that's lowercase Eye (no quotes)).
Landis.
ps, Vintage is an ignored package in Default Settings, but not in User Settings.
I thought that User settings appended Default, but apparently not.
I added Vintage to the list in User Settings and now Esc does not invoke 'command mode'.
Landis.

@FichteFoll
Copy link
Collaborator

FichteFoll commented Feb 7, 2019

Keys in the User settings always overwrite the corresponding key from the Default settings file.

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

4 participants