From 22c1c211ef8fccd74c010c9b8837ebb57497f7cf Mon Sep 17 00:00:00 2001 From: 20kdc Date: Mon, 30 Mar 2020 19:11:50 +0100 Subject: [PATCH] Bugfix: fix 'delete' key, fix Everest KB/M matching --- code/apps/app-textedit.lua | 4 ++++ code/apps/sys-everest.lua | 11 +++++++---- code/libs/lineedit.lua | 12 ++++++++---- repository/docs/ul-linee | 4 ++++ 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/code/apps/app-textedit.lua b/code/apps/app-textedit.lua index 2bcae0d..ac9ccbe 100644 --- a/code/apps/app-textedit.lua +++ b/code/apps/app-textedit.lua @@ -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) diff --git a/code/apps/sys-everest.lua b/code/apps/sys-everest.lua index 5c100e3..b462aa0 100644 --- a/code/apps/sys-everest.lua +++ b/code/apps/sys-everest.lua @@ -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 diff --git a/code/libs/lineedit.lua b/code/libs/lineedit.lua index 393c799..6b27d11 100644 --- a/code/libs/lineedit.lua +++ b/code/libs/lineedit.lua @@ -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 diff --git a/repository/docs/ul-linee b/repository/docs/ul-linee index 13eb307..32ab10a 100644 --- a/repository/docs/ul-linee +++ b/repository/docs/ul-linee @@ -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