mirror of
https://github.com/kepler155c/opus
synced 2024-12-29 01:50:27 +00:00
oops
This commit is contained in:
parent
65c6ebf711
commit
0a828fecc5
@ -586,6 +586,7 @@ local function shellRead(history)
|
|||||||
end
|
end
|
||||||
local _,cy = term.getCursorPos()
|
local _,cy = term.getCursorPos()
|
||||||
term.setCursorPos(3, cy)
|
term.setCursorPos(3, cy)
|
||||||
|
entry.value = entry.value or ''
|
||||||
local filler = #entry.value < lastLen
|
local filler = #entry.value < lastLen
|
||||||
and string.rep(' ', lastLen - #entry.value)
|
and string.rep(' ', lastLen - #entry.value)
|
||||||
or ''
|
or ''
|
||||||
@ -635,6 +636,7 @@ local function shellRead(history)
|
|||||||
redraw()
|
redraw()
|
||||||
|
|
||||||
elseif ie.code == 'tab' then
|
elseif ie.code == 'tab' then
|
||||||
|
entry.value = entry.value or ''
|
||||||
if entry.pos == #entry.value then
|
if entry.pos == #entry.value then
|
||||||
local cline = autocomplete(entry.value)
|
local cline = autocomplete(entry.value)
|
||||||
if cline then
|
if cline then
|
||||||
@ -650,6 +652,7 @@ local function shellRead(history)
|
|||||||
|
|
||||||
else
|
else
|
||||||
entry:process(ie)
|
entry:process(ie)
|
||||||
|
entry.value = entry.value or ''
|
||||||
if entry.textChanged then
|
if entry.textChanged then
|
||||||
redraw()
|
redraw()
|
||||||
elseif entry.posChanged then
|
elseif entry.posChanged then
|
||||||
@ -666,7 +669,7 @@ local function shellRead(history)
|
|||||||
|
|
||||||
print()
|
print()
|
||||||
term.setCursorBlink( false )
|
term.setCursorBlink( false )
|
||||||
return entry.value
|
return entry.value or ''
|
||||||
end
|
end
|
||||||
|
|
||||||
local history = History.load('usr/.shell_history', 25)
|
local history = History.load('usr/.shell_history', 25)
|
||||||
|
@ -393,7 +393,7 @@ function Entry:process(ie)
|
|||||||
if not self.value or #_val(self.value) == 0 then
|
if not self.value or #_val(self.value) == 0 then
|
||||||
self.value = nil
|
self.value = nil
|
||||||
end
|
end
|
||||||
_syslog(tostring(line) .. ' ' .. tostring(self.value) .. ' ' .. tostring(self.textChanged))
|
|
||||||
self.textChanged = self.textChanged or self.value ~= line
|
self.textChanged = self.textChanged or self.value ~= line
|
||||||
self.posChanged = pos ~= self.pos
|
self.posChanged = pos ~= self.pos
|
||||||
self:updateScroll()
|
self:updateScroll()
|
||||||
|
@ -41,15 +41,15 @@ function UI.TextEntry:layout()
|
|||||||
end
|
end
|
||||||
|
|
||||||
function UI.TextEntry:setValue(value)
|
function UI.TextEntry:setValue(value)
|
||||||
self.value = value --or ''
|
self.value = value
|
||||||
self.entry:unmark()
|
self.entry:unmark()
|
||||||
self.entry.value = value --tostring(value or '')
|
self.entry.value = 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 --tostring(self.value or '') -- WHY HERE ?
|
self.entry.value = self.value -- WHY HERE ?
|
||||||
self.entry:updateScroll()
|
self.entry:updateScroll()
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -117,7 +117,6 @@ function UI.TextEntry:eventHandler(event)
|
|||||||
self.entry.value = text
|
self.entry.value = 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
|
||||||
--_syslog(tostring(self.entry.value) .. ' ' .. tostring(self.value))
|
|
||||||
self.value = self.entry.value
|
self.value = self.entry.value
|
||||||
self:draw()
|
self:draw()
|
||||||
self:emit({ type = 'text_change', text = self.value, element = self })
|
self:emit({ type = 'text_change', text = self.value, element = self })
|
||||||
|
Loading…
Reference in New Issue
Block a user