about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-07-15 22:15:07 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-07-15 22:15:07 -0700
commita1da18c107940fa68b5522a76b14d663805796a9 (patch)
treec55c7eb69d6dbef545c764ebad114f81c2d10513
parent2884f872d84046917919bc36ff5da9425b2a6399 (diff)
downloadtext.love-a1da18c107940fa68b5522a76b14d663805796a9.tar.gz
more precise name
-rw-r--r--edit.lua13
-rw-r--r--main.lua7
2 files changed, 10 insertions, 10 deletions
diff --git a/edit.lua b/edit.lua
index 62aa7a6..c56bccc 100644
--- a/edit.lua
+++ b/edit.lua
@@ -333,13 +333,13 @@ function edit.keychord_pressed(State, chord, key)
     State.search_backup = {cursor={line=State.cursor1.line, pos=State.cursor1.pos}, screen_top={line=State.screen_top1.line, pos=State.screen_top1.pos}}
     assert(State.search_text == nil)
   elseif chord == 'C-=' then
-    initialize_font_settings(State.font_height+2)
+    edit.update_font_settings(State, State.font_height+2)
     Text.redraw_all(State)
   elseif chord == 'C--' then
-    initialize_font_settings(State.font_height-2)
+    edit.update_font_settings(State, State.font_height-2)
     Text.redraw_all(State)
   elseif chord == 'C-0' then
-    initialize_font_settings(20)
+    edit.update_font_settings(State, 20)
     Text.redraw_all(State)
   elseif chord == 'C-z' then
     for _,line in ipairs(State.lines) do line.y = nil end  -- just in case we scroll
@@ -450,6 +450,13 @@ end
 function edit.key_released(State, key, scancode)
 end
 
+function edit.update_font_settings(State, font_height)
+  State.font_height = font_height
+  love.graphics.setFont(love.graphics.newFont(Editor_state.font_height))
+  State.line_height = math.floor(font_height*1.3)
+  State.em = App.newText(love.graphics.getFont(), 'm')
+end
+
 --== some methods for tests
 
 Test_margin_left = 25
diff --git a/main.lua b/main.lua
index 32eaaa5..11bf3db 100644
--- a/main.lua
+++ b/main.lua
@@ -123,13 +123,6 @@ function App.resize(w, h)
   Last_resize_time = App.getTime()
 end
 
-function initialize_font_settings(font_height)
-  Editor_state.font_height = font_height
-  love.graphics.setFont(love.graphics.newFont(Editor_state.font_height))
-  Editor_state.line_height = math.floor(font_height*1.3)
-  Editor_state.em = App.newText(love.graphics.getFont(), 'm')
-end
-
 function App.filedropped(file)
   -- first make sure to save edits on any existing file
   if Editor_state.next_save then