Ticket #3243 (closed defect: fixed)

Opened 10 years ago

Last modified 10 years ago

"User menu -> View manual page" doesn't do coloring

Reported by: egmont Owned by: slavazanko
Priority: minor Milestone: 4.8.13
Component: mc-core Version: master
Keywords: Cc:
Blocked By: Blocking:
Branch state: merged Votes for changeset: committed-master

Description

Press F2 (User Menu) followed by 'm' (View manual page). Enter the name of a manpage.

Notice that the manual appears monochrome, no color highlighting is used for section names and such. [I assume nroff and friends are invoked with options that they do not print those char-backspace-char (for bold) and underscore-backspace-char (for underline) sequences].

Attachments

mc-3243-user-menu-manpage-coloring.patch (1.3 KB) - added by egmont 10 years ago.
Fix

Change History

comment:1 Changed 10 years ago by egmont

On the other hand, as opposed to when viewing a manpage file with F3 (ticket #1539), the (UTF-8) accents appear correctly this time.

comment:2 Changed 10 years ago by egmont

Fix attached. Tested on Ubuntu Trusty 14.04 (man-db 2.6.7.1, groff 1.22.2). I can't tell if it works on other systems that might use different man implementations.

When the output is not a tty (which is the case here), "man" seems to ignore the pager and remove all formatting by default. The option "-P cat" is hence totally useless, but it's a nice safeguard against possible different man implementations, to make sure they don't mess up anything if they invoke the pager.

The environment variable MAN_KEEP_FORMATTING forces "man" to keep the formatting sequences for bold and underlined, even if the output is not a tty.

Last edited 10 years ago by egmont (previous) (diff)

comment:3 Changed 10 years ago by egmont

Note: the worst can happen with incompatible man implementations is that the env variable is ignored, it still produces monochrome output, and viewer's nroff mode is turned on but it has no effect then. So I don't think this patch can break anything on any system. The worst that can happen is that it doesn't fix the bug on some systems.

Last edited 10 years ago by egmont (previous) (diff)

Changed 10 years ago by egmont

Fix

comment:4 Changed 10 years ago by egmont

Patch updated to make it work on Fedora 20 too. Unlike Ubuntu, Fedora's man uses the new-style ANSI color escape sequences for bold/underline rather than the backspace-overwrite sequence. To revert to the old-style backspace-overwrite sequence which is understood by mcview, a "-c" has to be passed to *roff.

comment:5 Changed 10 years ago by slavazanko

  • Status changed from new to accepted
  • Owner set to slavazanko

comment:6 Changed 10 years ago by slavazanko

  • Branch state changed from no branch to on review
  • Milestone changed from Future Releases to 4.8.13

Created branch 3243_usmenu_view_man

Initial changeset:d3e80d0c46dd514fdda6b27215af594101f4ccb7

Review, please.

comment:7 Changed 10 years ago by andrew_b

  • Votes for changeset set to andrew_b
  • Branch state changed from on review to approved

comment:8 Changed 10 years ago by slavazanko

  • Status changed from accepted to testing
  • Votes for changeset changed from andrew_b to committed-master
  • Resolution set to fixed
  • Branch state changed from approved to merged

comment:9 Changed 10 years ago by slavazanko

  • Status changed from testing to closed
Note: See TracTickets for help on using tickets.