parent
9fb8f25030
commit
abcc18002b
4
main.lua
4
main.lua
|
@ -353,7 +353,7 @@ function App.mousepressed(x,y, mouse_button)
|
|||
Mousepress_shift = App.shift_down()
|
||||
Selection1 = {
|
||||
line=line_index,
|
||||
pos=Text.to_pos_on_line(line, x, y),
|
||||
pos=Text.to_pos_on_line(line, x, y, Margin_left, App.screen.width-Margin_right),
|
||||
}
|
||||
--? print('selection', Selection1.line, Selection1.pos)
|
||||
break
|
||||
|
@ -389,7 +389,7 @@ function App.mousereleased(x,y, button)
|
|||
--? print('reset selection')
|
||||
Cursor1 = {
|
||||
line=line_index,
|
||||
pos=Text.to_pos_on_line(line, x, y),
|
||||
pos=Text.to_pos_on_line(line, x, y, Margin_left, App.screen.width-Margin_right),
|
||||
}
|
||||
--? print('cursor', Cursor1.line, Cursor1.pos)
|
||||
if Mousepress_shift then
|
||||
|
|
|
@ -96,7 +96,7 @@ function Text.to_pos(x,y, left, right)
|
|||
for line_index,line in ipairs(Lines) do
|
||||
if line.mode == 'text' then
|
||||
if Text.in_line(line, x,y, left, right) then
|
||||
return line_index, Text.to_pos_on_line(line, x,y)
|
||||
return line_index, Text.to_pos_on_line(line, x,y, left, right)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
5
text.lua
5
text.lua
|
@ -672,8 +672,7 @@ function Text.in_line(line, x,y, left,right)
|
|||
end
|
||||
|
||||
-- convert mx,my in pixels to schema-1 coordinates
|
||||
function Text.to_pos_on_line(line, mx, my)
|
||||
--? print('Text.to_pos_on_line', mx, my, 'width', App.screen.width-Margin_right)
|
||||
function Text.to_pos_on_line(line, mx, my, left, right)
|
||||
if line.fragments == nil then
|
||||
Text.compute_fragments(line)
|
||||
end
|
||||
|
@ -948,7 +947,7 @@ function Text.tweak_screen_top_and_cursor(left, right)
|
|||
local line = Lines[Screen_bottom1.line]
|
||||
Cursor1 = {
|
||||
line=Screen_bottom1.line,
|
||||
pos=Text.to_pos_on_line(line, App.screen.width-5, App.screen.height-5),
|
||||
pos=Text.to_pos_on_line(line, App.screen.width-5, App.screen.height-5, left, right),
|
||||
}
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue