about summary refs log tree commit diff stats
path: root/text.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-06-05 10:08:28 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-06-05 10:08:28 -0700
commit9cafed99f4afbe1b8e7d20d78f623b9ee32579ef (patch)
tree213f292085bd0ea7f07cc7b5cd4c940aeaf5d059 /text.lua
parente7a985bd0a02a1b443cb89ca5ce09506f18a870f (diff)
downloadview.love-9cafed99f4afbe1b8e7d20d78f623b9ee32579ef.tar.gz
another bugfix in scrolling while inserting text
I'm being unprincipled at the moment between pos and x,y coordinates.
Whatever is more convenient. Perhaps a cleaner approach will come to me
over time.
Diffstat (limited to 'text.lua')
-rw-r--r--text.lua3
1 files changed, 1 insertions, 2 deletions
diff --git a/text.lua b/text.lua
index 88ee18d..df491c7 100644
--- a/text.lua
+++ b/text.lua
@@ -156,9 +156,8 @@ function Text.insert_at_cursor(t)
   Lines[Cursor1.line].data = string.sub(Lines[Cursor1.line].data, 1, byte_offset-1)..t..string.sub(Lines[Cursor1.line].data, byte_offset)
   Lines[Cursor1.line].fragments = nil
   Lines[Cursor1.line].screen_line_starting_pos = nil
-  local scroll_down = Text.le1(Screen_bottom1, Cursor1)
   Cursor1.pos = Cursor1.pos+1
-  if scroll_down then
+  if Cursor_y >= App.screen.height - Line_height then
     Text.populate_screen_line_starting_pos(Cursor1.line)
     Text.snap_cursor_to_bottom_of_screen()
 --?     print('=>', Screen_top1.line, Screen_top1.pos, Cursor1.line, Cursor1.pos, Screen_bottom1.line, Screen_bottom1.pos)
d='n135' href='#n135'>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 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248