Skip to content

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

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

Conversation

PriceHiller
Copy link
Contributor

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 PriceHiller force-pushed the refactor/agenda-extmark-tags branch 2 times, most recently from 9219bcf to c39601e Compare February 25, 2024 06:19
@PriceHiller
Copy link
Contributor Author

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.

Since
neovim/neovim@2e1f505,
Neovim now explicitly requires the bufnr for
`vim.lsp.util.apply_text_edits` to be fully resolved — meaning it cannot
be 0 or null.
@PriceHiller
Copy link
Contributor Author

PriceHiller commented Feb 25, 2024

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 PriceHiller force-pushed the refactor/agenda-extmark-tags branch from c39601e to 2ed85b9 Compare February 25, 2024 07:34
@PriceHiller
Copy link
Contributor Author

Rebased on top of #684 since it got merged.

@kristijanhusak
Copy link
Member

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
Copy link
Member

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

@PriceHiller
Copy link
Contributor Author

PriceHiller commented Feb 25, 2024

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
Copy link
Member

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
Copy link
Contributor Author

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.

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.

2 participants