From 4c5ac9ae5ea50bb2a848ca79f2bb4a4828a2944d Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Sat, 4 Jun 2022 20:52:36 -0700 Subject: regression: couldn't do many drawing operations because line.y was reset --- main.lua | 8 +++++++- text.lua | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/main.lua b/main.lua index 2de9a0a..1235641 100644 --- a/main.lua +++ b/main.lua @@ -252,7 +252,6 @@ function App.textinput(t) end function App.keychord_pressed(chord) - for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll if Search_term then if chord == 'escape' then Search_term = nil @@ -290,6 +289,7 @@ function App.keychord_pressed(chord) initialize_font_settings(20) Text.redraw_all() elseif chord == 'C-z' then + for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll local event = undo_event() if event then local src = event.before @@ -299,6 +299,7 @@ function App.keychord_pressed(chord) patch(Lines, event.after, event.before) end elseif chord == 'C-y' then + for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll local event = redo_event() if event then local src = event.after @@ -309,16 +310,19 @@ function App.keychord_pressed(chord) end -- clipboard elseif chord == 'C-c' then + for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll local s = Text.selection() if s then App.setClipboardText(s) end elseif chord == 'C-x' then + for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll local s = Text.cut_selection() if s then App.setClipboardText(s) end elseif chord == 'C-v' then + for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll -- We don't have a good sense of when to scroll, so we'll be conservative -- and sometimes scroll when we didn't quite need to. local before_line = Cursor1.line @@ -356,6 +360,7 @@ function App.keychord_pressed(chord) record_undo_event({before=before, after=snapshot(before_line, Cursor1.line)}) -- dispatch to drawing or text elseif love.mouse.isDown('1') or chord:sub(1,2) == 'C-' then + -- DON'T reset line.y here Drawing.keychord_pressed(chord) elseif chord == 'escape' and love.mouse.isDown('1') then local drawing = Drawing.current_drawing() @@ -385,6 +390,7 @@ function App.keychord_pressed(chord) end save_to_disk(Lines, Filename) else + for _,line in ipairs(Lines) do line.y = nil end -- just in case we scroll Text.keychord_pressed(chord) end end diff --git a/text.lua b/text.lua index cbccc85..7302a0a 100644 --- a/text.lua +++ b/text.lua @@ -887,6 +887,7 @@ end function Text.redraw_all() for _,line in ipairs(Lines) do + line.y = nil line.fragments = nil line.screen_line_starting_pos = nil end -- cgit 1.4.1-2-gfad0 536ef431a36f7940bedc3d2c028baa0a9a'>kernel.soso/tty.c
blob: 9e53c339f6ad779baecf09d3cf8fc13fb3d2fe47 (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
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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153