stup icon indicating copy to clipboard operation
stup copied to clipboard

stup is incompatible with most viewer

Open ghost opened this issue 4 years ago • 10 comments

Is this correct output?

pon, 9 lis 2020, 16:29:04 CET
[38;5;248mDisplaying notes from(B[m [32mponiedziałek listopada 02, 2020(B[m [38;5;248mto(B[m [32mniedziela listopada 08, 2020(B[m

Date:      [1m[32mponiedziałek listopada 02, 2020(B[m(B[m
Category:  [33mplany(B[m

           • Nauka matematyki.

Date:      [1m[32mwtorek listopada 03, 2020(B[m(B[m
Category:  [33mplany(B[m

           • Nauka matematyki.
           • Kopia zapasoawa.
           • Certyfikat BHP do biblioteki.
           • Instrukcja laborki z fizyki.

Date:      [1m[32mśroda listopada 04, 2020(B[m(B[m
Category:  [33mdziałania(B[m

           • 17:46:27 Jedzenie pizzy Gusepe.
           • 18:29:10 Nauka matematyki.
           • 20:17:34 Nauka fizyki.

Category:  [33mplany(B[m

           • Nauka matematyki: 18:00-20:00.
           • Nauka fizyki: 20:00-21:15.

Date:      [1m[32mczwartek listopada 05, 2020(B[m(B[m
Category:  [33mdziałania(B[m

           • 17:45:00 Nauka fizyki.
           • 19:00:01 Mycie szklanego stołu. Porządkowanie dokumentów samochodu. Zamawianie koszulek na materiały do nauki.
           • 20:21:00 Aktualizacja Podstawowe Zabezpieczenie Stacji Roboczych Linux Debian.

Category:  [33mplany(B[m

           • 17:00 Konsultacje.
           • 17:30-19:00 Nauka fizyki.
           • 19:20-21:20 Aktualizacja Podstawowe Zabezpieczenie Stacji Roboczych Linux Debian.

Date:      [1m[32mniedziela listopada 08, 2020(B[m(B[m
Category:  [33mplany(B[m

           • Lab. z fizyki: ćw. Torsje.

Explanation:

Date: is followed by spaces and rubbish: [1m[32m

Date line is ended with rubbish: (B[m(B[m

Category: is followed by rubbish: [33m

Category line is followed by rubbish: (B[m(B[m

ghost avatar Nov 09 '20 15:11 ghost

Stup is intended to be used directly from the terminal, and it doesn't change its output when you redirect it to a file. The spaces are to nicely align the date & category, the 'rubbish' is for colouring text. You can filter it out with a sed script (I don't have it anymore).

ghost avatar Nov 09 '20 15:11 ghost

Don't get me wrong. In true in hury I paste wrong artifacts, but problem exists. I use the most text viewer:

/home/energokoder/.config/stup.conf

categories_root=/home/energokoder/stup
default_category=personal
stup_editor=mcedit
default_command=show
default_show_at=yesterday
default_add_at=today
default_edit_at=today
default_copy_from=yesterday
default_copy_to=today
pager=most

The stup month result:

image

Explanation: You can see in many places: ^[(B^[(B artifacts...

ghost avatar Nov 09 '20 20:11 ghost

Try running tput sgr0, I'm interested in the output.

Maybe also tput sgr0 | most

ghost avatar Nov 10 '20 06:11 ghost

image

ghost avatar Nov 10 '20 15:11 ghost

Yeah, so that's it. Does it do the same when you run it w/o most, i.e. just tput sgr0?

The correct behaviour should be that it 'prints nothing' (actually it should print just an escape sequence, but that's invisible from the view of the user)

ghost avatar Nov 10 '20 15:11 ghost

image

ghost avatar Nov 10 '20 17:11 ghost

Then I think you should report this to most, it seems it messes up the terminfo (maybe they'll tell you it's a bug in tput, I don't know where exactly it happens)

FYI, I can reproduce this tput sgr0 | most bug with Alacritty as the terminal

Edit: oh wait, but it's kind of weird, coz the variable is assigned long before forwarding output to most, but also there's no such problem when I echo -e '\e[0m' | most

@iridakos do you have any idea what's happening here?

ghost avatar Nov 10 '20 19:11 ghost

So I was finally able to find out what tput sgr0 actually prints — it's \e(B\e[m. When I echo -e that, it just resets the text properties, but when I pipe it to most, the first part is changed.

Check if most has any config regarding this, or if you should report it to them.

ghost avatar Nov 11 '20 09:11 ghost

Given that @EnergoKoder hasn’t responded for a week & that on our side it’s resolved, can this issue be closed now?

ghost avatar Nov 20 '20 07:11 ghost

I reported issue to author of most, but email mentioned in man was outdated. Can't deiivery message contains other email. I send report, but with out any response so far.

In my opinion you can close this issue...

ghost avatar Nov 21 '20 09:11 ghost