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

How to unmark and toggle #12

Closed
reagle opened this issue Aug 21, 2018 · 11 comments
Closed

How to unmark and toggle #12

reagle opened this issue Aug 21, 2018 · 11 comments

Comments

@reagle
Copy link

reagle commented Aug 21, 2018

Using betterbookmarks v1.1.3 on ST 3.1.1 on MacOS and have two difficulties.

  1. It's still possible for me to have more than one mark per line.
  2. How do I unmark? I know I can clear all of them, but how do I toggle a particular one off?
@dusk125
Copy link
Owner

dusk125 commented Aug 21, 2018

Reagle,

  1. Yes it is, just disable the "mark_whole_line" option in the BetterBookmarks settings.
  2. You can run the command "better_bookmarks" with args {"subcommand": "mark_line"} which is bound to F11 by default.

For unmarking, currently the selection and cursor position have to be exactly the same. I'm considering adding an option in the settings that will ignore the cursor position and only use the selection in the mark; is this something you would find useful?

I hope this helps, please let me know if you have any other problems/questions.

@reagle
Copy link
Author

reagle commented Aug 21, 2018

Thanks for the quick response! Glad to see this plugin is still alive when so many others are abandoned.

The problem is that I cannot toggle bookmarks once a file has been closed and reloaded. Fresh bookmarks toggle via mark_line, but when I save a file, close it, and reopen, I can not toggle them off via the same command. I should be in the same exact position, I'm using the commands next_bookmark to move to it. (This is true whether mark_whole_line is true or false.)

To restate: When I create a new bookmark (on the second line after a 3 character first line) on an otherwise clear file and save, I see:

╰─➤  cat 01-introduction-md.bb_cache                                                          1 ↵
{"todos": [], "bookmarks": [[4, 4]], "functions": []}%

I can remove it with mark_line command. If I close the file the bb_cache remains the same, as it does when I reopen it. I can use next_bookmark to move to it, but after doing so, I can not toggle it off via the mark_line command.


Also, f11 on MacOS is a global shortcut for clearing the desktop. Assuming I get this working, can I map f2 to mark_line?

@dusk125
Copy link
Owner

dusk125 commented Aug 21, 2018

No problem!
Thanks for providing me more information, I misunderstood your problem. I'll take a look into why you're unable to unmark after closing and opening the file again. I'll update this issue once I find the problem.

That's correct, you can change the keymapping by opening the BetterBookmarks user keymap file by Preferences->Package Settings->Better Bookmarks->Key Bindings User. You can copy the entries you'd like to change from the Better Bookmarks Default and paste them into your User bindings, then change them to whatever you'd like!

@dusk125
Copy link
Owner

dusk125 commented Aug 21, 2018

Eureka!
Some technical information about the problem:
Internally, I was using Tuples to represent the sublime.Regions to allow filtering through lists easier. When the bookmarks were being saved to the cache files, the json package was converting the Tuples to lists. When the file was loaded again, the list was not converted back to a tuple causing the issue.

The fix:
Now internally, I'm using lists to represent the Regions. Everything seems to be working correctly now. I'm going to do a little more testing then create a new release.

@reagle
Copy link
Author

reagle commented Aug 21, 2018

Thank you. How long before you think it'll take to show on packagecontrol?

@dusk125
Copy link
Owner

dusk125 commented Aug 21, 2018

I'm not sure, probably within an hour or two. Now that I've created a release (1.1.4) for the fix, Package Control should pick it up soon.

@reagle
Copy link
Author

reagle commented Aug 21, 2018

Thanks, I'll check it then. Once working, I'll be able to replace the abandoned BufferScroll with BetterBookmarks and Typewriter (for vertical centering).

@dusk125
Copy link
Owner

dusk125 commented Aug 22, 2018

The version on Package Control has been updated.

@reagle
Copy link
Author

reagle commented Aug 22, 2018

That fixes it, thank you. I have two other small issues, I can open separate issues if you prefer.

  1. When going to a bookmark when "mark_whole_line": true, the line is selected.
  2. It'd be nice to have these commands in the command palette.

@dusk125
Copy link
Owner

dusk125 commented Aug 22, 2018

You're welcome! Yes please open each of these in a new issue and I'll comment on them.

@reagle
Copy link
Author

reagle commented Nov 19, 2018

For completeness sake, I created issues #13 and #14.

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