Skip to content
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

New commands shrink_line_above and shrink_line_below #3279

Closed
SoraTenshi opened this issue Jul 31, 2022 · 9 comments
Closed

New commands shrink_line_above and shrink_line_below #3279

SoraTenshi opened this issue Jul 31, 2022 · 9 comments
Labels
C-enhancement Category: Improvements

Comments

@SoraTenshi
Copy link
Contributor

I have checked whether such an issue already exists, however haven't found anything.
If it's a duplicate, i am sorry.

Describe your feature request

Basically the reversed behaviour of extend_line_above and extend_line_below.
The current behaviour seems rather inconsistent (having to go to visual mode and then manually unselecting. on extend_line_above this behaviour isn't even possible), so i that's why i have this proposal.

on shrink_line_above, the line of the topmost selection will be unselected.
on shrink_line_below the line of the bottommost selection wil be unselected.

@SoraTenshi SoraTenshi added the C-enhancement Category: Improvements label Jul 31, 2022
@the-mikedavis
Copy link
Member

Using these to undo extend_line_below and extend_line_above is better accomplished by #1596

On the one hand I could see myself using these commands (or a shrink_line version like #3046) but on the other it seems like a needless optimization on "hjkl in select-mode followed by X." With the addition of these commands we'd basically have the line-wise select-mode from vim.

on extend_line_above this behaviour isn't even possible

Flip the selection with A-; and then use hjkl in select mode

The current behaviour seems rather inconsistent

A bit of a nitpick: something cannot be inconsistent without differing from a baseline behavior. What is the current behavior inconsistent with respect to? IMO it would be inconsistent to have special handling for newlines.

@SoraTenshi
Copy link
Contributor Author

SoraTenshi commented Aug 1, 2022

Using these to undo extend_line_below and extend_line_above is better accomplished by #1596

On the one hand I could see myself using these commands (or a shrink_line version like #3046) but on the other it seems like a needless optimization on "hjkl in select-mode followed by X." With the addition of these commands we'd basically have the line-wise select-mode from vim.

Soft undo sounds like something, that'd help in this case.

A bit of a nitpick: something cannot be inconsistent without differing from a baseline behavior. What is the current behavior inconsistent with respect to? IMO it would be inconsistent to have special handling for newlines.

Well i see the inconsistency in e.g. that we have only one direction of doing something with newlines (namely: only extending), i see the incosistency as selections should IMO be bi-directional. But that's just my opinion.
I would be rather fine with just the soft-undo, i think this would already be a great addition.

@someone-aka-sum1
Copy link

This is not completed. Please reopen the issue.

@noahfraiture
Copy link

Hello it would be great to have this feature and it hasn't been completed at all. Is there plan ?

@chtenb
Copy link
Contributor

chtenb commented Aug 7, 2024

Not exactly what was asked here, but do these commands help you achieve what you want? #9080 (comment)

@someone-aka-sum1
Copy link

someone-aka-sum1 commented Aug 7, 2024

@chtenb I'm a newbie and am having a hard time grokking all that, but whatever the reason was for introducing extend_line_above and extend_line_below, the same should be valid for shrink_line_above and shrink_line_below. Either the functionality can't be achieved using existing commands, or it can be achieved only in a very convoluted manner.

Both actions must be independent of the position of the caret, and should keeping it at the correct edge of the selection. Also, shrinking can only deselect, while moving the caret can go past the be beginning/end of the selection, making an edge of a selection the beginning of an entirely different one.

@chtenb
Copy link
Contributor

chtenb commented Aug 7, 2024

extend_line_above et al are older than select_line_below/select_line_above. People, including myself, had trouble with how extend_line_above works and found that it did not accomodate a convenient editing flow for working with line range selections. This is why select_line_below/select_line_above were introduced in the PR I linked. I'm not saying that shrink_line_above are a bad idea, I'm just mentioning that there are other commands available that people use to work with line range selections, which seems to be a problem you are trying to solve.

I'm a newbie and am having a hard time grokking all that

If you're having trouble understanding how to use select_line_below/select_line_above, feel free to create a new discussion with a question and ping me. I'm happy to help out if you have any questions about these specific commands.

@someone-aka-sum1
Copy link

someone-aka-sum1 commented Aug 8, 2024

These have two different behaviors: select_line_above starts from the caret position, extend_line_above starts from the start of the selection. In other words, depending on the caret position (and whether more than one line is selected) select_line_above behaves either like extend_line_above or the missing shrink_line_below. I think it is convenient to be able to extend selection without having to move the caret. You may dislike these semantics of the existing commands, but please permit others to like them. Likewise for their shrink... counterparts. It is only logical to add them if extends are here to stay.

@noahfraiture
Copy link

I'm a bit late but even if it's not perfect, it's great, thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

5 participants