Pull casts out of TextUnit
This commit is contained in:
parent
334d266b77
commit
a30039ba62
1 changed files with 4 additions and 4 deletions
|
@ -47,11 +47,11 @@ fn extend_single_word_in_comment(leaf: SyntaxNodeRef, offset: TextUnit) -> Optio
|
|||
let cursor_position: u32 = (offset - leaf.range().start()).into();
|
||||
|
||||
let (before, after) = text.split_at(cursor_position as usize);
|
||||
let start_idx = before.rfind(char::is_whitespace)?;
|
||||
let end_idx = after.find(char::is_whitespace)?;
|
||||
let start_idx = before.rfind(char::is_whitespace)? as u32;
|
||||
let end_idx = after.find(char::is_whitespace)? as u32;
|
||||
|
||||
let from : TextUnit = (start_idx as u32 + 1).into();
|
||||
let to : TextUnit = (cursor_position + (end_idx as u32)).into();
|
||||
let from : TextUnit = (start_idx + 1).into();
|
||||
let to : TextUnit = (cursor_position + end_idx).into();
|
||||
|
||||
Some(TextRange::from_to(from, to))
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue