Skip to content

fix: error that caused usize to overflow - #3024

Merged
archseer merged 2 commits into
helix-editor:masterfrom
GreasySlug:master
Jul 10, 2022
Merged

fix: error that caused usize to overflow#3024
archseer merged 2 commits into
helix-editor:masterfrom
GreasySlug:master

Conversation

@GreasySlug

Copy link
Copy Markdown
Contributor

fix this bug #2981

Comment thread helix-term/src/commands.rs Outdated
@GreasySlug

GreasySlug commented Jul 10, 2022

Copy link
Copy Markdown
Contributor Author

Thank you for reviewing😊

@archseer
archseer merged commit e109022 into helix-editor:master Jul 10, 2022
@@ -1414,7 +1414,7 @@ fn copy_selection_on_line(cx: &mut Context, direction: Direction) {
let (head, anchor) = if range.anchor < range.head {
(range.head - 1, range.anchor)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need this here too?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think it's possible for range.head to be 0 in this branch because of the if condition: range.anchor < range.head implies range.head is >= 1 unless it's a zero-width selection which should not be possible

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.

4 participants