Skip to content

Commit

Permalink
Fix off-by-one (selecting last probably should have upstream affinity)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcur committed Nov 28, 2024
1 parent 53e02d3 commit b0b63e9
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion masonry/src/text/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ where
fn cursor_at(&self, index: usize) -> Cursor {
// TODO: Do we need to be non-dirty?
// FIXME: `Selection` should make this easier
if index > self.buffer.len() {
if index >= self.buffer.len() {
Cursor::from_byte_index(&self.layout, self.buffer.len(), Affinity::Upstream)
} else {
Cursor::from_byte_index(&self.layout, index, Affinity::Downstream)
Expand Down

0 comments on commit b0b63e9

Please sign in to comment.