My mods of a post-modern modal text editor.
Find a file
Blaž Hrastnik 9821c4dd3b Optimize Changeset::is_empty()
Checked the ASM output for these three options:

pub enum Operation {
    /// Move cursor by n characters.
    Retain(usize),
    /// Delete n characters.
    Delete(usize),
    /// Insert text at position.
    Insert(String),
}

pub struct A {
    changes: Vec<Operation>,
    len: usize,
}

impl A {
    pub fn is_empty1(&self) -> bool {
        match self.changes.as_slice() {
            [] => true,
            [Operation::Retain(_)] => true,
            _ => false,
        }
    }

    /// `true` when the set is empty.
    pub fn is_empty2(&self) -> bool {
        let len = self.changes.len();
        len == 0
        || (
            len == 1
            && self.changes[0] == Operation::Retain(self.len)
        )

    }

    pub fn is_empty3(&self) -> bool {
        match self.changes.as_slice() {
            [] | [Operation::Retain(_)] => true,
            _ => false
        }
    }

}
2021-02-16 13:39:04 +09:00
.github/workflows Checkout submodules on clone. 2020-09-12 19:35:26 +09:00
doc deps update 2021-02-09 15:40:06 +09:00
helix-core Optimize Changeset::is_empty() 2021-02-16 13:39:04 +09:00
helix-lsp Adjust LSP changeset generation too: insert now always preceedes delete. 2021-02-16 11:08:06 +09:00
helix-syntax syntax: Stop compiling haskell, seems unmaintained and slowest to compile 2021-01-19 16:57:19 +09:00
helix-term search: Barebones implementation. 2021-02-12 18:10:05 +09:00
helix-view Parse input counts: 10w, etc. 2021-02-09 16:39:17 +09:00
.envrc Add a nix flake with the development environment. 2021-01-19 15:54:51 +09:00
.gitignore Add a nix flake with the development environment. 2021-01-19 15:54:51 +09:00
.gitmodules More robust syntax detection/grammar loading. 2020-09-22 18:27:37 +09:00
Cargo.lock deps update 2021-02-09 15:40:06 +09:00
Cargo.toml wip 2020-12-03 13:04:42 +09:00
flake.lock flake: Update deps. 2021-02-12 18:09:45 +09:00
flake.nix deps update 2021-02-09 15:40:06 +09:00
README.md deps update 2021-02-09 15:40:06 +09:00
shell.nix Update flake definition. 2021-02-04 17:25:54 +09:00
TODO.md Finally: Retain horizontal position when moving vertically. 2021-02-12 16:49:24 +09:00

Helix

Crate Description
helix-core Core editing primitives, functional.
helix-syntax Tree-sitter grammars
helix-view UI abstractions for use in backends, imperative shell.
helix-term Terminal UI

Installation

git clone --depth 1 --recurse-submodules -j8 https://github.com/helix-editor/helix
cd helix
cargo install --path helix-term

This will install the hx binary to $HOME/.cargo/bin.