From dd15f15640b882f7080ef3275b6a8c132bd1371d Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 18 Aug 2022 13:37:14 -0700 Subject: [PATCH] couple of accidental globals Luckily they didn't bite me yet. --- text.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/text.lua b/text.lua index 451ab51..90a139c 100644 --- a/text.lua +++ b/text.lua @@ -451,7 +451,7 @@ function Text.up(State) else -- move up one screen line in current line assert(screen_line_index > 1) - new_screen_line_starting_pos = State.line_cache[State.cursor1.line].screen_line_starting_pos[screen_line_index-1] + local new_screen_line_starting_pos = State.line_cache[State.cursor1.line].screen_line_starting_pos[screen_line_index-1] local new_screen_line_starting_byte_offset = Text.offset(State.lines[State.cursor1.line].data, new_screen_line_starting_pos) local s = string.sub(State.lines[State.cursor1.line].data, new_screen_line_starting_byte_offset) State.cursor1.pos = new_screen_line_starting_pos + Text.nearest_cursor_pos(s, State.cursor_x, State.left) - 1 @@ -491,7 +491,7 @@ function Text.down(State) local scroll_down = Text.le1(State.screen_bottom1, State.cursor1) --? print('cursor is NOT at final screen line of its line') local screen_line_starting_pos, screen_line_index = Text.pos_at_start_of_screen_line(State, State.cursor1) - new_screen_line_starting_pos = State.line_cache[State.cursor1.line].screen_line_starting_pos[screen_line_index+1] + local new_screen_line_starting_pos = State.line_cache[State.cursor1.line].screen_line_starting_pos[screen_line_index+1] --? print('switching pos of screen line at cursor from '..tostring(screen_line_starting_pos)..' to '..tostring(new_screen_line_starting_pos)) local new_screen_line_starting_byte_offset = Text.offset(State.lines[State.cursor1.line].data, new_screen_line_starting_pos) local s = string.sub(State.lines[State.cursor1.line].data, new_screen_line_starting_byte_offset)