From 1ae38ea8bd6a6dd64d96ce7e5696d8197f03bd5f Mon Sep 17 00:00:00 2001 From: mbays Date: Sat, 17 Aug 2024 11:26:27 +0200 Subject: [PATCH] Terminal: Ignore ctrl on chars less than '@' Previous behaviour was to crash. --- plugins/terminal.koplugin/main.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugins/terminal.koplugin/main.lua b/plugins/terminal.koplugin/main.lua index 2d8465502..56abe7b7a 100644 --- a/plugins/terminal.koplugin/main.lua +++ b/plugins/terminal.koplugin/main.lua @@ -466,7 +466,10 @@ function Terminal:generateInputDialog() end, strike_callback = function(chars) if self.ctrl and #chars == 1 then - chars = string.char(chars:upper():byte() - ("A"):byte()+1) + local n = chars:upper():byte() - ("A"):byte()+1 + if n >= 0 then + chars = string.char(n) + end self.ctrl = false end if chars == "\n" then