aboutsummaryrefslogtreecommitdiff
path: root/helix-core/src/history.rs
Commit message (Collapse)AuthorAge
* Prefer RopeSlice to &Rope in helix_core::syntaxMichael Davis2023-07-27
| | | | | | | | | | | | | | | Pascal and I discussed this and we think it's generally better to take a 'RopeSlice' rather than a '&Rope'. The code block rendering function in the markdown component module is a good example for how this can be useful: we can remove an allocation of a rope and instead directly turn a '&str' into a 'RopeSlice' which is very cheap. A change to prefer 'RopeSlice' to '&Rope' whenever the rope isn't modified would be nice, but it would be a very large diff (around 500+ 500-). Starting off with just the syntax functions seems like a nice middle-ground, and we can remove a Rope allocation because of it. Co-authored-by: Pascal Kuthe <pascal.kuthe@semimod.de>
* Fix transaction composition order in History::changes_since (#4981)Michael Davis2022-12-03
| | | | | | | | | | | * Add a undo/redo split test case for crossing branches * history: Switch up/down transaction chaining order The old code tends to work in practice because, usually, either up_txns or down_txns are empty. When both have contents though, we can run into a panic trying to compose them all since they will disagree on the length of the text. This fixes the panic test case in the parent commit.
* Use lowest common ancestor search in History::changes_sinceMichael Davis2022-11-29
|
* Follow parent links when calculating changes since a revisionMichael Davis2022-11-24
| | | | | | The 'revisions' field on History can't be treated as linear: each Revision in the revisions Vec has a parent link and an optional child link. We can follow those to unroll the recent history.
* Apply inversions to Views on undo/redoMichael Davis2022-11-24
| | | | | | | | When using undo/redo, the history revision can be decremented. In that case we should apply the inversions since the given revision in History::changes_since. This prevents panics with jumplist operations when a session uses undo/redo to move the jumplist selection outside of the document.
* Apply transactions to all views (#4733)Michael Davis2022-11-23
| | | | | | | | | | | | | | | | | * Add a test case for updating jumplists across windows * Apply transactions to all views on history changes This ensures that jumplist selections follow changes in documents, even when there are multiple views (for example a split where both windows edit the same document). * Leave TODOs for cleaning up View::apply * Use Iterator::reduce to compose history transactions Co-authored-by: Blaž Hrastnik <blaz@mxxn.io> Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* core: Move state into the history moduleBlaž Hrastnik2022-11-08
|
* Resolve a bunch of upcoming clippy lintsBlaž Hrastnik2022-11-04
|
* Improve Readability (#2639)Ryan Russell2022-06-01
|
* fix typos (#2304)chunghha2022-04-27
|
* Fix Clippy lints in tests (#1563)Omnikar2022-01-23
| | | Co-authored-by: Blaž Hrastnik <blaz@mxxn.io>
* Add movement shortcut for history (#1088)Ivan Tham2021-11-14
| | | alt-u and alt-U
* minor: Import Range tooBlaž Hrastnik2021-11-14
|
* Implement "Goto last modification" command (#1067)ath32021-11-14
|
* Add hyperlinks to fix `cargo doc` warn (#931)Omnikar2021-10-29
|
* Document more of helix-core (#904)Kirawi2021-10-25
|
* Fix all remaining warnings in helix-core except for two.Nathan Vegdahl2021-07-02
| | | | | I'm not sure how to address them, because they look like they might be bugs, and code is involved. Will poke the relevant people.
* Remove #[allow(unused)] from helix-core, and fix unused imports.Nathan Vegdahl2021-07-02
| | | | Still a bunch more warnings to fix in core, but it's a start.
* Add :earlier and :later commands that can be used to navigate the full edit ↵Jakub Bartodziej2021-06-11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | history. (#194) * Disable deleting from an empty buffer which can cause a crash. * Improve on the fix for deleting from the end of the buffer. * Clean up leftover log. * Avoid theoretical underflow. * Implement :before which accepts a time interval and moves the editor to the closest history state to the commit of the current time minus that interval. Current time is now by default, or the commit time if :before has just been used. * Add :earlier an :later commands that can move through the edit history and retrieve changes hidded by undoing and commiting new changes. The commands accept a number of steps or a time period relative to the currrent change. * Fix clippy lint error. * Remove the dependency on parse_duration, add a custom parser instead. * Fix clippy errors. * Make helix_core::history a public module. * Use the helper for getting the current document and view. * Handled some PR comments. * Fix the logic in :later n. Co-authored-by: Ivan Tham <pickfire@riseup.net> * Add an alias for :earlier. Co-authored-by: Ivan Tham <pickfire@riseup.net> * Add an alias for later. Co-authored-by: Ivan Tham <pickfire@riseup.net> * Run cargo fmt. * Add some tests for earlier and later. * Add more tests and restore the fix for later that diappeared somehow. * Use ? instead of a match on an option. Co-authored-by: Ivan Tham <pickfire@riseup.net> * Rename to UndoKind. * Remove the leftover match. * Handle a bunch of review comments. * More systemd.time compliant time units and additional description for the new commands. * A more concise rewrite of the time span parser using ideas from PR discussion. * Replace a match with map_err(). Co-authored-by: Ivan Tham <pickfire@riseup.net> Co-authored-by: Jakub Bartodziej <jqb@google.com> Co-authored-by: Ivan Tham <pickfire@riseup.net>
* Derive debug without featureIvan Tham2021-06-10
| | | | Note that this also removed those `finish_non_exhaustive()`.
* Implement Debug for data structure as a featurenotoria2021-06-10
|
* Separate document history into CellIvan Tham2021-06-02
| | | | | As history is used separately from the rest of the edits, separating it can avoid needless borrowing and cloning. But one need to be aware later.
* doc: Be smarter about calculating modified status.Blaž Hrastnik2021-05-03
| | | | This way edit -> undo will properly show up as unmodified.
* Fully drop State references.Blaž Hrastnik2021-03-31
|
* clippy lintBlaž Hrastnik2021-03-24
|
* Make Transaction::change only rely on the rope.Blaž Hrastnik2021-03-18
|
* Cleanup: use doc.selection() instead of doc.state.selection().Blaž Hrastnik2021-03-14
|
* Fix undo/redo not updating the syntax tree.Blaž Hrastnik2020-12-03
|
* history.redo()Blaž Hrastnik2020-10-13
|
* Undo tree draft.Blaž Hrastnik2020-10-13
We keep a tree of transactions. This allows for persistent undo by simply serializing the changesets.