mirror of
https://github.com/SquidDev-CC/CC-Tweaked
synced 2025-04-15 15:23:13 +00:00
Allow navigating read
's input using the mouse
This commit is contained in:
parent
a8fadabaf1
commit
c4d18aa9ca
@ -326,7 +326,7 @@ function read( _sReplaceChar, _tHistory, _fnComplete, _sDefault )
|
||||
nScroll = (sx + nPos) - w
|
||||
end
|
||||
|
||||
local cx,cy = term.getCursorPos()
|
||||
local _, cy = term.getCursorPos()
|
||||
term.setCursorPos( sx, cy )
|
||||
local sReplace = (_bClear and " ") or _sReplaceChar
|
||||
if sReplace then
|
||||
@ -523,6 +523,14 @@ function read( _sReplaceChar, _tHistory, _fnComplete, _sDefault )
|
||||
|
||||
end
|
||||
|
||||
elseif sEvent == "mouse_click" or sEvent == "mouse_drag" and param == 1 then
|
||||
local _, cy = term.getCursorPos()
|
||||
if param2 >= sx and param2 <= w and param2 == cy then
|
||||
-- Then ensure we don't scroll beyond the current line
|
||||
nPos = math.min(math.max(nScroll + x - sx, 0, #sLine))
|
||||
redraw()
|
||||
end
|
||||
|
||||
elseif sEvent == "term_resize" then
|
||||
-- Terminal resized
|
||||
w = term.getSize()
|
||||
|
Loading…
x
Reference in New Issue
Block a user