kovidgoyal / kitty

Cross-platform, fast, feature-rich, GPU based terminal
https://sw.kovidgoyal.net/kitty/
GNU General Public License v3.0
24.66k stars 989 forks source link

Man page "Tabs" table is malformatted. #5095

Closed mobotsar closed 1 year ago

mobotsar commented 2 years ago

Describe the bug Parts of the table meant to contain info in the "Tabs" section are somehow malformed. When viewing from within kitty, it's transposed downward into "Windows" and overlapping content in that section. When viewing in gnome-terminal (and other vte terminals such as tilix), they appear to be missing altogether.

To Reproduce Just run man kitty.

Environment details

kitty 0.25.0 created by Kovid Goyal
Linux fedora 5.17.7-300.fc36.x86_64 #1 SMP PREEMPT Thu May 12 14:56:44 UTC 2022 x86_64
S
Kernel 5.17.7-300.fc36.x86_64 on an x86_64 (/dev/tty)

Running under: Wayland
Frozen: False
Paths:
  kitty: /usr/bin/kitty
  base dir: /usr/lib64/kitty
  extensions dir: /usr/lib64/kitty/kitty
  system shell: /usr/bin/zsh

Config options different from defaults:

Important environment variables seen by the kitty process:
    PATH                                /usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin
    LANG                                en_US.UTF-8
    EDITOR                              /home/al/.local/bin/nvim
    SHELL                               /usr/bin/zsh
    DISPLAY                             :0
    WAYLAND_DISPLAY                     wayland-0
    USER                                al
    XDG_MENU_PREFIX                     gnome-
    XDG_SESSION_DESKTOP                 gnome
    XDG_SESSION_TYPE                    wayland
    XDG_CURRENT_DESKTOP                 GNOME
    XDG_SESSION_CLASS                   user
    XDG_RUNTIME_DIR                     /run/user/1000
    XDG_DATA_DIRS                       /home/al/.local/share/flatpak/exports/share:/var/lib/flatpak/exports/share:/usr/local/share/:/usr/share/

Additional context This is with no configuration specified, i.e. the bug is reproducible immediately after installing kitty.

Screenshots Gnome Terminal: image Kitty: image

kovidgoyal commented 2 years ago

Use a decent man pager. Here is how it looks on my system. screenshot

Here is the script I use as a manpager

#!/usr/bin/env python3

import os

# Blink -> Bold + GREEN
os.environ['LESS_TERMCAP_mb'] = "\033[1;32m"
# Bold -> Bold + CYAN
os.environ['LESS_TERMCAP_md'] = "\033[1;36m"
# Reset all attributes
os.environ['LESS_TERMCAP_me'] = "\033[0m"
# Standout -> Bold + yellow on blue
os.environ['LESS_TERMCAP_so'] = "\033[1;33;44m"
# End standout
os.environ['LESS_TERMCAP_se'] = "\033[22;39;49m"
# Underline -> Italic + red
os.environ['LESS_TERMCAP_us'] = "\033[3;31m"
# End underline
os.environ['LESS_TERMCAP_ue'] = "\033[23;39m"
# Dim mode
os.environ['LESS_TERMCAP_mh'] = "\033[90m"

os.execlp('less', 'less', '-R')
mobotsar commented 2 years ago

I get that man pages are lower priority, but I shouldn't need to reconfigure my environment and know the exact ANSI code magic of your system to get a man page to render. This behavior is the out-of-the-box experience (with less) and persists with more, bat, and most, all of which are "decent" pieces of software — it seems like something worth addressing.

kovidgoyal commented 2 years ago

I am afraid I have no interest in degrading the man pages to conform to whatever broken out-of-the-box experience the default less provides.

Simply using less -R

as your manpager is sufficient.

And, these arent "custom ANSI codes specific to my system". They are standard ANSI codes respected by 99% of terminals out there. Use them or your own preferences, or use the HTML documentation instead.

meowcoder commented 1 year ago

To fix the table borders I changed center; to box center; and removed the vertical and horizontal rules (lines) that were used as the table borders.

diff ```diff --- share/man/man1/kitty.1 2023-09-18 07:18:38.847064000 +0500 +++ kitty.1 2023-09-25 18:17:24.148771202 +0500 @@ -189,9 +189,8 @@ window manager. The keyboard controls (which are \fI\%all customizable\fP) for tabs and windows are: .SS Scrolling .TS -center; -|l|l|. -_ +box center; +l|l. T{ Action T} T{ @@ -257,7 +256,6 @@ T} T{ \fI\%ctrl+shift+g\fP (see \fI\%Shell integration\fP) T} -_ .TE .sp The scroll actions only take effect when the terminal is in the main screen. @@ -266,9 +264,8 @@ terminal. .SS Tabs .TS -center; -|l|l|. -_ +box center; +l|l. T{ Action T} T{ @@ -322,13 +319,11 @@ T} T{ \fI\%ctrl+shift+alt+t\fP (also \fB⇧+⌘+i\fP on macOS) T} -_ .TE .SS Windows .TS -center; -|l|l|. -_ +box center; +l|l. T{ Action T} T{ @@ -408,7 +403,6 @@ (also \fB⌘+1\fP, \fB⌘+2\fP ... \fB⌘+9\fP on macOS) (clockwise from the top\-left) T} -_ .TE .sp Additionally, you can define shortcuts in \fBkitty.conf\fP to focus @@ -501,9 +495,8 @@ The full list of actions that can be mapped to key presses is available \fI\%here\fP\&. .TS -center; -|l|l|. -_ +box center; +l|l. T{ Action T} T{ @@ -635,7 +628,6 @@ T} T{ \fI\%ctrl+shift+a>d\fP T} -_ .TE .SH SEE ALSO .sp ```

The table borders were messed up in foot as well, in both terminals which tables were rendered incorrectly depended on the window size, with certain sizes everything was okay. After the fix no problems in either terminal with any window size.

kitty

And to add colors I had to export GROFF_NO_SGR=1.

kovidgoyal commented 1 year ago

GROFF_NO_SGR is required now because of groff 1.23.0 disabling the sgr device output control. https://groups.google.com/g/linux.debian.bugs.dist/c/kC77yp3mL4M

As for the table formatting, it might be worth reporting the issue upstream to sphinx which is what kitty uses to build the man pages.

kovidgoyal commented 1 year ago

Upstream bug report: https://sourceforge.net/p/docutils/bugs/475/