Skip to content

Marks revival #13649

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Marks revival #13649

wants to merge 2 commits into from

Conversation

sheeperino
Copy link

@sheeperino sheeperino commented May 30, 2025

This pull request acts as a continuation of #3720

Questions/notes:

  • Currently the marks are only associated with the special register "^", which when read yields the marks contents. Should they be written to/read from registers? Should they be stored in a jump list fashion?
  • It's not clear what should happen if you combine Selections with multiple Selections when the results overlap. Currently this PR combines them in a pair-wise fashion, but I believe that combining them in a windowed fashion in order may be a better solution. What should the behavior be?

The following is the description taken from #3720

Marks are a way of recording selections/ranges in a way that can be used later. It's like the ability to store jumplist entry in a registers plus commands to combine selections to/from registers. This PR implements kakoune's marks commands and also adds a function that joins the ranges of a given selection together.

I would like to explore basing LSP snippets on marks so I'll keep this as a draft for now.
[...]
Closes #703

@sheeperino
Copy link
Author

sheeperino commented May 30, 2025

To elaborate on the second question, suppose we have

foo
bar
baz
qux
nya

We have foo and bar in the mark, and we are currently selecting qux and nya. With the current method of combining selections, if we try intersecting them we would get a selection spanning from \nbar to qux\n, I believe this behavior is unintuitive.

Currently the way selections are combined together are by combining the 1st element of the mark and 1st element of the current selection, and so on... This means you can only combine marks and current when their amount of selections is the same.

I believe this restriction could be resolved if we combined in a windowed fashion, for example:
intersect qux and nya, then nya and bar, finally bar and qux.
The resulting selection would be this:

foo[]
bar[
baz
]qux[]
nya

(note: the way intersection works at the moment when there's no overlapping selections is by selecting what's in between, should this be the behavior?)

@kirawi kirawi added the A-helix-term Area: Helix term improvements label May 30, 2025
@Axlefublr
Copy link
Contributor

yooooo marks revival 🗣️🗣️🗣️ thank you for picking this up

@sheeperino
Copy link
Author

Should pair-wise and whole-selection combinations both be available?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Marks
3 participants