mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-22 01:16:18 +04:00
fix: text_pos_at_screen_coords tests
This commit is contained in:
parent
fd02d1bf89
commit
d62ad8b595
@ -260,7 +260,7 @@ pub fn text_pos_at_screen_coords(
|
||||
|
||||
// If pos is in the middle of a wider grapheme (tab for example)
|
||||
// return the starting offset.
|
||||
if col + width >= target {
|
||||
if col + width > target {
|
||||
break;
|
||||
}
|
||||
|
||||
@ -356,7 +356,7 @@ fn test_text_pos_at_screen_coords() {
|
||||
|
||||
assert_eq!(
|
||||
view.text_pos_at_screen_coords(&text, 41, 40 + OFFSET + 1, 4),
|
||||
Some(5)
|
||||
Some(4)
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
@ -384,9 +384,13 @@ fn test_text_pos_at_screen_coords_cjk() {
|
||||
Some(0)
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
view.text_pos_at_screen_coords(&text, 40, 40 + OFFSET + 4, 4),
|
||||
Some(4)
|
||||
);
|
||||
assert_eq!(
|
||||
view.text_pos_at_screen_coords(&text, 40, 40 + OFFSET + 5, 4),
|
||||
Some(5)
|
||||
Some(4)
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
@ -396,7 +400,7 @@ fn test_text_pos_at_screen_coords_cjk() {
|
||||
|
||||
assert_eq!(
|
||||
view.text_pos_at_screen_coords(&text, 40, 40 + OFFSET + 7, 4),
|
||||
Some(6)
|
||||
Some(5)
|
||||
);
|
||||
|
||||
assert_eq!(
|
||||
|
Loading…
Reference in New Issue
Block a user