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

Section Titles #1

Closed
esage85 opened this issue Mar 10, 2024 · 8 comments
Closed

Section Titles #1

esage85 opened this issue Mar 10, 2024 · 8 comments

Comments

@esage85
Copy link

esage85 commented Mar 10, 2024

Might be a configuration issue. Any ideas?

Screenshot 2024-03-09 at 8 21 37 PM
@plp13
Copy link
Owner

plp13 commented Mar 10, 2024

It works fine for me. Both with no config file, and modernity.conf.

Could you provide:

  • your version of man/apropos
  • the name and version of your terminal
  • your locale settings
  • the offending man page file: rsync.1.gz

@esage85
Copy link
Author

esage85 commented Mar 10, 2024

Man/Apropos 2.9.4
Terminal 2.1.4 (macOS) / qterminal 1.2.0 (devuan)

LANG="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL=
rsync.1.gz

@plp13
Copy link
Owner

plp13 commented Mar 10, 2024

I tried it with your manpage file, and qterminal 1.4. It works as expected, in Linux.

I have a suspicion:

Qman does not parse manual pages by itself. Rather, it uses the rendered output of GNU man, parsing the escape codes to figure out whether a portion of the text is bold, underlined, etc.

For example, GNU man typically adds \e[1m before a heading to make the text bold, and \e[0m after it to restore it to normal. The function man() in program.c sees this and marks it in a bitmap (specifically, member bold of structure line_t, defined in program.h). This bitmap is then used in tui.c to render the heading text as bold using libcursesw.

My suspicion is that MacOS man doesn't produce the exact same output as GNU man does, and this breaks the whole process.

Is it possible to install GNU man on MacOS? If so, you can tell Qman to use it by adding the following to your config file:

[misc]
man_path=/path/to/GNU/man
apropos_path=/path/to/GNU/apropos
whatis_path=/path/to/GNU/whatis

@esage85
Copy link
Author

esage85 commented Mar 10, 2024 via email

@plp13
Copy link
Owner

plp13 commented Mar 10, 2024

Sorry, I didn't realise you were on Linux. Nevertheless, it looks like my suspicion was correct.

Look at the output of MAN_KEEP_FORMATTING=1 /usr/bin/man ls | hexdump -C | head -n 20 in Arch:

00000000  0a 1b 5b 34 6d 4c 53 1b  5b 32 34 6d 28 31 29 20  |..[4mLS.[24m(1) |
00000010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000040  20 20 20 20 20 20 55 73  65 72 20 43 6f 6d 6d 61  |      User Comma|
00000050  6e 64 73 20 20 20 20 20  20 20 20 20 20 20 20 20  |nds             |
00000060  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000080  20 20 20 20 20 20 20 20  20 1b 5b 34 6d 4c 53 1b  |         .[4mLS.|
00000090  5b 32 34 6d 28 31 29 0a  0a 1b 5b 31 6d 4e 41 4d  |[24m(1)...[1mNAM|
000000a0  45 1b 5b 30 6d 0a 20 20  20 20 20 20 20 6c 73 20  |E.[0m.       ls |
000000b0  2d 20 6c 69 73 74 20 64  69 72 65 63 74 6f 72 79  |- list directory|
000000c0  20 63 6f 6e 74 65 6e 74  73 0a 0a 1b 5b 31 6d 53  | contents...[1mS|
000000d0  59 4e 4f 50 53 49 53 1b  5b 30 6d 0a 20 20 20 20  |YNOPSIS.[0m.    |
000000e0  20 20 20 1b 5b 31 6d 6c  73 20 1b 5b 32 32 6d 5b  |   .[1mls .[22m[|
000000f0  1b 5b 34 6d 4f 50 54 49  4f 4e 1b 5b 32 34 6d 5d  |.[4mOPTION.[24m]|
00000100  2e 2e 2e 20 5b 1b 5b 34  6d 46 49 4c 45 1b 5b 32  |... [.[4mFILE.[2|
00000110  34 6d 5d 2e 2e 2e 0a 0a  1b 5b 31 6d 44 45 53 43  |4m]......[1mDESC|
00000120  52 49 50 54 49 4f 4e 1b  5b 30 6d 0a 20 20 20 20  |RIPTION.[0m.    |
00000130  20 20 20 4c 69 73 74 20  20 69 6e 66 6f 72 6d 61  |   List  informa|
00000140  74 69 6f 6e 20 20 61 62  6f 75 74 20 20 74 68 65  |tion  about  the|

Now, look at the same output in Ubuntu server (which I suppose is very close to Debian):

00000000  4c 53 28 31 29 20 20 20  20 20 20 20 20 20 20 20  |LS(1)           |
00000010  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000030  20 20 20 20 20 20 20 20  20 20 20 20 55 73 65 72  |            User|
00000040  20 43 6f 6d 6d 61 6e 64  73 20 20 20 20 20 20 20  | Commands       |
00000050  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 20  |                |
*
00000070  20 20 20 20 20 20 20 20  20 20 20 20 20 20 20 4c  |               L|
00000080  53 28 31 29 0a 0a 4e 08  4e 41 08 41 4d 08 4d 45  |S(1)..N.NA.AM.ME|
00000090  08 45 0a 20 20 20 20 20  20 20 6c 73 20 2d 20 6c  |.E.       ls - l|
000000a0  69 73 74 20 64 69 72 65  63 74 6f 72 79 20 63 6f  |ist directory co|
000000b0  6e 74 65 6e 74 73 0a 0a  53 08 53 59 08 59 4e 08  |ntents..S.SY.YN.|
000000c0  4e 4f 08 4f 50 08 50 53  08 53 49 08 49 53 08 53  |NO.OP.PS.SI.IS.S|
000000d0  0a 20 20 20 20 20 20 20  6c 08 6c 73 08 73 20 5b  |.       l.ls.s [|
000000e0  5f 08 4f 5f 08 50 5f 08  54 5f 08 49 5f 08 4f 5f  |_.O_.P_.T_.I_.O_|
000000f0  08 4e 5d 2e 2e 2e 20 5b  5f 08 46 5f 08 49 5f 08  |.N]... [_.F_.I_.|
00000100  4c 5f 08 45 5d 2e 2e 2e  0a 0a 44 08 44 45 08 45  |L_.E].....D.DE.E|
00000110  53 08 53 43 08 43 52 08  52 49 08 49 50 08 50 54  |S.SC.CR.RI.IP.PT|
00000120  08 54 49 08 49 4f 08 4f  4e 08 4e 0a 20 20 20 20  |.TI.IO.ON.N.    |
00000130  20 20 20 4c 69 73 74 20  20 69 6e 66 6f 72 6d 61  |   List  informa|

Totally different. And it looks like it matches your screenshot.

@plp13
Copy link
Owner

plp13 commented Mar 10, 2024

OK, I found something relevant here.

Can you tell me if this works?

GROFF_SGR=1 qman rsync

@esage85
Copy link
Author

esage85 commented Mar 10, 2024

Yes, that works thank you :)

plp13 pushed a commit that referenced this issue Mar 11, 2024
plp13 pushed a commit that referenced this issue Mar 11, 2024
@plp13
Copy link
Owner

plp13 commented Mar 11, 2024

I modified program.c so that GROFF_SGR is set to 1 and GROFF_NO_SGR is unset before running man. This should fix the issue.

@plp13 plp13 closed this as completed Mar 11, 2024
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