Jarvis icon indicating copy to clipboard operation
Jarvis copied to clipboard

Cannot backspace over lines in commands

Open Matthew237 opened this issue 6 years ago • 2 comments

While testing a new translation feature, I input a longer sentence to translate that resulted in the cursor moving onto the next line. I realised I had made a mistake and tried to backspace but it would not let me go back across the line break.

Not 100% sure how to fix this but I could look into it.

Steps to reproduce:

  1. Type in any sequence of letters (doesn't matter what, it can be gibberish).
  2. Keep typing until you get to a new line.
  3. Try to backspace back onto the first line.
  4. It won't let you

I'm running Jarvis on Ubuntu 18.04

Matthew237 avatar Jul 19 '19 23:07 Matthew237

Thanks for reporting this bug!

Did some testing and should be fixed with this one-line patch:

diff --git a/jarviscli/Jarvis.py b/jarviscli/Jarvis.py
index e1522ed..0d15974 100644
--- a/jarviscli/Jarvis.py
+++ b/jarviscli/Jarvis.py
@@ -48,7 +48,7 @@ class Jarvis(CmdInterpreter, object):
                  prompt=prompt, first_reaction=True, enable_voice=False,
                  directories=["jarviscli/plugins", "custom"]):
         directories = self._rel_path_fix(directories)
-        self.use_rawinput = False
+        self.use_rawinput = True
         CmdInterpreter.__init__(self, first_reaction_text, prompt,
                                 directories, first_reaction, enable_voice)

But this again might break color on some terminals (e.g. windows) - which was, the reason I added self.use_rawinput = False in the first place. Didn't notice this had such unwanted side-effects.

=> I'll need to do some investigation how to best read input, but I think this issue can be fixed quite easily.

pnhofmann avatar Jul 21 '19 08:07 pnhofmann

This fix doesn't break colour on my terminal but it does cause a different bug unfortunately. Now instead of going on to a second line when I reach the end of the first, the cursor starts at the beginning of the first line again and overwrites the characters on the first line. It will let me backspace but it goes up a line when it reaches the start of the first line again and allows me to delete some of the Jarvis prompt from the line above. How much it allows me to delete depends on how much of the first line I overwrite by typing a second.

I'll have a look into it and see if I can work out what might be going wrong.

Matthew237 avatar Jul 23 '19 05:07 Matthew237