oh, now we can get rid of show_cursor support!

Compare the state now with a few hours ago (commit 284dfe616f)
This commit is contained in:
Kartik K. Agaram 2024-09-15 11:24:07 -07:00
parent d0491d11c2
commit 084e7de924
2 changed files with 7 additions and 7 deletions

View File

@ -157,7 +157,7 @@ function edit.draw(editor)
love.graphics.print(c.data, editor.left+c.x, y+c.y)
end
if line_index == editor.cursor.line then
if c.pos == editor.cursor.pos and c.show_cursor then
if c.pos == editor.cursor.pos then
Text.draw_cursor(editor, editor.left+c.x, y+c.y)
end
end

View File

@ -557,9 +557,9 @@ function Text.get_rect(editor, loc)
if char:match('%s') then
if Text.line_wrap_at_word_boundary(editor, editor.left + x, line.data, pos) then
table.insert(curr_screen_line,
{x=x, y=y, dx=w, dy=editor.line_height, pos=pos, data=char, show_cursor=true}) -- char
{x=x, y=y, dx=w, dy=editor.line_height, pos=pos, data=char}) -- char
table.insert(curr_screen_line,
{x=x+w, y=y, dx=editor.width-x-w, dy=editor.line_height, pos=pos+1, show_cursor=true}) -- filler
{x=x+w, y=y, dx=editor.width-x-w, dy=editor.line_height, pos=pos+1}) -- filler
table.insert(screen_lines,
{x=0, y=y, dx=editor.width, dy=editor.line_height,
pos=spos, dpos=pos-spos+1, char_rects=curr_screen_line})
@ -572,14 +572,14 @@ function Text.get_rect(editor, loc)
end
else
table.insert(curr_screen_line,
{x=x, y=y, dx=w, dy=editor.line_height, pos=pos, data=char, show_cursor=true})
{x=x, y=y, dx=w, dy=editor.line_height, pos=pos, data=char})
x = x + w
end
else
if x+w > editor.width then
assert(pos > 1)
table.insert(curr_screen_line,
{x=x, y=y, dx=editor.width-x, dy=editor.line_height, pos=pos, show_cursor=true}) -- filler
{x=x, y=y, dx=editor.width-x, dy=editor.line_height, pos=pos}) -- filler
table.insert(screen_lines,
{x=0, y=y, dx=editor.width, dy=editor.line_height,
pos=spos, dpos=(pos-1)-spos+1, char_rects=curr_screen_line})
@ -594,12 +594,12 @@ function Text.get_rect(editor, loc)
-- nothing
end
table.insert(curr_screen_line,
{x=x, y=y, dx=w, dy=editor.line_height, pos=pos, data=char, show_cursor=true})
{x=x, y=y, dx=w, dy=editor.line_height, pos=pos, data=char})
x = x + w
end
end
table.insert(curr_screen_line,
{x=x, y=y, dx=editor.width-x, dy=editor.line_height, pos=utf8.len(line.data)+1, show_cursor=true}) -- filler
{x=x, y=y, dx=editor.width-x, dy=editor.line_height, pos=utf8.len(line.data)+1}) -- filler
table.insert(screen_lines,
{x=0, y=y, dx=editor.width, dy=editor.line_height,
pos=spos, dpos=utf8.len(line.data)+1-spos+1, char_rects=curr_screen_line})