about summary refs log tree commit diff stats
path: root/source_text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2024-07-22 14:24:31 -0700
committerKartik K. Agaram <vc@akkartik.com>2024-07-22 14:24:31 -0700
commit8eb9826aac4a38721c47bdf648f8697538438caa (patch)
treeff63a28e53a489875b1b357504f9ce7c46718efb /source_text.lua
parentdb2463b9d046419ce94005106e953ed55bc3b644 (diff)
parentfab72a2902efe3271b8bf586a31c8c8ab8c7c1e8 (diff)
downloadview.love-8eb9826aac4a38721c47bdf648f8697538438caa.tar.gz
Merge lines.love
Diffstat (limited to 'source_text.lua')
-rw-r--r--source_text.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/source_text.lua b/source_text.lua
index 70bb610..76e9045 100644
--- a/source_text.lua
+++ b/source_text.lua
@@ -198,7 +198,7 @@ function Text.text_input(State, t)
   if App.mouse_down(1) then return end
   if App.any_modifier_down() then
     if App.key_down(t) then
-      -- The modifiers didn't change the key. Handle it in keychord_pressed.
+      -- The modifiers didn't change the key. Handle it in keychord_press.
       return
     else
       -- Key mutated by the keyboard layout. Continue below.
@@ -230,12 +230,11 @@ function Text.keychord_press(State, chord)
     local before_line = State.cursor1.line
     local before = snapshot(State, before_line)
     Text.insert_return(State)
-    State.selection1 = {}
     if State.cursor_y > App.screen.height - State.line_height then
       Text.snap_cursor_to_bottom_of_screen(State, State.left, State.right)
     end
-    schedule_save(State)
     record_undo_event(State, {before=before, after=snapshot(State, before_line, State.cursor1.line)})
+    schedule_save(State)
   elseif chord == 'tab' then
     local before = snapshot(State, State.cursor1.line)
 --?     print(State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos)
@@ -245,8 +244,8 @@ function Text.keychord_press(State, chord)
       Text.snap_cursor_to_bottom_of_screen(State, State.left, State.right)
 --?       print('=>', State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos)
     end
-    schedule_save(State)
     record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)})
+    schedule_save(State)
   elseif chord == 'backspace' then
     if State.selection1.line then
       Text.delete_selection(State, State.left, State.right)
@@ -293,8 +292,8 @@ function Text.keychord_press(State, chord)
     end
     Text.clear_screen_line_cache(State, State.cursor1.line)
     assert(Text.le1(State.screen_top1, State.cursor1), ('screen_top (line=%d,pos=%d) is below cursor (line=%d,pos=%d)'):format(State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos))
-    schedule_save(State)
     record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)})
+    schedule_save(State)
   elseif chord == 'delete' then
     if State.selection1.line then
       Text.delete_selection(State, State.left, State.right)
@@ -327,8 +326,8 @@ function Text.keychord_press(State, chord)
       table.remove(State.line_cache, State.cursor1.line+1)
     end
     Text.clear_screen_line_cache(State, State.cursor1.line)
-    schedule_save(State)
     record_undo_event(State, {before=before, after=snapshot(State, State.cursor1.line)})
+    schedule_save(State)
   --== shortcuts that move the cursor
   elseif chord == 'left' then
     Text.left(State)
/concurrency/cpuload.nim?h=devel&id=aedafb99787d3613c6776bea625d9a43b2b7a8ea'>^
6195dbe49 ^


52a7ed5d1 ^
6195dbe49 ^





adfdb4623 ^
6195dbe49 ^

ecbbefcc8 ^













6195dbe49 ^






4f8cf945f ^
95bb19a57 ^

6195dbe49 ^














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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103