Skip to content
This repository has been archived by the owner on Apr 19, 2024. It is now read-only.

fix issue with double output on windows #458

Closed

Conversation

miniscruff
Copy link

@miniscruff miniscruff commented Oct 12, 2022

I was able to fix the double output issues on windows by removing this line, did a manual test on Ubuntu as well. My guess is this is not the best solution so let me know.

Fixes #406
Fixes #368

mislav
mislav previously requested changes Nov 21, 2022
Copy link
Collaborator

@mislav mislav left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, sorry for the late review and thanks for helping fix this. I think what this PR would need is some kind of regression test that fails without this fix being applied and will fail in the future if this regresses.

@@ -200,8 +200,6 @@ func (i *Input) Prompt(config *PromptConfig) (interface{}, error) {

lineStr := i.answer

i.AppendRenderedText(lineStr)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code gets called on all platforms and its implementation doesn't differ between platforms. Do you know how it could have caused problems only on Windows but not elsewhere?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not entirely sure what happens on windows to cause this problem, I can try and dig deeper but my only guess right now has to do with the carriage return, as it seems to render the same text twice and this was to remove the second one, which is probably totally wrong. I did do testing on Ubuntu as well and found there was no difference in outputs of my test between before and after my change. Obviously I could be missing some manual test cases so if there are more I can do let me know.

@miniscruff
Copy link
Author

miniscruff commented Nov 21, 2022

Hi, sorry for the late review and thanks for helping fix this. I think what this PR would need is some kind of regression test that fails without this fix being applied and will fail in the future if this regresses.

I was trying to add one of these but the functional tests do not run on windows (as far as I can tell from these comments: https://github.com/go-survey/survey/blob/b54ce3849e4770c86edea7108c23e8e2c89fea2b/renderer_posix_test.go#L1-L2) to begin with so it is kinda hard. If you have a suggestion for any tests let me know and I will get on it.

@mislav
Copy link
Collaborator

mislav commented Nov 21, 2022

I was trying to add one of these but the functional tests do not run on windows

Ah, you are right. I'll investigate this further with your changes as a starting point. Thank you!

@mislav mislav dismissed their stale review November 21, 2022 20:06

infeasible

@miniscruff
Copy link
Author

I was trying to add one of these but the functional tests do not run on windows

Ah, you are right. I'll investigate this further with your changes as a starting point. Thank you!

No problem, let me know if I can be of any help.

@mislav mislav mentioned this pull request Nov 24, 2022
2 tasks
@mislav
Copy link
Collaborator

mislav commented Nov 25, 2022

@miniscruff Could you please try #474?

@miniscruff
Copy link
Author

@miniscruff Could you please try #474?

That seems to have fixed the problem for me in windows terminal yes.

@miniscruff
Copy link
Author

@mislav your PR will take care of the issue so we can probably close this PR correct?

@mislav
Copy link
Collaborator

mislav commented Dec 13, 2022

Yes. Thanks for the reminder!

@mislav mislav closed this Dec 13, 2022
@miniscruff miniscruff deleted the fix-double-output-on-windows branch December 13, 2022 17:01
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Randomly duplicated output for Confirm prompt with a non default answer Duplicated prompt after enter input
2 participants