From b924f38dc0edb3de41e7cbf1df8627aef6c1c8b3 Mon Sep 17 00:00:00 2001 From: zwim <36999612+zwim@users.noreply.github.com> Date: Sun, 30 Jan 2022 09:25:35 +0100 Subject: [PATCH] Terminal emulator: fix elinks 'q' crash (#8749) This fixes a crash in terminal emulator on exit of elinks. see: https://github.com/koreader/koreader/pull/8636#issuecomment-1024956177 --- plugins/terminal.koplugin/terminputtext.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/plugins/terminal.koplugin/terminputtext.lua b/plugins/terminal.koplugin/terminputtext.lua index 0cc76d8cd..79b93e005 100644 --- a/plugins/terminal.koplugin/terminputtext.lua +++ b/plugins/terminal.koplugin/terminputtext.lua @@ -124,6 +124,7 @@ function TermInputText:saveBuffer(buffer) { self.charlist, self.charpos, + self.store_pos_dec, self.store_pos_sco, self.store_position, self.scroll_region_bottom, @@ -147,6 +148,7 @@ function TermInputText:restoreBuffer(buffer) if type(former_buffer[1]) == "table" then self.charlist, self.charpos, + self.store_pos_dec, self.store_pos_sco, self.store_position, self.scroll_region_bottom, @@ -546,7 +548,7 @@ function TermInputText:addChars(chars, skip_callback, skip_table_concat) if self.charlist[self.charpos] == "\n" then self.charpos = self.charpos - 1 end - while self.charpos >=1 and self.charlist[self.charpos] ~= "\n" do + while self.charpos >= 1 and self.charlist[self.charpos] ~= "\n" do self.charpos = self.charpos - 1 end self.charpos = self.charpos + 1 @@ -813,7 +815,7 @@ function TermInputText:goToStartOfLine(skip_callback) if self.charlist[self.charpos] == "\n" then self.charpos = self.charpos - 1 end - while self.charpos >=1 and self.charlist[self.charpos] ~= "\n" do + while self.charpos >= 1 and self.charlist[self.charpos] ~= "\n" do self.charpos = self.charpos - 1 end self.charpos = self.charpos + 1