bollu / sublimeBookmark

a better bookmark system for SublimeText
Apache License 2.0
133 stars 30 forks source link

Bookmark styling #17

Open KristerV opened 10 years ago

KristerV commented 10 years ago

Been using this plugin for weeks now. I like the extra options it gives. Here's a few simple improvements, that would make it a lot better IMO.

  1. Instead of highlighting the whole line, I would like it to highlight the selected code instead. Like default bookmark manager.
  2. Outline is very annoying. I suggest making it 0.4 opacity OR clearing it from view when something else is selected OR just having the manager select the text normally OR instead of outline just use line-highlight, just like the ST3 setting ["highlight_line": true].
  3. Some documentation how to set a hotkey for "GoTo".
bollu commented 10 years ago

I won't be able to work on this soon, since I have my exams going on :) However, I will do this soonish. Alternatively, you could send me apull request which I'd be happy to accept!

1) I'm not entirely sure what you mean by that. the default bookmark manager just seems to add a caret at the end of the line and leave it at that

2) As for the outlining, I agree. However, the ST API does not allow one to set opacity. I could try and provide an option to toggle this for sure.

3) Yeah, this is entirely my fault. I messed up the key bindings screen and I didn't notice. will do!

Thanks for the feedback :) ~bollu

KristerV commented 10 years ago
  1. In ST3 when I ctrl+f2 on a selected word, then f2 to find bookmark, it reselects the word.
  2. Interesting. I know https://github.com/SublimeText/WordHighlight does this pretty well. I had a look at the code, unfortunatelly I just don't understand where the actual highlighting happens.

I would happily PR, but I'm afraid I don't understand ST code enough.

devonparsons commented 9 years ago

I also find the Outline to be very annoying, it's the only thing stopping me from using this plugin constantly. KristerV's suggestions are all very good, and I think the best would be an option to just remove it and have the gutter arrow.

tcdaly commented 7 years ago

Regarding point 2, instead of outlines, would it be possible to have a user-configurable background highlight colour that extends the full width of the bookmarked line? This would make it easy to visually locate bookmarks rapidly. See below for rough idea.

image

DrBones commented 6 years ago

I might be late to the party but new to this package. The outline was also something that bothered me. Although I have no clue how to make a user configurable option (which would be very nice) I changed the appropriate lines in "sublimebookmark.py". I did have to extract the package first with a e.g. Package Resource Viewer.

In that file at line no. 285 is the add_regions() function which draws the regions. I have set mine to stippled underline which works for me. This is how it looks now: image

If one requires a different style take a look at https://www.sublimetext.com/docs/3/api_reference.html and look for the add_region() function to see the available flags. Removing it completely is easily done by replacing sublime.DRAW_STIPPLED_UNDERLINE above by sublime.DRAW_EMPTY.

I am not sure though how to color the whole line. I think that the whole line is technically not a region since there are no characters or white space. One would have to look into how the ["highlight_line": true] is done how @KristerV mentioned ...

Hope this might be helpful for anybody, sad to see this thing not maintained but none the less thanks @bollu for making a bookmark feature in Sublime Text that is actually useful!

sourcevault commented 1 year ago

Hi @DrBones, would you mind sharing if you are on Linux / MacOS / Windows ?

I am getting an Assertion error that the UID is not set correctly ( on windows ).

sourcevault commented 1 year ago

I managed to make some progress by commenting out all the async operations πŸ₯² .

They seem to be throwing errors and making the bookmark plugin non-functional.

progress
DrBones commented 1 year ago

Hi @sourcevault, sorry for the delay. Unfortunately, I am not on that system anymore. It was on windows though.

I am currently on a Mac and tried my hack with a sublime 3.2 version. It did not draw my desired stippled underline, however it did not throw any errors or required further modifications either. I could only remove the highlight alltogether...strange but probably the API changed at some point.

However, sublime 3 and this bookmarks plugin is rather old/unmaintained/deprecated e.g. for sublime text 4, this plugin does not work at all.

Sorry, I can't help any further. Best of luck! :)

sourcevault commented 1 year ago

Hi @DrBones πŸ˜ƒ nice to meet you !

I am on windows 10/11 | Sublime Text 4143.

For now, this change is working for me as any information on the code itself proves too much of an distraction:

view.add_regions(str(uid), [region], "text.plain", 
"bookmark", sublime.HIDDEN | 
sublime.DRAW_EMPTY |
sublime.DRAW_NO_FILL | 
sublime.DRAW_EMPTY_AS_OVERWRITE)

https://github.com/bollu/sublimeBookmark/commit/0edc70972ce72eb82729c619033c4208a5734bb0

I have no idea how it works, since I wrote it by playing around with all the options.

The naming also does not make much sense to me, what is the difference between HIDDEN and NO_FILL ? why is it provided as a OR, is there a chance of one of the options failing ? makes no sense to meπŸ˜•.

I mainly like this plugin for it's search function, I can name bookmarks, and then search through them, really handy with dealing +4000 lines of code.

ofcourse, we would all like to see further development, but not being a python coder myself, I do not see how I can be of much help, there is also not a lot of tutorials on how to build such plugins ( I mean you need to understand the entire suite - debugging, testing, writing idiomatic python - to do it on a high enough quality standard ).

Thanks you for documenting your finding, if I didn't come across it I would still be lost.