mirror of
https://github.com/ilyakooo0/helix.git
synced 2024-09-11 16:07:00 +03:00
Improve Readability (#2639)
This commit is contained in:
parent
fc666db6b9
commit
ae12c58f0f
@ -9,4 +9,4 @@ # Migrating from Vim
|
||||
|
||||
See also Kakoune's [Migrating from Vim](https://github.com/mawww/kakoune/wiki/Migrating-from-Vim).
|
||||
|
||||
> TODO: Mention texobjects, surround, registers
|
||||
> TODO: Mention textobjects, surround, registers
|
||||
|
@ -14,7 +14,7 @@ pub fn grapheme_width(g: &str) -> usize {
|
||||
// Point 1: theoretically, ascii control characters should have zero
|
||||
// width, but in our case we actually want them to have width: if they
|
||||
// show up in text, we want to treat them as textual elements that can
|
||||
// be editied. So we can get away with making all ascii single width
|
||||
// be edited. So we can get away with making all ascii single width
|
||||
// here.
|
||||
// Point 2: we're only examining the first codepoint here, which means
|
||||
// we're ignoring graphemes formed with combining characters. However,
|
||||
|
@ -177,7 +177,7 @@ fn lowest_common_ancestor(&self, mut a: usize, mut b: usize) -> usize {
|
||||
}
|
||||
}
|
||||
|
||||
/// List of nodes on the way from `n` to 'a`. Doesn`t include `a`.
|
||||
/// List of nodes on the way from `n` to 'a`. Doesn't include `a`.
|
||||
/// Includes `n` unless `a == n`. `a` must be an ancestor of `n`.
|
||||
fn path_up(&self, mut n: usize, a: usize) -> Vec<usize> {
|
||||
let mut path = Vec::new();
|
||||
@ -546,8 +546,8 @@ fn test_parse_undo_kind() {
|
||||
|
||||
// Units are validated.
|
||||
assert_eq!(
|
||||
"1 millenium".parse::<UndoKind>(),
|
||||
Err("incorrect time unit: millenium".to_string())
|
||||
"1 millennium".parse::<UndoKind>(),
|
||||
Err("incorrect time unit: millennium".to_string())
|
||||
);
|
||||
|
||||
// Units can't be specified twice.
|
||||
|
@ -377,7 +377,7 @@ fn test_increment_basic_decimal_numbers() {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_increment_basic_hexadedimal_numbers() {
|
||||
fn test_increment_basic_hexadecimal_numbers() {
|
||||
let tests = [
|
||||
("0x0100", 1, "0x0101"),
|
||||
("0x0100", -1, "0x00ff"),
|
||||
|
@ -43,7 +43,7 @@ pub fn find_first_non_whitespace_char(line: RopeSlice) -> Option<usize> {
|
||||
///
|
||||
/// Order of detection:
|
||||
/// * Top-most folder containing a root marker in current git repository
|
||||
/// * Git repostory root if no marker detected
|
||||
/// * Git repository root if no marker detected
|
||||
/// * Top-most folder containing a root marker if not git repository detected
|
||||
/// * Current working directory as fallback
|
||||
pub fn find_root(root: Option<&str>, root_markers: &[String]) -> Option<std::path::PathBuf> {
|
||||
|
@ -830,7 +830,7 @@ fn overlaps(a: (usize, usize), b: (usize, usize)) -> bool {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_graphem_aligned() {
|
||||
fn test_grapheme_aligned() {
|
||||
let r = Rope::from_str("\r\nHi\r\n");
|
||||
let s = r.slice(..);
|
||||
|
||||
|
@ -66,7 +66,7 @@ pub fn find_nth_closest_pairs_pos(
|
||||
for ch in text.chars_at(pos) {
|
||||
if is_open_pair(ch) {
|
||||
// Track open pairs encountered so that we can step over
|
||||
// the correspoding close pairs that will come up further
|
||||
// the corresponding close pairs that will come up further
|
||||
// down the loop. We want to find a lone close pair whose
|
||||
// open pair is before the cursor position.
|
||||
stack.push(ch);
|
||||
|
@ -1964,7 +1964,7 @@ fn shrink_to_line_bounds(cx: &mut Context) {
|
||||
// line_to_char gives us the start position of the line, so
|
||||
// we need to get the start position of the next line. In
|
||||
// the editor, this will correspond to the cursor being on
|
||||
// the EOL whitespace charactor, which is what we want.
|
||||
// the EOL whitespace character, which is what we want.
|
||||
let mut end = text.line_to_char((end_line + 1).min(text.len_lines()));
|
||||
|
||||
if start != range.from() {
|
||||
@ -2929,7 +2929,7 @@ pub fn delete_char_backward(cx: &mut Context) {
|
||||
Transaction::change_by_selection(doc.text(), doc.selection(view.id), |range| {
|
||||
let pos = range.cursor(text);
|
||||
let line_start_pos = text.line_to_char(range.cursor_line(text));
|
||||
// considier to delete by indent level if all characters before `pos` are indent units.
|
||||
// consider to delete by indent level if all characters before `pos` are indent units.
|
||||
let fragment = Cow::from(text.slice(line_start_pos..pos));
|
||||
if !fragment.is_empty() && fragment.chars().all(|ch| ch.is_whitespace()) {
|
||||
if text.get_char(pos.saturating_sub(1)) == Some('\t') {
|
||||
|
@ -416,8 +416,8 @@ pub fn apply_workspace_edit(
|
||||
}
|
||||
lsp::DocumentChanges::Operations(operations) => {
|
||||
log::debug!("document changes - operations: {:?}", operations);
|
||||
for operateion in operations {
|
||||
match operateion {
|
||||
for operation in operations {
|
||||
match operation {
|
||||
lsp::DocumentChangeOperation::Op(op) => {
|
||||
apply_document_resource_op(op).unwrap();
|
||||
}
|
||||
|
@ -542,7 +542,7 @@ fn reverse_map() {
|
||||
vec![vec![key!('j')], vec![key!('k')]]
|
||||
),
|
||||
]),
|
||||
"Mistmatch"
|
||||
"Mismatch"
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -86,7 +86,7 @@ pub fn breakpoints_changed(
|
||||
path: PathBuf,
|
||||
breakpoints: &mut [Breakpoint],
|
||||
) -> Result<(), anyhow::Error> {
|
||||
// TODO: handle capabilities correctly again, by filterin breakpoints when emitting
|
||||
// TODO: handle capabilities correctly again, by filtering breakpoints when emitting
|
||||
// if breakpoint.condition.is_some()
|
||||
// && !debugger
|
||||
// .caps
|
||||
|
Loading…
Reference in New Issue
Block a user