-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Line-wise extend mode #356
Comments
I discuss that as one of the motivating examples in #362. IMO it's potentially solvable in an elegant way that doesn't involve any special state, depending on your definitions. Having said that, I also like vim's line-wise extend mode, ha ha. :-) |
Very good points you made in #362! 😄 I see the current plan is to keep the current behavior but get an internal refactoring to use gap indexing instead:
So I guess this wouldn't fix |
Correct, it won't fix (Edit: I'm personally pretty optimistic. I think there are very likely to be good ways to make everything work intuitively with zero-width cursors, even in a terminal. But I think it will be easier to demonstrate and convince people with a prototype, which will be a lot easier to whip up after switching to gap indexing anyway.) |
(I'm very enthusiastic about this approach, I'll will be following that!) |
I wonder if simply implementing |
Or |
I think it's enough albeit a bit less efficient |
I've implemented |
Looks good, thank you! 🙂 Possible plugin-provided implementation for VIM-like line-wise extend mode : add a hook on selection change to call |
Hi, I've been trying I was also prototyping https://github.com/dpc/breeze , which is kakoune inspired editor with 0-width cursor as a base mode of operation, also in Rust. Since you kind of work on a very similar thing though far more featureful already I thought I might point to it just as an inspiration. In it I used gap-cursor from the start, and I represent an unselected empty line as line NOT considered fully selected: line considered fully selected: That little arrow is a marker of a selected newline. You might want to try it yourself, run breeze, open some file and see how it feels. |
@dpc
I would still like to experiment with approaches to indicate/visualize zero-width cursors within the limitations of terminals, but I don't think vertical-line cursors is a workable solution in the current terminal landscape, unfortunately. |
FWIW I made a working prototype some time ago to change cursor shape on mode change (#323) and this is what I ended up with: We can show an I beam for the primary cursor (given that the terminal supports it) but that's about it. For multiple cursors we'll have to fall back to block cursors in the terminal. |
I thought about it myself, and my conclusion was: Why would anyone go so out of their way to use some super niche text editor... and then plan to use it with some legacy underpowered terminal emulator, instead of one of the fast modern featureful ones? And: Given such a dominance of "mainstream" CLI modal text editors like Neovim Emacs, why would anyone bother with some weird new one? An editor like this MUST do something far, far better than existing ones and provide substantially better experience to have people stick around and suffer through some other pain points like smaller ecosystem. For both legacy & multi-cursor, I was planing to display a normal 1-width cursor fallback. |
(Before I go any further, I just want to make sure anyone stumbling on this understands: I am not the primary author of Helix. I sometimes write with an authoritative voice, but I'm only speaking for myself here.)
I mostly agree with you here (with some minor quibbles). But the main issue still remains: even the modern terminal emulators don't support multiple vertical-line cursors. If it were a reasonably common feature among modern terminal emulators I think I'd be right there with you. But I don't know of any terminal emulator that supports this, even among modern ones. That doesn't mean one doesn't exist, of course. But the point is that it's definitely not something we can rely on, even on a modern system. I think our best option for accommodating vertical-line cursors is to support them in a GUI version of Helix. Then we can draw things however we want. Okay... so having said all of that, I want to come back to what I think is the more pertinent point: editor behavior. Even if we can't display vertical-line cursors, that doesn't necessarily mean we can't support zero-width cursor behavior. I had some ideas about that in #362. Basically, if we make a distinction between "cursors" and "selections" (the former being zero-width, the latter being anything > zero-width), then we can make a visual distinction between the two by e.g. display cursors with a different color. I think as long as we made this a front-and-center concept in Helix, it could work well. But I also think it needs some prototyping and experimentation to see if it actually works well in practice, and to explore/discover other possible solutions that might work even better. Since implementing #376 that kind of experimentation should be much easier to do.
Independent of the substance of this discussion, I see people making this kind of argument a lot when trying to convince open source projects to change what they're doing. For some projects that's reasonable, due to their nature. But for many others (I think including Helix) I find this kind of reasoning odd, and it kind of comes across as "Cm'on kid, don'cha wanna be famous?" I don't think many of us are developing Helix specifically because we're trying to make it popular. We're developing Helix because we personally want to use it as our editor. So I think it's best to focus the discussion on the actual pros and cons of the available approaches rather than on what would attract more people to the project. |
As a kakoune user, I find that I rarely use multiple selections and usually miss the simplicity of
👍 |
Ah, interesting. Coming from Sublime, it's a primary workflow for me. It's certainly a little trickier to use effectively in Helix right now with the available selection commands (and I suspect that's true in Kakoune as well...?). But after higher priority things have been addressed, that's something I want to tackle. Assuming no one else gets to it first. |
Can this issue potentially be re-opened? The OP seems satisfied with the current solution, but IMO |
Second. |
You just got it the wrong way around. You enter insertmode with Just like kakoune we have no plan to add a linewise selection mode. |
Description
A new line-wise extend mode similar to (neo)vim's line-wise visual mode that we can enter by pressing
V
.Aside
As mentioned in this issue I would like it to replace current line selection using
x
.Current
x
(kakoune'sx
) has a few pain points:x
the next line is selected in addition to the current line. This totally makes sense, but makes the behavior somewhat feeling weird. We could use a new state just for that, but that's not very elegant.X
to extend up though).For more background, see this kakoune issue.
Line-wise extend mode fixes the above pain points and can also do more:
V
switch to line-wise extend mode and only makes sure the current line is fully selected whether current line is empty or not.Vy
would effectively be vim's "yank current line" (yy
) while kakoune'sxy
is "yank current line if it is not empty, yank both current and next line othewise".The text was updated successfully, but these errors were encountered: