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

last cursor position not preserved when clearMultipleCursorsOnEscapeInsertMode is true #899

Closed
kentor opened this issue Oct 3, 2017 · 7 comments · May be fixed by #1097
Closed

last cursor position not preserved when clearMultipleCursorsOnEscapeInsertMode is true #899

kentor opened this issue Oct 3, 2017 · 7 comments · May be fixed by #1097

Comments

@kentor
Copy link

kentor commented Oct 3, 2017

Check list

  • Atom version info(atom --version)
Atom    : 1.20.1
Electron: 1.6.9
Chrome  : 56.0.2924.87
Node    : 7.4.0
  • vim-mode-plus version.
1.8.0
  • Your OS(e.g. macOS Sierra 10.12.3)
macOS High Sierra 10.13
  • You disabled vim-mode? You cannot use both vim-mode and vim-mode-plus simultaneously.
yes
  • Tried to latest stable atom version with latest vim-mode-plus.
yes

Saw this #562 but seems to not work. Check out the gif:

@kentor kentor changed the title last cursor position not preserved last cursor position not preserved with multiple cursors on exit Oct 3, 2017
@kentor kentor changed the title last cursor position not preserved with multiple cursors on exit last cursor position not preserved when clearMultipleCursorsOnEscapeInsertMode is true Oct 3, 2017
@t9md
Copy link
Owner

t9md commented Oct 3, 2017

If you can reproduce it, give me complete set of

  • sample text
  • keystroke
  • expected result(final-text and description)
  • actual result(final-text and description)

@kentor
Copy link
Author

kentor commented Oct 3, 2017

this is with clearMultipleCursorsOnEscapeInsertMode: true

sample text:

aaaa bbbb
aaaa bbbb

put cursor on top row b (any one, they all behave the same)
keystrokes:

cmd+d
cmd+d
c
cccc
escape

final text:

aaaa cccc
aaaa cccc

cursor will be on last c of last row
expect cursor to be on last c of first row

@t9md
Copy link
Owner

t9md commented Oct 3, 2017

cursor will be on last c of last row
expect cursor to be on last c of first row

Cursor should be at 2nd(=last row) c, this is designed behavior.
Last cursor is the cursor added most recently(thus, 2nd row in this case), see where autocomplete-plus's popup shows up.(It would be shows up at 2nd bbb position in this case).

So IMO, you have wrong expectation what last cursor is.

@kentor
Copy link
Author

kentor commented Oct 3, 2017

hmm interesting that the autocomplete-plus shows up on the 2nd cursor

but i would still expect the cursor to go back to where you originally started the multiple cursors with cmd+d, and i have two cases for why:

if you turn off vim-mode-plus, and repeat the same thing with

cmd+d
cmd+d
cccc
escape

the cursor will be on the first row.

this is also the behavior that i am used to on sublime text's vim mode + multiple cursors and vscode's vscodevim + multiple cursors

@t9md
Copy link
Owner

t9md commented Oct 3, 2017

For specific scenario you explained above, I understand your request.

But that behavior is based on behavior Atom-core not respect last-cursor position when merging multiple-cursor(or selections).
I intentionally avoid using that atom-core's behavior, it might be good in some scenario(like you explained), but bad for many other scenarios.

I can add this as opt-in-by-config feature(not so motivated though for me).
Will keep open for a while to collect feedback from others.

@trkoch
Copy link

trkoch commented Sep 21, 2018

My expectations align with @kentor. With clearMultipleCursorsOnEscapeInsertMode enabled I'd expect the first added cursor's position to be respected.

In terms of tests found in vim-state-spec.coffee this is the expected behaviour.

describe "clearMultipleCursorsOnEscapeInsertMode setting", ->
  beforeEach ->
    set
      text: 'abc'
      cursor: [[0, 1], [0, 2]]

  describe "when enabled, clear multiple cursors on escaping insert-mode", ->
    beforeEach ->
      settings.set('clearMultipleCursorsOnEscapeInsertMode', true)
    it "clear multiple cursors by respecting first added cursor's position", ->
      ensure 'escape', mode: 'normal', numCursors: 1, cursor: [0, 0]

    it "clear multiple cursors by respecting first added cursor's position", ->
      set cursor: [[0, 2], [0, 1]]
      ensure 'escape', mode: 'normal', numCursors: 1, cursor: [0, 1]

@trkoch
Copy link

trkoch commented Sep 21, 2018

By the way, I should add this (reversed) behaviour aligns with default Atom when adding cursors with cmd+d, making changes and finally clearing cursors with esc. Currently my workaround is to clear multiple cursors while in insert mode.

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

Successfully merging a pull request may close this issue.

3 participants