1
0
mirror of https://github.com/20kdc/OC-KittenOS.git synced 2024-12-25 10:28:06 +11:00

Bugfix: fix 'delete' key, fix Everest KB/M matching

This commit is contained in:
20kdc 2020-03-30 19:11:50 +01:00
parent 7840f0a231
commit 22c1c211ef
4 changed files with 23 additions and 8 deletions

View File

@ -273,6 +273,10 @@ local function key(ks, kc, down)
cursorY = cursorY - 1
cursorX = unicode.len(lines[cursorY]) + 1
lines[cursorY] = lines[cursorY] .. l
elseif lX == "w>" and cursorY ~= #lines then
local l = table.remove(lines, cursorY)
cursorX = unicode.len(l) + 1
lines[cursorY] = l .. lines[cursorY]
elseif lX == "nl" then
local line = lines[cursorY]
lines[cursorY] = unicode.sub(line, 1, cursorX - 1)

View File

@ -600,13 +600,16 @@ end
local isAltDown = false
local isCtrDown = false
local function key(ku, ka, kc, down)
local ku = screens.getMonitorByKeyboard(ku)
if not ku then return end
local ku, lin = screens.getMonitorByKeyboard(ku)
for k, v in ipairs(monitors) do
if v[2] == mu then
lIM = k
if ku and v[2] == ku then
lin = k
break
end
end
if not lin then return end
lIM = lin
local focus = surfaces[1]
if kc == 29 then isCtrDown = down end
if kc == 56 then isAltDown = down end

View File

@ -31,6 +31,7 @@ return {
key = function (ks, kc, line, cursorX)
local cS = unicode.sub(line, 1, cursorX - 1)
local cE = unicode.sub(line, cursorX)
local ll = unicode.len(line)
if kc == 203 then -- navi <
if cursorX > 1 then
return nil, cursorX - 1
@ -39,7 +40,6 @@ return {
return nil, nil, "l<"
end
elseif kc == 205 then -- navi >
local ll = unicode.len(line)
if cursorX > ll then
-- cline overflow
return nil, nil, "l>"
@ -49,14 +49,18 @@ return {
return nil, 1
elseif kc == 207 then -- end
return nil, unicode.len(line) + 1
elseif ks == "\8" or kc == 211 then -- del
elseif ks == "\8" then -- del
if cursorX == 1 then
-- weld prev
return nil, nil, "w<"
else
cS = unicode.sub(cS, 1, unicode.len(cS) - 1)
return cS .. cE, cursorX - 1
return unicode.sub(cS, 1, unicode.len(cS) - 1) .. cE, cursorX - 1
end
elseif kc == 211 then -- del
if cursorX > ll then
return nil, nil, "w>"
end
return cS .. unicode.sub(cE, 2)
elseif ks then -- standard letters
if ks == "\r" then
-- new line

View File

@ -65,6 +65,10 @@ The following extended actions exist:
the previous line, and the cursor
should be placed at the weld point.
"w>": This line should be welded to
the next line, and the cursor
should be placed at the weld point.
"nl": The Enter button was pressed.
-- This is released into