about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2022-05-25 14:56:21 -0700
committerKartik K. Agaram <vc@akkartik.com>2022-05-25 14:56:21 -0700
commit34950353b958979cf47611c77e271a0db3dc8c8f (patch)
tree4c2d74793871b95361ae0b953636c326b58e1a5c
parentfd213e6f49d44f3aa04edeea55d1da4b490b84d2 (diff)
downloadtext.love-34950353b958979cf47611c77e271a0db3dc8c8f.tar.gz
bugfix: don't append metadata when it already exists
-rw-r--r--text.lua8
1 files changed, 6 insertions, 2 deletions
diff --git a/text.lua b/text.lua
index b293e11..626e898 100644
--- a/text.lua
+++ b/text.lua
@@ -974,7 +974,7 @@ function Text.cursor_at_final_screen_line()
   if Lines[Cursor1.line].screen_line_starting_pos == nil then
     return true
   end
-  screen_lines = Lines[Cursor1.line].screen_line_starting_pos
+  local screen_lines = Lines[Cursor1.line].screen_line_starting_pos
 --?   print(screen_lines[#screen_lines], Cursor1.pos)
   return screen_lines[#screen_lines] <= Cursor1.pos
 end
@@ -1217,8 +1217,11 @@ end
 
 function Text.populate_screen_line_starting_pos(line_index)
 --?   print('Text.populate_screen_line_starting_pos')
-  -- duplicate some logic from Text.draw
   local line = Lines[line_index]
+  if line.screen_line_starting_pos then
+    return
+  end
+  -- duplicate some logic from Text.draw
   if line.fragments == nil then
     Text.compute_fragments(line, Line_width)
   end
@@ -1234,6 +1237,7 @@ function Text.populate_screen_line_starting_pos(line_index)
       if line.screen_line_starting_pos == nil then
         line.screen_line_starting_pos = {1, pos}
       else
+--?         print(' ', #line.screen_line_starting_pos, line.data)
         table.insert(line.screen_line_starting_pos, pos)
       end
     end
363be37f ^
37e4573b ^



1ec3eb4c ^



5a481085 ^
215365d4 ^




5a481085 ^

215365d4 ^

1ec3eb4c ^
215365d4 ^
37e4573b ^
dd2e01e4 ^
f1e09b14 ^
b24eb476 ^
dd2e01e4 ^
363be37f ^
37e4573b ^
37e4573b ^
91abd257 ^
363be37f ^
37e4573b ^


322ce34d ^
3ba63579 ^
7cca03bd ^
3ba63579 ^

7858a06a ^











3ba63579 ^
dd2e01e4 ^
363be37f ^
3ba63579 ^

b24eb476 ^
05d17773 ^
b24eb476 ^
05d17773 ^
3ba63579 ^
b24eb476 ^
05d17773 ^
3ba63579 ^





9cc16d04 ^
7f73795c ^
0f125d5f ^

37e4573b ^
a70ce311 ^





1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104