parent
e51ce12969
commit
ff88238ff1
4
main.lua
4
main.lua
|
@ -277,7 +277,7 @@ function App.mousepressed(x,y, mouse_button)
|
||||||
|
|
||||||
for line_index,line in ipairs(Lines) do
|
for line_index,line in ipairs(Lines) do
|
||||||
if line.mode == 'text' then
|
if line.mode == 'text' then
|
||||||
if Text.in_line(line, x,y) then
|
if Text.in_line(line_index,line, x,y) then
|
||||||
-- delicate dance between cursor, selection and old cursor
|
-- delicate dance between cursor, selection and old cursor
|
||||||
-- manual tests:
|
-- manual tests:
|
||||||
-- regular press+release: sets cursor, clears selection
|
-- regular press+release: sets cursor, clears selection
|
||||||
|
@ -315,7 +315,7 @@ function App.mousereleased(x,y, button)
|
||||||
else
|
else
|
||||||
for line_index,line in ipairs(Lines) do
|
for line_index,line in ipairs(Lines) do
|
||||||
if line.mode == 'text' then
|
if line.mode == 'text' then
|
||||||
if Text.in_line(line, x,y) then
|
if Text.in_line(line_index,line, x,y) then
|
||||||
Cursor1 = {line=line_index, pos=Text.to_pos_on_line(line, x, y)}
|
Cursor1 = {line=line_index, pos=Text.to_pos_on_line(line, x, y)}
|
||||||
if Mousepress_shift then
|
if Mousepress_shift then
|
||||||
if Old_selection1.line == nil then
|
if Old_selection1.line == nil then
|
||||||
|
|
4
text.lua
4
text.lua
|
@ -666,11 +666,11 @@ function Text.snap_cursor_to_bottom_of_screen()
|
||||||
Text.redraw_all() -- if we're scrolling, reclaim all fragments to avoid memory leaks
|
Text.redraw_all() -- if we're scrolling, reclaim all fragments to avoid memory leaks
|
||||||
end
|
end
|
||||||
|
|
||||||
function Text.in_line(line, x,y)
|
function Text.in_line(line_index,line, x,y)
|
||||||
if line.y == nil then return false end -- outside current page
|
if line.y == nil then return false end -- outside current page
|
||||||
if x < 25 then return false end
|
if x < 25 then return false end
|
||||||
if y < line.y then return false end
|
if y < line.y then return false end
|
||||||
Text.populate_screen_line_starting_pos(Cursor1.line)
|
Text.populate_screen_line_starting_pos(line_index)
|
||||||
return y < line.y + #line.screen_line_starting_pos * Line_height
|
return y < line.y + #line.screen_line_starting_pos * Line_height
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue