2020-06-02 03:57:01 +02:00
|
|
|
#![allow(unused)]
|
2021-03-22 04:18:48 +01:00
|
|
|
pub mod auto_pairs;
|
2021-02-18 10:35:39 +01:00
|
|
|
pub mod comment;
|
2021-03-11 08:31:49 +01:00
|
|
|
pub mod diagnostic;
|
2020-09-10 06:55:18 +02:00
|
|
|
pub mod graphemes;
|
2020-10-04 10:15:43 +02:00
|
|
|
mod history;
|
2020-10-14 05:01:41 +02:00
|
|
|
pub mod indent;
|
2020-09-21 11:24:16 +02:00
|
|
|
pub mod macros;
|
2021-03-22 09:58:49 +01:00
|
|
|
pub mod match_brackets;
|
2021-03-18 05:39:34 +01:00
|
|
|
pub mod movement;
|
2021-02-22 07:50:41 +01:00
|
|
|
pub mod object;
|
2020-09-17 07:57:49 +02:00
|
|
|
mod position;
|
2020-10-06 09:00:23 +02:00
|
|
|
pub mod register;
|
2021-03-11 02:44:38 +01:00
|
|
|
pub mod search;
|
2020-09-28 18:01:27 +02:00
|
|
|
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;
|
2020-05-25 06:02:21 +02:00
|
|
|
mod transaction;
|
2020-05-20 11:14:51 +02:00
|
|
|
|
2021-02-18 10:34:22 +01: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() {
|
2021-02-18 10:34:22 +01:00
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
2021-04-07 16:56:20 +02:00
|
|
|
pub fn config_dir() -> std::path::PathBuf {
|
|
|
|
// TODO: allow env var override
|
|
|
|
let xdg_dirs =
|
|
|
|
xdg::BaseDirectories::with_prefix("helix").expect("Unable to find XDG directories!");
|
|
|
|
xdg_dirs.get_config_home()
|
|
|
|
}
|
|
|
|
|
2020-06-05 07:02:10 +02:00
|
|
|
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;
|
|
|
|
|
2020-09-28 18:01:27 +02:00
|
|
|
#[doc(inline)]
|
|
|
|
pub use {regex, tree_sitter};
|
|
|
|
|
2021-03-18 05:39:34 +01:00
|
|
|
pub use position::{coords_at_pos, pos_at_coords, Position};
|
2021-03-22 04:40:07 +01:00
|
|
|
pub use selection::{Range, Selection};
|
2021-04-01 04:01:11 +02:00
|
|
|
pub use smallvec::SmallVec;
|
2020-09-17 07:57:49 +02:00
|
|
|
pub use syntax::Syntax;
|
2020-05-25 06:02:21 +02:00
|
|
|
|
2020-10-20 06:58:34 +02:00
|
|
|
pub use diagnostic::Diagnostic;
|
2020-10-04 10:15:43 +02:00
|
|
|
pub use history::History;
|
2020-05-25 06:02:21 +02:00
|
|
|
pub use state::State;
|
|
|
|
|
2020-10-23 11:48:03 +02:00
|
|
|
pub use transaction::{Assoc, Change, ChangeSet, Operation, Transaction};
|