From d097dc0f8c00d39b02be6b046199baf5033c120a Mon Sep 17 00:00:00 2001 From: mbays Date: Sat, 24 Aug 2024 17:14:30 +0200 Subject: [PATCH] Terminal: Add newline when wrapping Required to maintain "tty-matrix". --- plugins/terminal.koplugin/terminputtext.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/terminal.koplugin/terminputtext.lua b/plugins/terminal.koplugin/terminputtext.lua index b0be60286..dd47e8fef 100644 --- a/plugins/terminal.koplugin/terminputtext.lua +++ b/plugins/terminal.koplugin/terminputtext.lua @@ -546,7 +546,8 @@ function TermInputText:addChars(chars, skip_callback, skip_table_concat) if self.charlist[self.charpos] == "\n" then self.charpos = self.charpos + 1 if not self.charlist[self.charpos] then - insertSpaces(self.maxc) + local p = insertSpaces(self.maxc) + table.insert(self.charlist, p, "\n") end end else @@ -598,7 +599,6 @@ end -- @param maxr number of rows -- @param maxc number of columns -- @param clear if true, fill the matrix ' ' --- @fixme: may invalidate store_pos_dec and store_pos_sco function TermInputText:formatTerminal(clear) local i = self.store_position or 1 -- so we end up in a maxr x maxc array for positioning