boltex / leojs

Leo Literate Editor with Outline in Typescript
MIT License
23 stars 0 forks source link

The GNX displayed above body text should be a path-based UNL #104

Open tbpassin opened 6 months ago

tbpassin commented 6 months ago

Showing a GNX above the panel with the body text is not helpful since it doesn't help the user know anything useful. Either it should be a path-based UNL or it should be removed. See screen shot below: example-marked-gnx

Also, I tend to mistake this node identifier for actual body text. I am unsure if it's text that accidentally got there and that I can delete, or what.

I suggest reconsidering what purpose this serves.

boltex commented 6 months ago

@tbpassin Thanks!

Yes it's a good idea to have the body pane 'breadcrumbs' start with the full path of the selected commander, exactly like a full path UNL !

Thanks again for this suggestion!

boltex commented 6 months ago

@tbpassin You can also turn off breadcrumbs for your editor panels in vscode's settings.

boltex commented 2 months ago

@tbpassin Aha! this might be implementable with a simple trick!

I only have to make a "translation table" for gnx <- -> headline (they have to be unique, so maybe with added number at the end if more than one opened gnx has the same exact headline to differentiate them) , and then keeping the gnx hidden and instead using the headline string as the actual file name so that the breadcrumb displays the node's headline instead of its gnx.

Hmm.... Would not be that hard or complicated to implement after all! Stay tuned! 😉

tbpassin commented 2 months ago

If you've implemented it, there is a legacy form of the UNL, and that has the path to the node. You could truncate that or leave off the outline part of the path.

Having a separate legacy form of the UNL is relatively new to Leo/Python.

boltex commented 2 months ago

@tbpassin Of course I have! :D haha! (Hover your mouse over the Unl:Gnx item at the bottom of the status bar in leojs or leointeg )

image

boltex commented 2 months ago

Nevermind all that : I've just discovered that the VSCODE API possibly has something for controlling the breadcrumbs! The "document symbol provider" part of the API seems to be useful for that.

boltex commented 2 months ago

@tbpassin

Progress! but, some constraints : The body panes (and detached body panes) are working on a per-VNode basis (gnx) , not per Position. Since UNLs refer to a position I cant's use them.

So I went for a compromise: The breadcrumbs will show the (short) filename, followed by the headline. 😄 This is very similar to a 'short legacy' UNL...

The only difference with a short legacy unl, is that all the middle headlines leading to the final node are hidden, which would anyways be too long in most cases, if the node is even slightly deep in a tree, the unl would be cut for being too long and we'd miss the headline. So seeing the headline is more useful and practical in some way after all rather than having the whole list of parent's headline preceding the headline. :)

boltex commented 2 months ago

After experimenting, the most readable and useful breadcrumb above body text in all circumstances is the headline only, without filename.

I may add a option(s) to also have the short/long filename, etc. before the headline. but the default will be headline only.

boltex commented 2 months ago

Only problem now is that the breadcrumbs do not refresh if the headline changes, unless the body changes. Even fireing 'file has changed' event does nothing if the content does not actually change. I'll have to find a way around that!