[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[bug #64396] vim tip for using editor as manual pager frustrated by grof
From: |
G. Branden Robinson |
Subject: |
[bug #64396] vim tip for using editor as manual pager frustrated by groff 1.23.0 change |
Date: |
Sat, 8 Jul 2023 19:58:18 -0400 (EDT) |
Update of bug #64396 (project groff):
Category: None => Driver grotty
Status: None => Invalid
Assigned to: None => gbranden
Open/Closed: Open => Closed
Summary: [BUG/REGRESSION] weird charachters using vim as
manpage => vim tip for using editor as manual pager frustrated by groff 1.23.0
change
_______________________________________________________
Follow-up Comment #1:
Hi alio,
[comment #0 original submission:]
> export PAGER='/bin/bash -c "vim -MRn -c \"set buftype=nofile showtabline=0
ft=man ts=8 nomod nolist norelativenumber nonu noma\" -c \"normal L\" -c
\"nmap q :qa<CR>\"</dev/tty <(col -b)"'
>
> export VISUAL='vim'
>
> Until version 1.22.4 everything worked ok
>
> With version 1.23.0 , manpages are showed with weird 1m and 0m at the
beginning and at the end of each line
>
> Example on man groff
[...]
> With version 1.22.4 , everything works ok
I can reproduce this even with groff 1.22.4...
man man
...if I revert or comment out the patch that Debian's groff package on my
system uses.
/etc/groff/man.local:
. \" Debian: Disable the use of SGR (ANSI colour) escape sequences by
. \" grotty.
. \" commented (SGR re-enabled) by Branden, 2019-06-16 --GBR
. \" if '\V[GROFF_SGR]'' \
. \" output x X tty: sgr 0
With both (Debian's) groff 1.22.4 and a stock groff 1.23.0 install, the
following restores the behavior I think you're looking for.
$ GROFF_NO_SGR=1 man man
> I don't know if other user-cases are affected and what this bug technically
means
The technical explanation is in groff 1.23.0's NEWS file.
o The "sgr" device control command, which dynamically configured support
for ISO 6429/ECMA-48 SGR escape sequences (and restored traditional
overstriking behavior if disabled), has been removed. It took effect
only at page boundaries. grotty's "-c" command-line option and the
GROFF_NO_SGR environment variable remain supported.
One of the things you give up with this approach is the new support for
hyperlinks in groff output to terminals, including hyperlink support in man
pages.
Also from NEWS:
o The an (man) macro package can now produce clickable hyperlinks within
terminal emulators, using the OSC 8 support added to grotty(1) (see
below). The groff man(7) extension macros `UR` and `MT`, present
since 2007, expose this feature. At present the feature is disabled
by default in `man.local` pending more widespread recognition of OSC 8
sequences in pager programs. The package now recognizes a `U`
register to enable hyperlinks in any output driver supporting them.
Use a command like
printf '\033]8;;man:grotty(1)\033\\grotty(1)\033]8;;\033\\\n' | more
to check your terminal and pager for OSC 8 support. If you see
"grotty(1)" and no additional garbage characters, then you may wish to
edit "man.local" to remove the lines that disable this feature.
o The an (man) macro package supports a new macro, `MR`, intended for
use by man page cross references in preference to the font style
alternation macros historically used. Where before you would write
.BR ls (1).
or
.IR ls (1).
you should now write
.MR ls 1 .
(the third argument, typically used for trailing punctuation, is
optional). Because the macro semantically identifies a man page, it
can create a clickable hyperlink ("man:ls(1)" for the above example)
on supporting devices. Furthermore, a new string, `MF`, defines the
font to be used for setting the man page topic (the first argument to
`MR` and `TH`), permitting configuration by distributions, sites, and
users.
Inclusion of the `MR` macro was prompted by its introduction to
Plan 9 from User Space's troff in August 2020. Its purpose is to
ameliorate several long-standing problems with man page cross
references: (1) the package's lack of inherent hyperlink support for
them; (2) false-positive identification of strings resembling man page
cross references (as can happen with "exit(1)", "while(1)",
"sleep(5)", "time(0)" and others) by terminal emulators and other
programs; (3) the unwanted intrusion of hyphens into man page topics,
which frustrates copy-and-paste operations (this problem has always
been avoidable through use of the \% escape sequence, but cross
references are frequent in man pages and some page authors are
inexpert *roff users); and (4) deep divisions in man page maintenance
communities over which typeface should be used to set the man page
topic (italics, roman, or bold).
I don't know if Vim supports hyperlinks in editor buffers (and I say that even
being a Vim user). If it does, then the Vim tips community will probably want
to come up with some Vimscript to interpret SGR and OSC escape sequences (from
ISO 6429/ECMA-48), so that it can support the full set of groff man(7)
features when operating as a man pager.
_______________________________________________________
Reply to this item at:
<https://savannah.gnu.org/bugs/?64396>
_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/