support non-text lines in Text.to2

Originally I was only using it on cursor line, but there's no reason
that has to be true in general.
This commit is contained in:
Kartik K. Agaram 2022-05-30 15:40:36 -07:00
parent 3b4dacaee8
commit b22bfe82db
1 changed files with 3 additions and 1 deletions

View File

@ -1737,7 +1737,9 @@ function Text.x(s, pos)
end
function Text.to2(pos1)
assert(Lines[pos1.line].mode == 'text')
if Lines[pos1.line].mode == 'drawing' then
return {line=pos1.line, screen_line=1, screen_pos=1}
end
local result = {line=pos1.line, screen_line=1}
if Lines[pos1.line].screen_line_starting_pos == nil then
result.screen_pos = pos1.pos