Dook1 / Bookmarks-Dook

21 stars 2 forks source link

[Enhancement] Multiple improvements to the 'BookmarksDook' panel #11

Closed pidgeon777 closed 1 year ago

pidgeon777 commented 2 years ago

My suggestion is to add:

This would be the resulting bookmark list with the newly added columns:

ID | Filename                    | Line | Bookmark Label   | Line Text
---+-----------------------------+------+------------------+----------------
 0 | C:\Work\main.c              |   10 | Bookmark 1 label | Bookmark 1 text
 1 | C:\Work\main.c              |   34 | Bookmark 2 label | Bookmark 2 text
 2 | C:\Work\header.c            |    3 | Bookmark 3 label | Bookmark 3 text

The columns could be draggable so a user could decide in wich order display them.

An essential feature, would be to guarantee that all the currently active bookmarks of all the open files are listed.

Also, supposing that the BookmarksDook panel is focused, the following hotkeys could be activated:

Or, the contrary:

The shortcuts could more in general be decided by a user through the plugin Settings window

These suggestions would in my opinion greatly improve your already good plugin.

Dook1 commented 2 years ago

That's interesting. I'm busy right now, I'll do it a little later.

pidgeon777 commented 2 years ago

Hi @Dook1, just wondering if you were still integrating my proposal.

One thing I forgot to add, is that columns could be ordered by dragging them if a user decided to do so.

Dook1 commented 2 years ago

I will be free in 2 weeks and will do it.

Dook1 commented 2 years ago

This cannot be done because NPP does not provide an api to retrieve information from open tabs without switching to them.

pryrt commented 2 years ago

@Dook1 ,

This NPP issue and this spawned Community discussion show that there really is a desire in the Notepad++ user base for multi-tab management of the bookmarks, and your plugin seems like the most natural and likely fit.

I know you said,

This cannot be done because NPP does not provide an api to retrieve information from open tabs without switching to them.

... but that's really not as much of an inhibitor to the idea as you seem to indicate: For the initial information and NPP-startup, you could have your plugin initialization note the active tab, cycle through all the available tabs quickly to do your original processing, then re-activate the original tab, so the user is presented with the expected tab by the time they start editing. And since the bookmarks won't be changing in any given tab unless the user has activated that tab, and your plugin already knows how to track the changes to bookmarks in the active tab, that's already handled correctly.

Dook1 commented 2 years ago

Cycle through all the tabs will cause: 1) flickering 2) if the size of files is large or their number is large, it will cause serious delays

pryrt commented 2 years ago

A flickering one time probably wouldn't bother anyone (at least, probably not me). But yes, long delays caused by large files would be more likely to annoy users.

Alternatives:

The session.xml file has a <Mark line="13" /> inside each file's entry for files that have bookmarks. So on load, you could scan through the session file to get the initial bookmarks to populate your panel.

Or you could just wait to process a given file's bookmarks until the user activates that tab (and maybe give them a menu entry to initiate an intentional scan of all the open files for bookmarks) -- so it would at least give the users access to the bookmarks in all the tabs they've visited so far.

Dook1 commented 2 years ago

The first alternative is not suitable because it does not allow to get the content of the line. And the second alternative I have long ago implemented, but due to lack of time I abandoned it with minor flaws.

Dook1 commented 1 year ago

added in 3.0.0 https://github.com/Dook1/Bookmarks-Dook/releases/tag/3.0