Pull casts out of TextUnit

This commit is contained in:
Jeremy A. Kolb 2018-10-04 09:39:02 -04:00
parent 334d266b77
commit a30039ba62

View file

@ -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))
}