Skip to content

Conversation

@ljmf00
Copy link

@ljmf00 ljmf00 commented Feb 7, 2021

Signed-off-by: Luís Ferreira [email protected]


Fixes #1968.

@ljmf00
Copy link
Author

ljmf00 commented May 11, 2021

@zyedidia Any attention to this? This is fairly trivial.

@heloint
Copy link

heloint commented Aug 24, 2022

Do we know anything if it's going to be merged anytime soon?

@ljmf00
Copy link
Author

ljmf00 commented Aug 24, 2022

Ping @zyedidia

@m1k3s0
Copy link

m1k3s0 commented Dec 30, 2023

Any chance this can be merged? Would be a great feature to have.

@LainLayer
Copy link

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)
Copy link
Collaborator

@dmaluka dmaluka Mar 26, 2024

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.

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.

@Neko-Box-Coder
Copy link
Contributor

@dmaluka @ljmf00
This seems to overlap with #3353
Should this be closed?

@dmaluka
Copy link
Collaborator

dmaluka commented Aug 12, 2024

Yep. I even forgot about this one.

@dmaluka dmaluka closed this Aug 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[New Feature] Add missing these 2 actions for these 2 shorcuts : Shift+Ctrl+Down to SelectParagraphNext and Shift+Ctrl+Up to SelectParagraphPrevious

6 participants