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