Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: mason_logger is not working properly when it reaches to the end of terminal #1356

Open
payam-zahedi opened this issue Jun 19, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@payam-zahedi
Copy link

Description

When we are using choose options and cursor is in the end of the terminal screen its not working properly.

Tryed on: Windows, Linux, macOS

Steps To Reproduce

  1. try to run the following code
  2. You will see in the video above it's not properly

Screenshots

20240619_120341.mp4
@payam-zahedi payam-zahedi added the bug Something isn't working label Jun 19, 2024
@payam-zahedi
Copy link
Author

@felangel Do you have any Idea what is happening and why?

I can try to fix it if you can help me

@payam-zahedi
Copy link
Author

Probably related to #507

@payam-zahedi
Copy link
Author

I had an investigation on this

So I think the problem is related to the save cursor line and the behavior of console

it seems when the cursor is at the last line, and we save the cursor position

and after that we have some new line (scrolling) the cursor position will stay the same

Basically, cursor is not respecting the scrolling.

@felangel
Copy link
Owner

I had an investigation on this

So I think the problem is related to the save cursor line and the behavior of console

it seems when the cursor is at the last line, and we save the cursor position

and after that we have some new line (scrolling) the cursor position will stay the same

Basically, cursor is not respecting the scrolling.

Yup haven’t had time to look at how other tools overcome this problem but happy to review any PRs if you get to it first 👍

@payam-zahedi
Copy link
Author

I have some Idea.

Will make a PR

@MarkOSullivan94
Copy link

MarkOSullivan94 commented Aug 8, 2024

Also noticed this issue with mason_logger

@felangel
Copy link
Owner

@MarkOSullivan94 @payam-zahedi are you still able to reproduce with the latest version of mason_logger?

@payam-zahedi
Copy link
Author

@felangel

I can not reproduce it anymore on the example.
It seems it is fixed now.

but I will try to test it on our product to make sure about it.

Can you please give me the link of commit where you fixed it I could not find it.

@mugbug
Copy link

mugbug commented Oct 15, 2024

Also experiencing this. One workaround I've found is to clear the terminal before calling chooseOne or chooseAny. Something like this:

const clearTerminal = '\x1B[2J\x1B[0;0H';
_logger.info(clearTerminal);

@felangel
Copy link
Owner

Also experiencing this. One workaround I've found is to clear the terminal before calling chooseOne or chooseAny. Something like this:

const clearTerminal = '\x1B[2J\x1B[0;0H';
_logger.info(clearTerminal);

That would work but I'm not sure it's a good idea to delete parts of the terminal buffer without the users' permission. It might be annoying/undesirable to have important output deleted just because of the choice prompt 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants