File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -1701,7 +1701,9 @@ fn previous_word_end(
1701
1701
let mut point = point. to_point ( map) ;
1702
1702
1703
1703
if point. column < map. buffer_snapshot . line_len ( MultiBufferRow ( point. row ) ) {
1704
- point. column += 1 ;
1704
+ if let Some ( ch) = map. buffer_snapshot . chars_at ( point) . next ( ) {
1705
+ point. column += ch. len_utf8 ( ) as u32 ;
1706
+ }
1705
1707
}
1706
1708
for _ in 0 ..times {
1707
1709
let new_point = movement:: find_preceding_boundary_point (
@@ -1874,7 +1876,9 @@ fn previous_subword_end(
1874
1876
let mut point = point. to_point ( map) ;
1875
1877
1876
1878
if point. column < map. buffer_snapshot . line_len ( MultiBufferRow ( point. row ) ) {
1877
- point. column += 1 ;
1879
+ if let Some ( ch) = map. buffer_snapshot . chars_at ( point) . next ( ) {
1880
+ point. column += ch. len_utf8 ( ) as u32 ;
1881
+ }
1878
1882
}
1879
1883
for _ in 0 ..times {
1880
1884
let new_point = movement:: find_preceding_boundary_point (
@@ -3613,6 +3617,16 @@ mod test {
3613
3617
4;5.6 567 678
3614
3618
789 890 901
3615
3619
" } ) ;
3620
+
3621
+ // With multi byte char
3622
+ cx. set_shared_state ( indoc ! { r"
3623
+ bar ˇó
3624
+ " } )
3625
+ . await ;
3626
+ cx. simulate_shared_keystrokes ( "g e" ) . await ;
3627
+ cx. shared_state ( ) . await . assert_eq ( indoc ! { "
3628
+ baˇr ó
3629
+ " } ) ;
3616
3630
}
3617
3631
3618
3632
#[ gpui:: test]
Original file line number Diff line number Diff line change 27
27
{"Key" :" g" }
28
28
{"Key" :" shift-e" }
29
29
{"Get" :{"state" :" 123 234 34ˇ5\n 4;5.6 567 678\n 789 890 901\n " ,"mode" :" Normal" }}
30
+ {"Put" :{"state" :" bar ˇó\n " }}
31
+ {"Key" :" g" }
32
+ {"Key" :" e" }
33
+ {"Get" :{"state" :" baˇr ó\n " ,"mode" :" Normal" }}
You can’t perform that action at this time.
0 commit comments