diff --git a/sys/apis/entry.lua b/sys/apis/entry.lua index e19f55c..b31f247 100644 --- a/sys/apis/entry.lua +++ b/sys/apis/entry.lua @@ -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, diff --git a/sys/apis/ui.lua b/sys/apis/ui.lua index e4a373a..41c7242 100644 --- a/sys/apis/ui.lua +++ b/sys/apis/ui.lua @@ -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) diff --git a/sys/apis/ui/components/TextEntry.lua b/sys/apis/ui/components/TextEntry.lua index e8df5d2..69566c6 100644 --- a/sys/apis/ui/components/TextEntry.lua +++ b/sys/apis/ui/components/TextEntry.lua @@ -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 diff --git a/sys/apps/shell.lua b/sys/apps/shell.lua index d415c11..a32676a 100644 --- a/sys/apps/shell.lua +++ b/sys/apps/shell.lua @@ -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