diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2022-08-18 09:51:43 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2022-08-18 09:51:43 -0700 |
commit | a14f1096b6b11940bd677000eb41bc8ba6e9b559 (patch) | |
tree | 1674e795d0190354cd186b93fc5554b9aac0c4e0 | |
parent | f79dd4824c72ab93e90bdbf1d3fa130f7fb3c97d (diff) | |
download | view.love-a14f1096b6b11940bd677000eb41bc8ba6e9b559.tar.gz |
extract a variable
-rw-r--r-- | text.lua | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/text.lua b/text.lua index 4a585b7..ff98140 100644 --- a/text.lua +++ b/text.lua @@ -870,9 +870,10 @@ function Text.to2(State, loc1) return {line=loc1.line, screen_line=1, screen_pos=1} end local result = {line=loc1.line, screen_line=1} + local line_cache = State.line_cache[loc1.line] Text.populate_screen_line_starting_pos(State, loc1.line) - for i=#State.line_cache[loc1.line].screen_line_starting_pos,1,-1 do - local spos = State.line_cache[loc1.line].screen_line_starting_pos[i] + for i=#line_cache.screen_line_starting_pos,1,-1 do + local spos = line_cache.screen_line_starting_pos[i] if spos <= loc1.pos then result.screen_line = i result.screen_pos = loc1.pos - spos + 1 |