nvim-orgmode / orgmode

Orgmode clone written in Lua for Neovim 0.9+.
https://nvim-orgmode.github.io/
MIT License
2.8k stars 121 forks source link

refactor(agenda): use extmarks to set tags in right column #683

Closed PriceHiller closed 3 months ago

PriceHiller commented 3 months ago

Before this change: agenda-tags-extmark-before

Notice that the tags end up off screen and do not get shifted to align to the right side of the screen.

After this change: agenda-tags-extmark-after

Notice that the tags are correctly aligned when the window is resized. Tags are not off screen at all.

PriceHiller commented 3 months ago

Looks like the latest nightly causes the CI to fail. Not an issue with this PR.

Running make test with the latest nightly (NVIM v0.10.0-dev-2445+g2e1f5055a) causes the tests to fail with or without these changes.

PriceHiller commented 3 months ago

The test error should be fixed by the PR I opened at #684

If that gets merged I can rebase this on top of it and go from there

PriceHiller commented 3 months ago

Rebased on top of #684 since it got merged.

kristijanhusak commented 3 months ago

Tags should re-align once you redraw the agenda with r. That is not happening so it's a bug on that side. I'm not sure how I feel about this. I'd prefer to leave it the original Orgmode way and just fix the re-align after redrawing.

This is how it looks in Emacs: emacs

This is Neovim with wrapping disabled: neovim-nowrap

And Neovim with wrapping enabled: neovim-wrap

kristijanhusak commented 3 months ago

I pushed a fix for the realigning after render. Let me know how it looks now.

PriceHiller commented 3 months ago

I didn't realize how orgmode on Emacs handles it before opening this PR -- so extmarks is kinda non-standard to the Emacs implementation.

I pushed a fix for the realigning after render. Let me know how it looks now.

It aligns much better now, but still doesn't dynamically reflow etc. like extmarks and alignment gets really out of sorts when the window width is small. It seems to match up with Emacs though.

Would you be open to supporting a nonstandard (meaning not like Emacs) extmark approach as well hidden behind a config flag? I personally prefer the alignment of extmarks and the fact they take priority over long titles as well as working well on a single line without word wrapping.

kristijanhusak commented 3 months ago

I guess we could add it. Add an agenda key under ui in config, and add the flag there, something like use_virtual_text_for_tags = false.

PriceHiller commented 3 months ago

I guess we could add it. Add an agenda key under ui in config, and add the flag there, something like use_virtual_text_for_tags = false.

Cool, then I'll close this PR and make a new one with the changes from master when I get a sec.