From 1fd30c0462faf598d5ef7b2911379bc19a649253 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 14 Sep 2023 22:27:38 -0700 Subject: always show line numbers in source editor The drawing buttons are now absolutely positioned, which is a horrible hack. But for just the source editor it seems good enough. The alternative is to modify magic constants in all the tests :/ --- source.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'source.lua') diff --git a/source.lua b/source.lua index d9e44b6..4a8bb48 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) -- cgit 1.4.1-2-gfad0