aboutsummaryrefslogtreecommitdiff
path: root/0002-Fix-writes-from-insert-mode.patch
blob: 22b00cf36bca7c952d58d1609577cad5d52a7893 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
From 6ef36e958254b873684621bb91d1ba299e2d9d7d Mon Sep 17 00:00:00 2001
From: JJ <git@toki.la>
Date: Sat, 15 Jul 2023 17:42:04 -0700
Subject: [PATCH 1/2] Fix writes from insert mode not properly updating the
 revision history

ref: https://github.com/helix-editor/helix/pull/7226
---
 helix-term/src/commands/typed.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/helix-term/src/commands/typed.rs b/helix-term/src/commands/typed.rs
index dfc71dfd..3f746bf0 100644
--- a/helix-term/src/commands/typed.rs
+++ b/helix-term/src/commands/typed.rs
@@ -350,6 +350,8 @@ fn write_impl(
         None
     };
 
+    doc.append_changes_to_history(view);
+
     if fmt.is_none() {
         let id = doc.id();
         cx.editor.save(id, path, force)?;
-- 
2.41.0


From 8305a40ec1fba47295987e8e8278a4aa2061009e Mon Sep 17 00:00:00 2001
From: JJ <git@toki.la>
Date: Sat, 15 Jul 2023 17:44:04 -0700
Subject: [PATCH 2/2] Write pre-manipulation pastes to the revision history

---
 helix-term/src/ui/editor.rs | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs
index 5b5cda93..252aff0d 100644
--- a/helix-term/src/ui/editor.rs
+++ b/helix-term/src/ui/editor.rs
@@ -1240,15 +1240,9 @@ fn handle_event(
                 cx.editor.count = None;
 
                 let config = cx.editor.config();
-                let mode = cx.editor.mode();
                 let (view, doc) = current!(cx.editor);
                 view.ensure_cursor_in_view(doc, config.scrolloff);
-
-                // Store a history state if not in insert mode. Otherwise wait till we exit insert
-                // to include any edits to the paste in the history state.
-                if mode != Mode::Insert {
-                    doc.append_changes_to_history(view);
-                }
+                doc.append_changes_to_history(view);
 
                 EventResult::Consumed(None)
             }
-- 
2.41.0