about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2023-03-17 22:17:23 -0700
committerKartik K. Agaram <vc@akkartik.com>2023-03-17 22:17:23 -0700
commit6709b394fba8dbc8cdfaaf3a9461e79ce7b0c2e0 (patch)
tree044d33b611085c7ac334731e129df59124cea885
parent675d1cbbdf026313d682086e1652a69540f18334 (diff)
downloadtext.love-6709b394fba8dbc8cdfaaf3a9461e79ce7b0c2e0.tar.gz
more bugfix
Don't crash on showing the log browser.
-rw-r--r--log_browser.lua6
-rw-r--r--source_text.lua2
-rw-r--r--text.lua2
3 files changed, 4 insertions, 6 deletions
diff --git a/log_browser.lua b/log_browser.lua
index 76596f2..5946e3e 100644
--- a/log_browser.lua
+++ b/log_browser.lua
@@ -12,7 +12,7 @@ function source.initialize_log_browser_side()
   log_browser.parse(Log_browser_state)
   Text.redraw_all(Log_browser_state)
   Log_browser_state.screen_top1 = {line=1, pos=1}
-  Log_browser_state.cursor1 = {line=1, pos=nil}
+  Log_browser_state.cursor1 = {line=1, pos=1}
 end
 
 Section_stack = {}
@@ -237,14 +237,12 @@ function log_browser.mouse_press(State, x,y, mouse_button)
     source.switch_to_file(line.filename)
   end
   -- set cursor
-  Editor_state.cursor1 = {line=line.line_number, pos=1, posB=nil}
+  Editor_state.cursor1 = {line=line.line_number, pos=1}
   -- make sure it's visible
   -- TODO: handle extremely long lines
   Editor_state.screen_top1.line = math.max(0, Editor_state.cursor1.line-5)
   -- show cursor
   Focus = 'edit'
-  -- expand B side
-  Editor_state.expanded = true
 end
 
 function log_browser.line_index(State, mx,my)
diff --git a/source_text.lua b/source_text.lua
index 1c91f28..fb4c389 100644
--- a/source_text.lua
+++ b/source_text.lua
@@ -689,7 +689,7 @@ function Text.snap_cursor_to_bottom_of_screen(State)
 --?   print('to2: =>', top2.line, top2.screen_line, top2.screen_pos)
   -- slide to start of screen line
   top2.screen_pos = 1  -- start of screen line
---?   print('snap', State.screen_top1.line, State.screen_top1.pos, State.screen_top1.posB, State.cursor1.line, State.cursor1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
+--?   print('snap', State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
 --?   print('cursor pos '..tostring(State.cursor1.pos)..' is on the #'..tostring(top2.screen_line)..' screen line down')
   local y = App.screen.height - State.line_height
   -- duplicate some logic from love.draw
diff --git a/text.lua b/text.lua
index 6a1ef2d..35b30c4 100644
--- a/text.lua
+++ b/text.lua
@@ -672,7 +672,7 @@ function Text.snap_cursor_to_bottom_of_screen(State)
 --?   print('to2: =>', top2.line, top2.screen_line, top2.screen_pos)
   -- slide to start of screen line
   top2.screen_pos = 1  -- start of screen line
---?   print('snap', State.screen_top1.line, State.screen_top1.pos, State.screen_top1.posB, State.cursor1.line, State.cursor1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
+--?   print('snap', State.screen_top1.line, State.screen_top1.pos, State.cursor1.line, State.cursor1.pos, State.screen_bottom1.line, State.screen_bottom1.pos)
 --?   print('cursor pos '..tostring(State.cursor1.pos)..' is on the #'..tostring(top2.screen_line)..' screen line down')
   local y = App.screen.height - State.line_height
   -- duplicate some logic from love.draw