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

Persist cursor position per-buffer #2

Closed
stevearc opened this issue Nov 1, 2022 · 4 comments
Closed

Persist cursor position per-buffer #2

stevearc opened this issue Nov 1, 2022 · 4 comments

Comments

@stevearc
Copy link
Owner

stevearc commented Nov 1, 2022

I'm a bit confused about the question of persisting cursor positions ...

Even better than a repro, A showcase of the "issue".

Notice:

  • the cursor was sitting at main.lua:3 and side.lua:2
  • then we've quit (auto session save) while main.lua is open.
  • then upon returning (loading the session) the cursor position for main.lua is naturally restored (as you've noted)
  • however side.lua cursor position is reset to the top (the issue)

The issue is that resession is only saving a single cursor position, what I want is for it to save a cursor position for each file (not open buffers)

I hope this has made it clearer.

Originally posted by @RaafatTurki in #1 (comment)

@stevearc
Copy link
Owner Author

stevearc commented Nov 1, 2022

Moving the discussion of cursor position here so we can track separately.

This does clarify things! We persist the cursor position for all windows, but don't store the last cursor position for any buffers that are not open in a window. I haven't personally felt the need for this because I use the autocmd mentioned in :help restore-cursor, but I think the request is reasonable and makes sense. I'll look into making this work.

@RaafatTurki
Copy link

splendid!

@stevearc
Copy link
Owner Author

stevearc commented Nov 2, 2022

The implementation was easier than I thought. Give it a try; it worked fine in my testing but there may be some edge cases

@RaafatTurki
Copy link

RaafatTurki commented Nov 2, 2022

Works flawlessly! maybe add a config option to disable this feature (I'd vote for it to stay enabled by default tho).

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

No branches or pull requests

2 participants