Bug 1570182 - Escape sequences in man pages when vim is used as manpager
Summary: Escape sequences in man pages when vim is used as manpager
Keywords:
Status: NEW
Alias: None
Product: Fedora
Classification: Fedora
Component: man
Version: 31
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Orphan Owner
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2018-04-20 20:16 UTC by Sergio Losilla
Modified: 2019-11-27 18:28 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-11-27 18:15:16 UTC


Attachments (Terms of Use)

Description Sergio Losilla 2018-04-20 20:16:32 UTC
Setting vim as manpager (with MANPAGER "vim -M +MANPAGER -" per the help included in vim) does not work as expected on a fresh install of Fedora 27.

See the bug report I originally filed in vim:

https://github.com/vim/vim/issues/2823

Comment 1 Ben Cotton 2018-11-27 13:55:38 UTC
This message is a reminder that Fedora 27 is nearing its end of life.
On 2018-Nov-30  Fedora will stop maintaining and issuing updates for
Fedora 27. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora  'version' of '27'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 27 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 2 Ben Cotton 2019-10-31 20:25:13 UTC
This message is a reminder that Fedora 29 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 29 on 2019-11-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '29'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 29 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 3 Robin A. Meade 2019-11-03 06:43:40 UTC
It's still present.

WORKAROUND #1
=============
Filter out the ansi color sequences using `ansifilter`:

Instead of:

    export MANPAGER="vim -c MANPAGER -"

use:

    export MANPAGER="/bin/sh -c \"ansifilter | vim -c MANPAGER -\""

WORKAROUND #2
=============
Modify /usr/share/vim/vim81/plugin/manpager.vim


diff --git a/manpager.vim b/manpager.vim.new
index dd0d1e8..486a170 100644
--- a/manpager.vim
+++ b/manpager.vim.new
@@ -18,6 +18,9 @@ function! s:ManPager()
   " Emulate 'col -b'
   silent keepj keepp %s/\v(.)\b\ze\1?//ge
 
+  " Remove ansi sequences
+  silent keepj keepp %s/\v\e\[%(%(\d;)?\d{1,2})?[mK]//ge
+
   " Remove empty lines above the header
   call cursor(1, 1)
   let n = search(".*(.*)", "c")


I took the regex from here:
https://github.com/lambdalisue/vim-manpager/commit/65a5d0aee7fe636abb60df30287465ac0660ae43

It was just a guess, but it seems to fix the issue.

SUMMARY
=======

Probably should file an issue against upstream `vim-common` with something like the above change to `/usr/share/vim/vim81/plugin/manpager.vim` to remove the ansi color sequences.

Comment 4 Ben Cotton 2019-11-27 18:15:16 UTC
Fedora 29 changed to end-of-life (EOL) status on 2019-11-26. Fedora 29 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.

Comment 5 Sergio Losilla 2019-11-27 18:28:37 UTC
The bug is still present.


Note You need to log in before you can comment on or make changes to this bug.