mirror of
https://github.com/kepler155c/opus
synced 2025-01-03 20:30:28 +00:00
better text entry - bugfixes
This commit is contained in:
parent
c1baf107c1
commit
19159730a4
@ -327,24 +327,26 @@ local mappings = {
|
|||||||
[ 'end' ] = Entry.moveEnd,
|
[ 'end' ] = Entry.moveEnd,
|
||||||
[ 'control-e' ] = Entry.moveEnd,
|
[ 'control-e' ] = Entry.moveEnd,
|
||||||
[ 'mouse_click' ] = Entry.moveTo,
|
[ 'mouse_click' ] = Entry.moveTo,
|
||||||
[ 'backspace' ] = Entry.backspace,
|
|
||||||
[ 'control-right' ] = Entry.moveWordRight,
|
[ 'control-right' ] = Entry.moveWordRight,
|
||||||
[ 'alt-f' ] = Entry.moveWordRight,
|
[ 'alt-f' ] = Entry.moveWordRight,
|
||||||
[ 'control-left' ] = Entry.moveWordLeft,
|
[ 'control-left' ] = Entry.moveWordLeft,
|
||||||
[ 'alt-b' ] = Entry.moveWordLeft,
|
[ 'alt-b' ] = Entry.moveWordLeft,
|
||||||
[ 'mouse_doubleclick' ] = Entry.markWord,
|
|
||||||
|
[ 'backspace' ] = Entry.backspace,
|
||||||
[ 'delete' ] = Entry.delete,
|
[ 'delete' ] = Entry.delete,
|
||||||
|
[ 'char' ] = Entry.insertChar,
|
||||||
|
[ 'mouse_rightclick' ] = Entry.clearLine,
|
||||||
|
|
||||||
|
[ 'control-c' ] = Entry.copy,
|
||||||
[ 'control-u' ] = Entry.cutFromStart,
|
[ 'control-u' ] = Entry.cutFromStart,
|
||||||
[ 'control-k' ] = Entry.cutToEnd,
|
[ 'control-k' ] = Entry.cutToEnd,
|
||||||
--[ 'control-d' ] = Entry.cutNextWord,
|
|
||||||
[ 'control-w' ] = Entry.cutPrevWord,
|
[ 'control-w' ] = Entry.cutPrevWord,
|
||||||
[ 'char' ] = Entry.insertChar,
|
--[ 'control-d' ] = Entry.cutNextWord,
|
||||||
[ 'control-c' ] = Entry.copy,
|
|
||||||
[ 'control-x' ] = Entry.cut,
|
[ 'control-x' ] = Entry.cut,
|
||||||
[ 'paste' ] = Entry.paste,
|
[ 'paste' ] = Entry.paste,
|
||||||
[ 'control-y' ] = Entry.paste,
|
[ 'control-y' ] = Entry.paste,
|
||||||
[ 'mouse_rightclick' ] = Entry.clearLine,
|
|
||||||
|
|
||||||
|
[ 'mouse_doubleclick' ] = Entry.markWord,
|
||||||
[ 'shift-left' ] = Entry.markLeft,
|
[ 'shift-left' ] = Entry.markLeft,
|
||||||
[ 'shift-right' ] = Entry.markRight,
|
[ 'shift-right' ] = Entry.markRight,
|
||||||
[ 'mouse_down' ] = Entry.markAnchor,
|
[ 'mouse_down' ] = Entry.markAnchor,
|
||||||
|
@ -261,7 +261,7 @@ function Manager:click(target, code, button, x, y)
|
|||||||
clickEvent.button = button
|
clickEvent.button = button
|
||||||
clickEvent.type = code
|
clickEvent.type = code
|
||||||
clickEvent.key = code
|
clickEvent.key = code
|
||||||
clickEvent.ie = { code = code, x = x, y = y }
|
clickEvent.ie = { code = code, x = clickEvent.x, y = clickEvent.y }
|
||||||
|
|
||||||
if clickEvent.element.focus then
|
if clickEvent.element.focus then
|
||||||
target:setFocus(clickEvent.element)
|
target:setFocus(clickEvent.element)
|
||||||
|
@ -35,13 +35,13 @@ end
|
|||||||
function UI.TextEntry:setValue(value)
|
function UI.TextEntry:setValue(value)
|
||||||
self.value = value
|
self.value = value
|
||||||
self.entry:unmark()
|
self.entry:unmark()
|
||||||
self.entry.value = value
|
self.entry.value = tostring(value)
|
||||||
self.entry:updateScroll()
|
self.entry:updateScroll()
|
||||||
end
|
end
|
||||||
|
|
||||||
function UI.TextEntry:setPosition(pos)
|
function UI.TextEntry:setPosition(pos)
|
||||||
self.entry.pos = pos
|
self.entry.pos = pos
|
||||||
self.entry.value = self.value
|
self.entry.value = tostring(self.value)
|
||||||
self.entry:updateScroll()
|
self.entry:updateScroll()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -86,6 +86,7 @@ end
|
|||||||
|
|
||||||
function UI.TextEntry:reset()
|
function UI.TextEntry:reset()
|
||||||
self.entry:reset()
|
self.entry:reset()
|
||||||
|
self.value = ''
|
||||||
self:draw()
|
self:draw()
|
||||||
self:updateCursor()
|
self:updateCursor()
|
||||||
end
|
end
|
||||||
@ -105,7 +106,7 @@ end
|
|||||||
|
|
||||||
function UI.TextEntry:eventHandler(event)
|
function UI.TextEntry:eventHandler(event)
|
||||||
local text = self.value
|
local text = self.value
|
||||||
self.entry.value = text
|
self.entry.value = tostring(text)
|
||||||
if event.ie and self.entry:process(event.ie) then
|
if event.ie and self.entry:process(event.ie) then
|
||||||
if self.entry.textChanged then
|
if self.entry.textChanged then
|
||||||
self.value = self.entry.value
|
self.value = self.entry.value
|
||||||
|
@ -662,8 +662,6 @@ local function shellRead(history)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
--local _, cy = term.getCursorPos()
|
|
||||||
--term.setCursorPos( w + 1, cy )
|
|
||||||
print()
|
print()
|
||||||
term.setCursorBlink( false )
|
term.setCursorBlink( false )
|
||||||
return entry.value
|
return entry.value
|
||||||
|
Loading…
Reference in New Issue
Block a user