about summary refs log tree commit diff stats
path: root/source_edit.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-03-17 21:18:17 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-03-17 21:40:51 -0700
commitae429cd78a1f52272d5f51991ebb9b04b542ce01 (patch)
treecfc3a8509ac7b47341507da2c614f0588601fccc /source_edit.lua
parent81ebc6a55998f59c34a725bd47d77e88fb0eb341 (diff)
downloadtext.love-ae429cd78a1f52272d5f51991ebb9b04b542ce01.tar.gz
bring a few things in sync between run and source
Diffstat (limited to 'source_edit.lua')
-rw-r--r--source_edit.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/source_edit.lua b/source_edit.lua
index 5c90075..a296c53 100644
--- a/source_edit.lua
+++ b/source_edit.lua
@@ -96,8 +96,8 @@ function edit.initialize_state(top, left, right, font_height, line_height)  -- c
     em = App.newText(love.graphics.getFont(), 'm'),  -- widest possible character width
 
     top = top,
-    left = left,
-    right = right,
+    left = math.floor(left),
+    right = math.floor(right),
     width = right-left,
 
     filename = love.filesystem.getUserDirectory()..'/lines.txt',  -- '/' should work even on Windows
@@ -227,12 +227,14 @@ function edit.quit(State)
   -- make sure to save before quitting
   if State.next_save then
     save_to_disk(State)
+    -- give some time for the OS to flush everything to disk
+    love.timer.sleep(0.1)
   end
 end
 
 function edit.mouse_press(State, x,y, mouse_button)
   if State.search_term then return end
---?   print('press')
+--?   print('press', State.selection1.line, State.selection1.pos)
   if mouse_press_consumed_by_any_button_handler(State, x,y, mouse_button) then
     -- press on a button and it returned 'true' to short-circuit
     return