Skip to content

Commit e01f6b7

Browse files
committed
chore: skip the selection indicator for wrapped lines
1 parent ee07e89 commit e01f6b7

5 files changed

+14
-18
lines changed

src/screen/mod.rs

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -354,11 +354,9 @@ impl Widget for &Screen {
354354
if self.line_index[self.cursor] == line.item_index {
355355
buf.set_style(indented_line_area, &style.selection_line);
356356
} else {
357-
for i in 0..height {
358-
buf[(SCREEN_GUTTER_COLUMN_CURSOR, line_index + i)]
359-
.set_char(style.selection_bar.symbol)
360-
.set_style(&style.selection_bar);
361-
}
357+
buf[(SCREEN_GUTTER_COLUMN_CURSOR, line_index)]
358+
.set_char(style.selection_bar.symbol)
359+
.set_style(&style.selection_bar);
362360
}
363361
}
364362

@@ -380,11 +378,9 @@ impl Widget for &Screen {
380378
}
381379

382380
if self.line_index[self.cursor] == line.item_index {
383-
for i in 0..height {
384-
buf[(SCREEN_GUTTER_COLUMN_CURSOR, line_index + i as u16)]
385-
.set_char(style.cursor.symbol)
386-
.set_style(&style.cursor);
387-
}
381+
buf[(SCREEN_GUTTER_COLUMN_CURSOR, line_index)]
382+
.set_char(style.cursor.symbol)
383+
.set_style(&style.cursor);
388384
}
389385

390386
line_index += height;

src/tests/snapshots/gitu__tests__wrap__recent_commits.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ expression: ctx.redact_buffer()
66
|
77
Recent commits |
88
ebac8f4 main This is a long line that is longer than 80 columns, to ensure |
9-
that it definitely wraps on to the line below it |
9+
that it definitely wraps on to the line below it |
1010
|
1111
|
1212
|
@@ -22,4 +22,4 @@ expression: ctx.redact_buffer()
2222
|
2323
|
2424
|
25-
styles_hash: 556aa06940e8aa8
25+
styles_hash: 76a85750ae78d878

src/tests/snapshots/gitu__tests__wrap__show.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ expression: ctx.redact_buffer()
1313
added firstfile |
1414
@@ -0,0 +1 @@ |
1515
+This is a long line that is longer than 80 columns, to ensure that it |
16-
definitely wraps on to the line below it |
16+
definitely wraps on to the line below it |
1717
|
1818
|
1919
|
@@ -22,4 +22,4 @@ expression: ctx.redact_buffer()
2222
|
2323
|
2424
|
25-
styles_hash: 9ec7ed8a8eda4208
25+
styles_hash: eb4b8705c9e937b9

src/tests/snapshots/gitu__tests__wrap__staged_changes.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ expression: ctx.redact_buffer()
88
added testfile |
99
▌ @@ -0,0 +1 @@ |
1010
+This is a long line that is longer than 80 columns, to ensure that it |
11-
definitely wraps on to the line below it |
11+
definitely wraps on to the line below it |
1212
|
1313
Recent commits |
1414
|
@@ -22,4 +22,4 @@ expression: ctx.redact_buffer()
2222
|
2323
|
2424
|
25-
styles_hash: 2fce71be5221797c
25+
styles_hash: 5336fe13ab979e46

src/tests/snapshots/gitu__tests__wrap__unstaged_changes.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ expression: ctx.redact_buffer()
1010
-testing |
1111
-testtest |
1212
+This is a long line that is longer than 80 columns, to ensure that it |
13-
definitely wraps on to the line below it |
13+
definitely wraps on to the line below it |
1414
|
1515
Recent commits |
1616
f431046 main add testfile |
@@ -22,4 +22,4 @@ expression: ctx.redact_buffer()
2222
|
2323
|
2424
|
25-
styles_hash: 5ec29d64b309dd10
25+
styles_hash: 6816abe8c2f3c32f

0 commit comments

Comments
 (0)