helix-mods/helix-core/src/lib.rs

59 lines
1.3 KiB
Rust
Raw Normal View History

2020-06-02 03:57:01 +02:00
#![allow(unused)]
pub mod comment;
mod diagnostic;
pub mod graphemes;
mod history;
2020-10-14 05:01:41 +02:00
pub mod indent;
pub mod macros;
2020-09-17 07:57:49 +02:00
mod position;
2020-10-06 09:00:23 +02:00
pub mod register;
pub mod selection;
2020-06-24 20:59:35 +02:00
pub mod state;
2020-09-12 12:36:49 +02:00
pub mod syntax;
mod transaction;
2020-05-20 11:14:51 +02:00
pub(crate) fn find_first_non_whitespace_char2(line: RopeSlice) -> Option<usize> {
// find first non-whitespace char
2021-02-18 10:45:41 +01:00
for (start, ch) in line.chars().enumerate() {
// TODO: could use memchr with chunks?
if ch != ' ' && ch != '\t' && ch != '\n' {
return Some(start);
}
}
None
}
pub(crate) fn find_first_non_whitespace_char(text: RopeSlice, line_num: usize) -> Option<usize> {
let line = text.line(line_num);
let mut start = text.line_to_char(line_num);
// find first non-whitespace char
for ch in line.chars() {
// TODO: could use memchr with chunks?
if ch != ' ' && ch != '\t' && ch != '\n' {
return Some(start);
}
start += 1;
}
None
}
pub use ropey::{Rope, RopeSlice};
2020-09-28 18:00:35 +02:00
2020-05-28 07:45:44 +02:00
pub use tendril::StrTendril as Tendril;
#[doc(inline)]
pub use {regex, tree_sitter};
2020-09-17 07:57:49 +02:00
pub use position::Position;
pub use selection::Range;
pub use selection::Selection;
2020-09-17 07:57:49 +02:00
pub use syntax::Syntax;
pub use diagnostic::Diagnostic;
pub use history::History;
pub use state::State;
pub use transaction::{Assoc, Change, ChangeSet, Operation, Transaction};