Commit Graph

366 Commits (bf5b9a9f354135933d7970863cf81e5a36585d03)

Author SHA1 Message Date
Blaž Hrastnik f118e7580f Improve coords_at_pos & pos_at_coords, test with graphemes. 4 years ago
Blaž Hrastnik 87a6d4e736 minor: Simplify some code. 4 years ago
Blaž Hrastnik 6cfb1acb9d commands: Implement expand_selection. 4 years ago
Blaž Hrastnik 33c67f1388 commands: add * as selection search. 4 years ago
Blaž Hrastnik 9132c6a591 Make some Document fields read-only. 4 years ago
Blaž Hrastnik 8c82f8f140 indent: use_list indentation, fix indentation bug on open_below
use std::{
  time::Duration // <- pressing `o` here would use }'s indent instead of prev line
}
4 years ago
Blaž Hrastnik 7a1ff5e45f commands: Wire up toggle comments as ctrl-c 4 years ago
Blaž Hrastnik 4ab5631d65 more lints 4 years ago
Blaž Hrastnik d0791e0f98 core: Implement comment toggling module. 4 years ago
Blaž Hrastnik c9dd1c930e treewide: &RopeSlice -> RopeSlice. It's Copy so no reason to pass by ref 4 years ago
Blaž Hrastnik af55ebd002 transaction: Also modify map_pos to work with insert|delete order. 4 years ago
Blaž Hrastnik 9cac44c7c0 minor changes 4 years ago
Blaž Hrastnik d8bc19f715 Update deps, switch tendril over to crates.io 4 years ago
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
        }
    }

}
4 years ago
Blaž Hrastnik b0b5451c38 Since insert preceedes deletes, follow that ordering in Transaction::changes.
Produces the same output but will take the happy path.
4 years ago
Blaž Hrastnik b4312c9492 transaction: Use builder methods to generate compact changesets. 4 years ago
Blaž Hrastnik 19fb4ed835 transaction: Merge consecutive inserts on compose. 4 years ago
Blaž Hrastnik 65893a2cbc fix test 4 years ago
Blaž Hrastnik 239db79834 Finally: Retain horizontal position when moving vertically. 4 years ago
Blaž Hrastnik a924ad2885 simplify. 4 years ago
Blaž Hrastnik 2bea5db7bd commands: Implement select_on_matches. 4 years ago
Blaž Hrastnik 7c99ff58fd nix: include rust-src so rust-analyzer works correctly. 4 years ago
Blaž Hrastnik 22e1692adc indent: Fix edge cases, refactor test. 4 years ago
Blaž Hrastnik 777a80917d Address clippy lints. 4 years ago
Blaž Hrastnik 7d41550a23 indent: refactor logic to be more correct.
Thanks to atom-sane-indentation, nvim-treesitter and tree-sitter-indent.el
for inspiration.
4 years ago
Blaž Hrastnik a7869c728c wip 4 years ago
Blaž Hrastnik cc6bdf8f66 Text change generation, RPC call handling. 4 years ago
Blaž Hrastnik f5981f72c2 Introduce Selection::point. 4 years ago
Blaž Hrastnik efc5aa2016 Simplify old_state handling. 4 years ago
Blaž Hrastnik c0e17dd324 Fix undo/redo not updating the syntax tree. 4 years ago
Blaž Hrastnik b39849dde1 Refactor: Document type as a wrapper around barebones State. 4 years ago
Blaž Hrastnik ef5e5f9296 state.version tracking 4 years ago
Blaž Hrastnik 49254d7180 Total mess but it works: diagnostic marking. 4 years ago
Blaž Hrastnik f9bfba4d96 Reroute LSP notification events into the main app event loop. 4 years ago
Blaž Hrastnik 64b5b23315 Move theme from view to editor, support multiple views in editor. 4 years ago
Blaž Hrastnik bc2c652fe8 Bugfix 4 years ago
Jan Hrastnik 7d58378374 added move left&right, delete char 4 years ago
Jan Hrastnik ed03ec92a8 moved prompt command matching to prompt.rs 4 years ago
Jan Hrastnik 0c0c2c7103 modified editor.render() to prepare for command mode rendering 4 years ago
Blaž Hrastnik 16828d322a wip 4 years ago
Blaž Hrastnik 6e658aae1c Auto-indent on enter based on tree-sitter scopes. 4 years ago
Blaž Hrastnik d64f4beede Share tab width definitions. 4 years ago
Blaž Hrastnik 0b74d423d0 Validate compose len after applying a is same as before applying b. 4 years ago
Blaž Hrastnik 7fcc6f8f1b Fix overlapping (insert | delete) compose 4 years ago
Blaž Hrastnik 94f9603c74 Fix compose not merging certain changesets correctly. 4 years ago
Blaž Hrastnik 00e661f600 Indent draft, linewise paste 4 years ago
Blaž Hrastnik 4a648555ed Don't try to compose zero-width deletes. 4 years ago
Blaž Hrastnik 490e23b645 Simplify changeset tracking. 4 years ago
Blaž Hrastnik 8098279676 Cleanup 4 years ago
Blaž Hrastnik 1dba0f2b1c Simple yank/paste registers. 4 years ago
Blaž Hrastnik eba5b1ef33 Fix changeset composition, lengths don't have to match. 4 years ago
Blaž Hrastnik b765c17896 Hacky undo/redo integration. 4 years ago
Blaž Hrastnik 04b1546634 history.redo() 4 years ago
Blaž Hrastnik 8c7bc71ede Split on matches off by one, breaks tests again. 4 years ago
Blaž Hrastnik fd311fb8ad Undo tree draft.
We keep a tree of transactions. This allows for persistent undo by
simply serializing the changesets.
4 years ago
Blaž Hrastnik 5392b48268 Drop Coords. 4 years ago
Jan Hrastnik 038201647c started work on goto mode 4 years ago
Blaž Hrastnik 883b77bd24 Fix transaction.invert()/.apply() using byte counts instead of char counts. 4 years ago
Blaž Hrastnik aa077a07f3 Implement Transaction::invert. 4 years ago
Blaž Hrastnik 5945815d97 Fix cursor rendering & placement on append mode. 4 years ago
Blaž Hrastnik e39bd211d1 argh -> clap to speed up compilation (no syn/proc_macro) 4 years ago
Blaž Hrastnik 592c5b0af2 Fix test, break split + append 4 years ago
Blaž Hrastnik 3feb00283d clippy warnings 4 years ago
Blaž Hrastnik 1bb01d27ae Simplify line ending calculation. 4 years ago
Blaž Hrastnik 13d1ea542e Clamp character movement to line. 4 years ago
Blaž Hrastnik 36e7e2133f Split selection on regex, fix InputEdit generation. 4 years ago
Blaž Hrastnik 3020077da8 Extend selection commands. 4 years ago
Blaž Hrastnik e0785aabe7 Move-by-word commands: w, b, e. 4 years ago
Blaž Hrastnik eb639eb2e4 More robust syntax detection/grammar loading. 4 years ago
Blaž Hrastnik 935cfeae57 Split parts of helix-term into helix-view.
It still largely depends on term for some types but I plan to change
that later.
4 years ago
Blaž Hrastnik 48330ddb5f Command needs access to view information for certain changes. 4 years ago
Blaž Hrastnik b120515613 Range based highlight_iter. Only works on limiting the start right now 4 years ago
Blaž Hrastnik 3859f6963d More work on the UI. 4 years ago
Blaž Hrastnik 088f8a82af Incremental parsing: rough draft. 4 years ago
Blaž Hrastnik 31999d6528 Make state fields read-only from outside the crate. 4 years ago
Blaž Hrastnik 96db02742e Simplify some more code. 4 years ago
Blaž Hrastnik 0427acd18c Avoid collect() by accepting iterators into Transaction::change. 4 years ago
Blaž Hrastnik 2027f69eae Deduplicate some code. 4 years ago
Blaž Hrastnik b827b41efe Address clippy lint. 4 years ago
Blaž Hrastnik b08278807e Add 'A', 'I' commands. 4 years ago
Blaž Hrastnik fb0f56b747 Add 'o' command. 4 years ago
Blaž Hrastnik 22cb7b3338 Change -> Operation, Change2 -> Change 4 years ago
Blaž Hrastnik d86f0feafc Abstract Transaction::change from change_by_selection. 4 years ago
Blaž Hrastnik 593f33dca6 Fix clippy warnings. 4 years ago
Blaž Hrastnik d466882d04 Abstract Transaction::change_by_selection, working del/backspace. 4 years ago
Blaž Hrastnik f098166571 Get rid of a bunch of clones. 4 years ago
Blaž Hrastnik 9546164dc8 cargo fmt & clippy lint 4 years ago
Blaž Hrastnik a106be94f1 Refactor a little bit. 4 years ago
Blaž Hrastnik b17a77b8b8 cleanup: Import tree-sitter-highlight so we can cache trees. 4 years ago
Blaž Hrastnik b647c7a773 tree-sitter based syntax highlighting draft 4 years ago
Blaž Hrastnik 25b3f98e3d draft: tree-sitter highlighting 4 years ago
Blaž Hrastnik 563e094916 Fix double must_use. 4 years ago
Blaž Hrastnik 67017e5336 append mode 4 years ago
Blaž Hrastnik dd749bb284 Expand transaction API. 4 years ago
Blaž Hrastnik 8b3e152126 cleanup: Make Buffer just a part of State. 4 years ago
Blaž Hrastnik 579b6899f1 Work on insert mode. 4 years ago
Blaž Hrastnik e806446379 Fix position coordinate calculation. 4 years ago
Jan Hrastnik 6ba082697d added cursor rendering 4 years ago
Jan Hrastnik e93b15cef3 created view struct 4 years ago
Jan Hrastnik 8958f06f08 added file rendering 4 years ago
Blaž Hrastnik 073fe61264 Use ropey 1.2.0 4 years ago
Blaž Hrastnik f8fe273a2e Fix build. 5 years ago
Blaž Hrastnik e98cdebf1e Add a command module. 5 years ago
Blaž Hrastnik 195aad4675 Fix coord mapping, add vertical move. 5 years ago
Blaž Hrastnik 10d53f3ef0 Add primitives for converting between char offset indices and coords. 5 years ago
Blaž Hrastnik 387fb57c94 Allow unused code for the time being. 5 years ago
Blaž Hrastnik 3848058472 clippy lint 5 years ago
Blaž Hrastnik d232000c54 Fix compilation. 5 years ago
Blaž Hrastnik 613d06dfb0 wip: importing to github 5 years ago
Blaž Hrastnik 6905ff03c2 Start swapping from termwiz to crossterm + async. 5 years ago
Blaž Hrastnik 1984410ac9 Selection mapping over changesets. 5 years ago
Blaž Hrastnik e52e848fd7 changeset: Introduce map_pos. 5 years ago
Blaž Hrastnik b5c38812e9 address clippy warnings 5 years ago
Blaž Hrastnik 23109f1512 OT: changeset: Implement compose and apply. 5 years ago
Blaž Hrastnik 44ff4d3c1f Implement a new core based on CodeMirror. 5 years ago
Blaž Hrastnik 240e5f4e3d Initial import. 5 years ago