about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--main.lua25
-rw-r--r--manual_tests4
2 files changed, 27 insertions, 2 deletions
diff --git a/main.lua b/main.lua
index 13d4efe..3220b51 100644
--- a/main.lua
+++ b/main.lua
@@ -79,6 +79,9 @@ Search_term = nil
 Search_text = nil
 Search_backup = nil  -- stuff to restore when cancelling search
 
+-- resize
+Last_resize_time = nil
+
 end  -- App.initialize_globals
 
 function App.initialize(arg)
@@ -148,8 +151,8 @@ function love.resize(w, h)
 --?   print(("Window resized to width: %d and height: %d."):format(w, h))
   App.screen.width, App.screen.height = w, h
   Line_width = math.min(40*App.width(Em), App.screen.width-50)
-  -- Should I Text.redraw_all() here to reset text fragments? It doesn't seem
-  -- to be needed, based on repeatedly resizing the window up and down.
+  Text.redraw_all()
+  Last_resize_time = love.timer.getTime()
 end
 
 function initialize_font_settings(font_height)
@@ -183,6 +186,16 @@ function App.draw()
   love.graphics.setColor(1, 1, 1)
   love.graphics.rectangle('fill', 0, 0, App.screen.width-1, App.screen.height-1)
   love.graphics.setColor(0, 0, 0)
+
+  -- some hysteresis while resizing
+  if Last_resize_time then
+    if love.timer.getTime() - Last_resize_time < 0.1 then
+      return
+    else
+      Last_resize_time = nil
+    end
+  end
+
   assert(Text.le1(Screen_top1, Cursor1))
   local y = Margin_top
 --?   print('== draw')
@@ -231,6 +244,14 @@ function App.draw()
 end
 
 function App.update(dt)
+  -- some hysteresis while resizing
+  if Last_resize_time then
+    if love.timer.getTime() - Last_resize_time < 0.1 then
+      return
+    else
+      Last_resize_time = nil
+    end
+  end
   Drawing.update(dt)
 end
 
diff --git a/manual_tests b/manual_tests
index 77d4b54..db2c579 100644
--- a/manual_tests
+++ b/manual_tests
@@ -35,3 +35,7 @@ scrolling:
 persistence:
   draw a line, circle, rectangle, square, polygon, quit, restart. All the shapes you drew should still be visible.
   select a point and name it, quit, restart. Name is still visible.
+
+resize:
+  create a file containing a long line of characters without spaces. try
+  resizing the window vertically and horizontally, as far as possible.
^
69f3fb0a ^



afa42503 ^


88be3dbc ^
69f3fb0a ^

bc643692 ^


afa42503 ^
69f3fb0a ^







0acfaaef ^
ac0e9db5 ^


69f3fb0a ^




6ea73c22 ^
7284d503 ^
dd994cda ^






363be37f ^
dd994cda ^
88be3dbc ^
dd994cda ^
bc643692 ^


afa42503 ^
dd994cda ^


88be3dbc ^
dd994cda ^
bc643692 ^


afa42503 ^
dd994cda ^


6ea73c22 ^


363be37f ^
dd994cda ^

e4630643 ^



0487a30e ^
ac0e9db5 ^
18e626df ^



1ad3fe9e ^
e4630643 ^
eefde1b9 ^


e4630643 ^
eefde1b9 ^

ac0e9db5 ^
0487a30e ^
ac0e9db5 ^
0487a30e ^
dd994cda ^

0487a30e ^
dd994cda ^
cfb142b9 ^
827898fc ^
dd994cda ^

b98d3876 ^

















02a55f71 ^








bc643692 ^


02a55f71 ^




2eab85b3 ^



































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
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186