summaryrefslogtreecommitdiff
path: root/helix-core/src
diff options
context:
space:
mode:
Diffstat (limited to 'helix-core/src')
-rw-r--r--helix-core/src/lib.rs12
1 files changed, 2 insertions, 10 deletions
diff --git a/helix-core/src/lib.rs b/helix-core/src/lib.rs
index cfe466ed..da48ba7e 100644
--- a/helix-core/src/lib.rs
+++ b/helix-core/src/lib.rs
@@ -18,16 +18,8 @@ pub mod syntax;
mod transaction;
pub mod words;
-pub(crate) fn find_first_non_whitespace_char2(line: RopeSlice) -> Option<usize> {
- // find first non-whitespace char
- for (start, ch) in line.chars().enumerate() {
- // TODO: could use memchr with chunks?
- if ch != ' ' && ch != '\t' && ch != '\n' {
- return Some(start);
- }
- }
-
- None
+pub fn find_first_non_whitespace_char2(line: RopeSlice) -> Option<usize> {
+ line.chars().position(|ch| !ch.is_whitespace())
}
pub(crate) fn find_first_non_whitespace_char(text: RopeSlice, line_num: usize) -> Option<usize> {
let line = text.line(line_num);