-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
number of selections lost when cursors overlap #2298
Comments
You can count the lines and enter |
That's unrelated to the bug. If you follow the example you can see the selection counter at the bottom right-hand side change from |
Would also be useful for changing indention from tabs to spaces with eg |
I looked a bit into this because I also tried to replace tab characters with spaces and then ran into this issue. The change command is currently implemented by first deleting the ranges of the selection, and then switching to insert mode (so similar to pressing
If we are really lucky this is a one line change in edit: Changed !(self.to() <= other.from() || other.to() <= self.from()) and self.transform(|r| r.grapheme_aligned(text)).normalize() That clearly now violates the invariants described in the doc comment of Input is then added multiple times though, as expected, but unfortunately the ranges do not separate after inputs, i.e. input change sets need to be fixed for zero width ranges, well... So there are potentially a lot changes necessary with this particular approach. Can someone oversee what needs to be changed? What was the background for not allowing zero width ranges except for the document's end? |
That decision was made in #362 |
A lot of our editing model relies on overlapping ranges being merged. I don't think we should ever change that. I think the only case Quere this really is useful is when entering insertmode (so di or c) so there may be a way to special case that particular case (maybe just for c?) I do want to stop merging djecent (non-overlapping) selections (that will not work with c/d ofcourse but it will work with |
In addition to formatting Markdown tables and changing tabs to spaces, another common use case is redacting (i.e., "masking" or "zeroing out") a multi-character value—e.g., a hash, secret, color hex value, etc.—while retaining its character count.
Indeed, all these use cases exploit insert mode. However, it seems worth noting that in Kakoune, selections are respected in normal mode as well. For example, starting with text
|
It might be being handled by this function in Kakoune? https://github.com/mawww/kakoune/blob/c81266d4f6e5ddff861dc245d86600cb8f68b9e8/src/selection.cc#L443-L463 |
@pascalkuthe I think we can rename this issue to explicitly the |
I haven't looked too much into what kakoune does yet ao I cant comment on that. If you looked into that and that's how ti works feel free to rename |
Example, assuming you have a buffer with a word So this doesn't only affect Originally posted in: #10861 |
The number of selection is lost when selections are overlapping
example with the following text
when I select the spaces (8 sel) on the line with
xs
and want to replace the spaces with - with `c-' I endup with onlyThe
c
turns the 8 sel into only 2.kakoune correctly manage overlapping selections, keep 8 sel after the c and replace all the spaces with '-'
Of course you have the
r
primitive for doing that in helix, but I think changing the number of selections is kind of counter intuitive.The text was updated successfully, but these errors were encountered: