File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -209,18 +209,19 @@ def echo_print(self):
209209 # line_count += 1
210210 # moveback = terminal.ANSIControl.cursor.next_line(line_count)
211211
212- # execute all the things ;-)
213- print (
212+ text = (
214213 "{move}"
215214 "{line}"
216215 "{moveback}"
217216 "" .format (
218217 move = move ,
219218 line = line ,
220219 moveback = moveback ,
221- ),
222- end = "" ,
220+ )
223221 )
222+ print ("\n \n \n \n \n \n {}\n \n \n \n \n \n " .format (repr (text )))
223+ # execute all the things ;-)
224+ print (text , end = "" )
224225
225226 def print (self , * args ):
226227 # def print(self, *args, end="\n"):
@@ -299,6 +300,14 @@ def _buffer_check_and_handle_line_ends(self):
299300 else :
300301 self .input_buffer = ""
301302
303+ def _buffer_handle_backspace (self ):
304+ if "\x08 " in self .input_buffer :
305+ while (pos := self .input_buffer .find ("\x08 " )) > - 1 :
306+ # strip character before backspace and backspace itself.
307+ self .input_buffer = (
308+ self .input_buffer [: pos - 1 ] + self .input_buffer [pos + 1 :]
309+ )
310+
302311 def input (self ):
303312 """
304313 Input.
@@ -326,6 +335,7 @@ def update(self):
326335 while available :
327336 raw = self .serial .read (available )
328337 self .input_buffer += raw .decode (self .encoding )
338+ self ._buffer_handle_backspace ()
329339 if self .echo :
330340 # self.serial.write(raw)
331341 self .echo_print ()
You can’t perform that action at this time.
0 commit comments