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

Moar modifies prompt characters #258

Open
kalocsaibotond opened this issue Dec 3, 2024 · 5 comments
Open

Moar modifies prompt characters #258

kalocsaibotond opened this issue Dec 3, 2024 · 5 comments

Comments

@kalocsaibotond
Copy link

kalocsaibotond commented Dec 3, 2024

I tried out moar in (void) linux console with moar hello.sh and for some reason it modifies the characters of the prompt:
moar_console_bug PNG
Interestingly eza or lsresets the prompt characters.

For curiosity, I tried out bat with moar as pager I also get a similar but different prompt character modification:
moar_bat_console_bug PNG
In console eza or ls resets the characters.
For bat export BAT_PAGER='moar -no-linenumbers -quit-if-one-screen .

The latter moar bat behaviour is also present in simple terminal:
moar_bat_st_bug PNG
However only eza resets the character.

For the same use cases, less do not present these behaviours.

On windows 10 and 11, in the latest WezTerm, I experience the same behaviour with bat, when the content is smaller than one screen.

@walles
Copy link
Owner

walles commented Dec 3, 2024

  1. Can you do moar --trace hello.sh, reproduce the problem and post the trace output here?
  2. What terminal are you using when you reproduce this?
  3. How do you exit moar? By pressing q? Pressing ESC? Something else?

@kalocsaibotond
Copy link
Author

kalocsaibotond commented Dec 3, 2024

  1. Can you do moar --trace hello.sh, reproduce the problem and post the trace output here?

The result of moar --trace hello.sh :
moar_console_bug_trace

  1. What terminal are you using when you reproduce this?

I made the first and second image in my description, in the default linux console of Void Linux (base 2024-03-14) . I made third image was in the suckless Simple Terminal . I also made the above image in the default linux console .

  1. How do you exit moar? By pressing q? Pressing ESC? Something else?

I used the 'q' button. Though trying the 'ESC' also yields the same result.

@walles
Copy link
Owner

walles commented Dec 5, 2024

I made the first and second image in my description, in the default linux console of Void Linux (base 2024-03-14)

I downloaded void-live-x86_64-20240314-xfce.iso and launched it in Virtualbox.

Then I started the default (XFCE) terminal and made a hello.sh script like yours.

I opened that in moar v1.28.2. When I press q, the terminal gets restored to the state it had before I launched moar, so no repro.

I then tried xbps-install st and tried the same thing in st.

Same thing though, no repro.

So the question now is how your system is different from mine?

Here's my hello.sh:

#!/bin/bash

echo "hello world!"

@walles
Copy link
Owner

walles commented Dec 6, 2024

  1. Are you running something like tmux, screen or ct that could affect moar's behavior?
  2. Do you have any terminal settings that could affect moar's behavior?

In your image (see below), moar exits, but moar's UI is still there right before the prompt.

This is weird, since moar uses the Alternative Screen for all its drawing. When moar exits it switches back.

Switching back should at least make moar's UI disappear before moar terminates.

If the alternate screen implementation in the terminals where you reproduced this was broken, that could explain it, but:

  • You tried with two different terminals. Both of them failing to implement altscreen seems unlikely.
  • I tried with the same terminals, and the problems didn't appear for me

moar_console_bug PNG

@kalocsaibotond
Copy link
Author

kalocsaibotond commented Dec 8, 2024

  1. Are you running something like tmux, screen or ct that could affect moar's behavior?
  2. Do you have any terminal settings that could affect moar's behavior?

In your image (see below), moar exits, but moar's UI is still there right before the prompt.

This is weird, since moar uses the Alternative Screen for all its drawing. When moar exits it switches back.

Switching back should at least make moar's UI disappear before moar terminates.

If the alternate screen implementation in the terminals where you reproduced this was broken, that could explain it, but:

  • You tried with two different terminals. Both of them failing to implement altscreen seems unlikely.
  • I tried with the same terminals, and the problems didn't appear for me

moar_console_bug PNG

No, my setup for the first bug is the simplest possible:

  1. I downloaded the void live image void-live-x86_64-20240314-base.iso.
  2. I started it on a Qemu virtual machine.
  3. I synchronised the xbps repository index.
  4. I installed moar and used it on a file.
  5. I did not use anything apart from the vanilla linux console (no tmux, no screen, no ct, no xorg, no wayland, no etc..) to view a file with moar!

The second bug requires bat and the presence of

export BAT_PAGER='moar -no-linenumbers -quit-if-one-screen'

environment variable. It is also reproducible with the pure base void live image if moar, bat is installed and BAT_PAGER environment variable is set. This can be induced by viewing a file with bat like bat hello.sh .

However, unlike the first bug, it is reproducible outside the linux console. So far I reproduced it in st and WezTerm. Here is the reproduction of the bug with bat on Windows 11 (Powershell 7.4.6), in WezTerm (wezterm 20240203-110809-5046fc22):
moar_bat_wezterm_bug PNG

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants