about summary refs log tree commit diff stats
path: root/source.lua
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-09-14 22:41:22 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-09-14 22:41:22 -0700
commit6e429d3e4d5f11a43084e38eb605ff7efc9ea4f8 (patch)
tree4574533c2834095be4f28f807de37f11c512bad8 /source.lua
parentb70fa64d1b950f174979cdc33fca0d3eaad52d91 (diff)
parent1a88b4a2907a78fd4a1febf32c74d0305aff6ba0 (diff)
downloadview.love-6e429d3e4d5f11a43084e38eb605ff7efc9ea4f8.tar.gz
Merge text.love
Diffstat (limited to 'source.lua')
-rw-r--r--source.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/source.lua b/source.lua
index efef463..0d7e638 100644
--- a/source.lua
+++ b/source.lua
@@ -1,6 +1,7 @@
 source = {}
 
 Editor_state = {}
+Line_number_width = 3  -- in ems
 
 -- called both in tests and real run
 function source.initialize_globals()
@@ -125,7 +126,7 @@ function source.load_settings()
   if Show_log_browser_side then
     right = App.screen.width/2 - Margin_right
   end
-  Editor_state = edit.initialize_state(Margin_top, Margin_left, right, settings.font_height, math.floor(settings.font_height*1.3))
+  Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), right, settings.font_height, math.floor(settings.font_height*1.3))
   Editor_state.filename = settings.filename
   Editor_state.filename = basename(Editor_state.filename)  -- migrate settings that used full paths; we now support only relative paths within the app
   if settings.cursors then
@@ -153,7 +154,7 @@ function source.initialize_default_settings()
   local font_height = 20
   love.graphics.setFont(love.graphics.newFont(font_height))
   source.initialize_window_geometry()
-  Editor_state = edit.initialize_state(Margin_top, Margin_left, App.screen.width-Margin_right)
+  Editor_state = edit.initialize_state(Margin_top, Margin_left + Line_number_width*App.width('m'), App.screen.width-Margin_right)
   Editor_state.filename = 'run.lua'
   Editor_state.font_height = font_height
   Editor_state.line_height = math.floor(font_height*1.3)