mirror of
https://git.shadowkat.net/izaya/OC-PsychOS2.git
synced 2024-11-25 20:48:43 -05:00
buffer history now: can't go out of bounds, can go to an empty line once you go past the most recent
This commit is contained in:
parent
0421034ff7
commit
3f82d96b8e
@ -294,9 +294,14 @@ function buffer:read(...)
|
|||||||
elseif char == "B" then -- down
|
elseif char == "B" then -- down
|
||||||
hIndex = hIndex - 1
|
hIndex = hIndex - 1
|
||||||
io.write("\27[u"..(" "):rep(buffer:len()+1))
|
io.write("\27[u"..(" "):rep(buffer:len()+1))
|
||||||
|
if hIndex == 0 then
|
||||||
|
hIndex = hIndex - 1
|
||||||
|
buffer = ""
|
||||||
|
end
|
||||||
buffer = self.history[1+#self.history-hIndex] or buffer
|
buffer = self.history[1+#self.history-hIndex] or buffer
|
||||||
pos = 1
|
pos = 1
|
||||||
end
|
end
|
||||||
|
hIndex = math.max(math.min(hIndex,#self.history),0)
|
||||||
end
|
end
|
||||||
elseif char == "\8" then
|
elseif char == "\8" then
|
||||||
if #buffer > 0 and pos <= #buffer then
|
if #buffer > 0 and pos <= #buffer then
|
||||||
|
Loading…
Reference in New Issue
Block a user