-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
action: add block/paragraph selection #2012
Conversation
Signed-off-by: Luís Ferreira <[email protected]>
Signed-off-by: Luís Ferreira <[email protected]>
@zyedidia Any attention to this? This is fairly trivial. |
Do we know anything if it's going to be merged anytime soon? |
Ping @zyedidia |
Any chance this can be merged? Would be a great feature to have. |
It's 2024 already, there are no merge conflicts, I'd also quite like this feature please. Why is this basic feature ignored? |
if line == 0 { | ||
h.Cursor.Loc = h.Buf.Start() | ||
} | ||
h.Cursor.SelectTo(h.Cursor.Loc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
h.Relocate()
is missing. As a result, when selecting paragraphs beyond the bottom/top of the screen, it doesn't scroll the screen automatically (unlike with ParagraphNext
and ParagraphPrevious
).
...In fact, looks like this can be implemented much shorter, by reusing ParagraphNext()
and ParagraphPrevious()
(and that would also automatically take care of scrolling):
// SelectParagraphPrevious select to the previous empty line, or beginning of the buffer if there's none
func (h *BufPane) SelectParagraphPrevious() bool {
if !h.Cursor.HasSelection() {
h.Cursor.OrigSelection[0] = h.Cursor.Loc
}
h.ParagraphPrevious()
h.Cursor.SelectTo(h.Cursor.Loc)
return true
}
// SelectParagraphNext select to the next empty line, or end of the buffer if there's none
func (h *BufPane) SelectParagraphNext() bool {
if !h.Cursor.HasSelection() {
h.Cursor.OrigSelection[0] = h.Cursor.Loc
}
h.ParagraphNext()
h.Cursor.SelectTo(h.Cursor.Loc)
return true
}
...Actually there is one more issue: if there are several empty lines one after another, it just selects those empty lines one by one, as if they were "paragraphs", instead of jumping to selecting the next actual paragraph. But the same issue actually exists with ParagraphNext
and ParagraphPrevious
as well, so it can be fixed separately.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this solution, while it does select the block, the cursor does not get moved with the selection, rather it is projected from the cursor while it stays in place. I would expect block select to drag the selection behind the cursor, essentially being ParagraphNext
+ selection. In the same way that ctrl+shift+left/right moves the cursor, and all other ctrl+shift combinations.
Yep. I even forgot about this one. |
Signed-off-by: Luís Ferreira [email protected]
Fixes #1968.