From 40034743adef34cfeb026cbc129aaa8428d9eba5 Mon Sep 17 00:00:00 2001 From: mbays Date: Sat, 17 Aug 2024 12:17:01 +0200 Subject: [PATCH] Terminal: Fix handling of '\b' --- plugins/terminal.koplugin/terminputtext.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/plugins/terminal.koplugin/terminputtext.lua b/plugins/terminal.koplugin/terminputtext.lua index f2b58fa30..7cbb6c8ca 100644 --- a/plugins/terminal.koplugin/terminputtext.lua +++ b/plugins/terminal.koplugin/terminputtext.lua @@ -11,9 +11,9 @@ local logger = require("logger") local util = require("util") local esc = "\027" +local backspace = "\008" local esc_seq = { - backspace = "\008", cursor_left = "\027[D", cursor_right = "\027[C", cursor_up = "\027[A", @@ -273,8 +273,8 @@ function TermInputText:interpretAnsiSeq(text) end self:addChars(text:sub(pos, printable_ends), true, true) pos = printable_ends - elseif next_byte == "\008" then - self.charpos = self.charpos - 1 + elseif next_byte == backspace then + self:leftChar(true) end elseif self.sequence_state == "esc" then self.sequence_state = "" @@ -762,7 +762,7 @@ function TermInputText:delChar() if self.charpos == 1 then return end if self.strike_callback then - self.strike_callback(esc_seq.backspace) + self.strike_callback(backspace) return end InputText.delChar(self)