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

improve bookmarking #1126

Merged
merged 2 commits into from
Nov 24, 2020
Merged

improve bookmarking #1126

merged 2 commits into from
Nov 24, 2020

Conversation

tophf
Copy link
Member

@tophf tophf commented Nov 22, 2020

Fixes #952.

Line number area accepts mouse clicks now:

  • Left button toggles bookmark
  • Right button goes to the next bookmark (or previous if Ctrl is held)
  • Middle button selects all bookmarked positions, useful when multi-editing

Changed the default style so it's more noticeable especially in the dark themes:

image image

As for cycling through all sections, that's not reliably possible with the way sublime bookmarks work as their next/previous order isn't based on a line number but rather on the bookmarking order so it may jump all around the place within one section. This implementation seems weird but I'm not sure we can convince CodeMirror's author so maybe I could just re-implement bookmarking myself one day. That would make it available for all keymaps not just sublime.

@narcolepticinsomniac
Copy link
Member

LGTM. Might be cool if scrolling line jumps always centered, like swatch cycling. It'd be kind of a shame if this goes unnoticed, but I'm not sure there's a great visual indicator which won't be distracting though.

Mostly unrelated, I'd like to get rid of all the orange eventually. I get why we're using it in search and bookmarks, because it's a solid highlight color that works well, but damn it's fugly. Cyan stands out pretty well against most backgrounds too, so some shade of it must work decently.

@tophf
Copy link
Member Author

tophf commented Nov 23, 2020

Switched to cyan. I'm fine with orange but cyan matches our palette especially in the sectioned editor which has a focus outline of the same color.

@tophf
Copy link
Member Author

tophf commented Nov 23, 2020

scrolling line jumps always centered

Done.

@narcolepticinsomniac
Copy link
Member

Everything LGTM. You think we should at least give em hover backgrounds to indicate action? NBD either way. Up to you.

@tophf
Copy link
Member Author

tophf commented Nov 23, 2020

The cursor is changing, I thought that's enough.

@narcolepticinsomniac
Copy link
Member

narcolepticinsomniac commented Nov 23, 2020

Cursor changes after you click it. I'm just concerned that no one will realize they're nclickable in the first place, particularly since they never have been previously.

@tophf
Copy link
Member Author

tophf commented Nov 23, 2020

Ah. Maybe you can find a satisfactory solution then. If not, I'll try something tomorrow.

@tophf
Copy link
Member Author

tophf commented Nov 24, 2020

Turns out the feature works with all keymaps as long as we simply load sublime.js which we will always do. So now cursor:pointer is always present on line numbers. The only missing indication would be the right-click but maybe the users will find it eventually. Someone could add it to wiki as well.

...because we intentionally don't focus any CM in this case as it's bugged as hell
* pull editing-only stuff from codemirror-default.js
* switch throttledSetOption to IntersectionObserver
@dnknn
Copy link

dnknn commented Nov 24, 2020

Someone could add it to wiki as well.

https://github.com/openstyles/stylus/wiki/Hotkey-shortcuts#editor-shortcuts
May need to be modified

@tophf
Copy link
Member Author

tophf commented Nov 24, 2020

We can find a way to indicate the feature later.

@tophf tophf merged commit 657798d into openstyles:master Nov 24, 2020
@tophf tophf deleted the bookmarks branch November 24, 2020 10:17
@dnknn
Copy link

dnknn commented Nov 24, 2020

scrolling line jumps always centered

Done.

@tophf Now, right-click on the line-number can do this, but can let F2/Shift+F2 do the same this (jumps always centered) ?

@tophf
Copy link
Member Author

tophf commented Nov 24, 2020

Yeah that's good for consistency. Done in c635f2e.

@dnknn

This comment has been minimized.

@tophf
Copy link
Member Author

tophf commented Nov 25, 2020

Apparently it's because your section is taller than window. I'll look into that.

@dnknn

This comment has been minimized.

@dnknn

This comment has been minimized.

@tophf
Copy link
Member Author

tophf commented Nov 25, 2020

Should be fixed in a91183e.

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

Successfully merging this pull request may close these issues.

Improve CM bookmarking
3 participants