more precise click-handling in word-wrapping lines

This commit is contained in:
Kartik K. Agaram 2024-09-15 11:18:14 -07:00
parent 23418d4b6a
commit 2b1fc7746d
1 changed files with 3 additions and 1 deletions

View File

@ -557,7 +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=editor.width-x, dy=editor.line_height, pos=pos, data=char, show_cursor=true}) -- char+filler
{x=x, y=y, dx=w, dy=editor.line_height, pos=pos, data=char, show_cursor=true}) -- char
table.insert(curr_screen_line,
{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})