aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/ra_editor/src/extend_selection.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/crates/ra_editor/src/extend_selection.rs b/crates/ra_editor/src/extend_selection.rs
index b4227716d..a2aa02149 100644
--- a/crates/ra_editor/src/extend_selection.rs
+++ b/crates/ra_editor/src/extend_selection.rs
@@ -48,8 +48,8 @@ fn extend_single_word_in_comment(leaf: SyntaxNodeRef, offset: TextUnit) -> Optio
48 let cursor_position: u32 = (offset - leaf.range().start()).into(); 48 let cursor_position: u32 = (offset - leaf.range().start()).into();
49 49
50 let (before, after) = text.split_at(cursor_position as usize); 50 let (before, after) = text.split_at(cursor_position as usize);
51 let start_idx = before.rfind(char::is_whitespace)? as u32; 51 let start_idx = before.rfind(char::is_whitespace).unwrap_or(0) as u32;
52 let end_idx = after.find(char::is_whitespace)? as u32; 52 let end_idx = after.find(char::is_whitespace).unwrap_or(after.len()) as u32;
53 53
54 let from: TextUnit = (start_idx + 1).into(); 54 let from: TextUnit = (start_idx + 1).into();
55 let to: TextUnit = (cursor_position + end_idx).into(); 55 let to: TextUnit = (cursor_position + end_idx).into();
@@ -184,7 +184,7 @@ fn bar(){}
184 184
185// fn foo(){} 185// fn foo(){}
186 "#, 186 "#,
187 &["// 1 + 1", "// fn foo() {\n// 1 + 1\n// }"], 187 &["1", "// 1 + 1", "// fn foo() {\n// 1 + 1\n// }"],
188 ); 188 );
189 189
190 do_check( 190 do_check(