-
Notifications
You must be signed in to change notification settings - Fork 358
Fix prompt reset on some terminals #302
Fix prompt reset on some terminals #302
Conversation
Thanks for hunting this down. I'm going to pull it onto my windows machine and test it out now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I confirmed that Select
prompts still render correctly with this change
@@ -112,7 +112,7 @@ func (r *Renderer) resetPrompt(lines int) { | |||
terminal.EraseLine(r.stdio.Out, terminal.ERASE_LINE_ALL) | |||
// clean up what we left behind last time | |||
for i := 0; i < lines; i++ { | |||
cursor.PreviousLine(1) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If i'm following what you found, it seems like cursor.PreviousLine
method should be removed entirely since it isn't uniformly supported. I would hate for me to forget this was a problem and bring up the issue in another spot.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could either remove it entirely or leave a comment saying it is deprecated since it is not supported by all terminals. Deprecating this method would avoid having to move the module to v3, because removing the method would be a breaking change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AlecAivazis
I made a bit more testing to make sure other inputs still work properly, especially the ones using PreviousLine()
. All inputs appear to work properly for me.
PreviousLine()
still appears to be required. It is used in many other places, so I wouldn't remove it nor mark it as deprecated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if i'm missing something obvious, but I thought the whole source of this problem is that Konsole doesn't support PreviousLine
. How does it work in some situations but not in others?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Honestly I'm not sure. But if that works correctly like it is now, I would avoid removing things that may break the lib on other terminals. One hypothesis that I have and that I would need to test out would be that PreviousLine()
moves the cursor to the end of the previous line, and doesn't keep the column on Konsole.
Edit: I tested this and no, Konsole doesn't do anything with PreviousLine()
. I think it's still working because resetPrompt()
moves the cursor up anyway.
I also found the \e[F
code on wikipedia. It says "Not ANSI.SYS", which may explain why Konsole doesn't support it.
Any news? |
Hey @System-Glitch! I'm still a little uneasy about the ramifications of this change. I have a feeling more things about going to be broken in Konsole than we know because of this. Can you see if you can make this change everywhere and things stay the same? I'd like to deprecate this function at the very least so people don't end up using it in the future |
Ok I will test it out again. |
Test ResultsNote: these tests have been done on my Removing
|
To avoid breaking change. Add deprecated notice
Alright cool, thank you for being so thorough with this. Since it is a core function for the core prompts, i wanted to make sure we were certain what was going on. I think with the new deprecation notice this should be good to go. Will make one last pass and then bring it. Thanks again! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ran through the tests on my windows and mac laptop
Thanks again @System-Glitch! |
@AlecAivazis Can you tag v2.1.2 so this fix is available in a release, please? |
hey @System-Glitch - this was included in the |
@System-Glitch it seems this PR broke the |
Ok, I will look into it and try to fix it. Long list worked for me when I tested though, so I may not be able to reproduce. |
fixes #300
PreviousLine()
prints\e[1F
, which is apparently not recognized by Konsole. I didn't find this control code anywhere in VT100 and ANSI references.On the other hand,
Up()
writes\e[1A
, which works as expected. Using this makes it work perfectly in both the VSCode integrated terminal and Konsole.This would require a little bit of testing on Windows and MacOS though, but I don't expect this change to break anything.