「ほとんどの」ページャが標準入力の色を正しく処理できるようにします。

「ほとんどの」ページャが標準入力の色を正しく処理できるようにします。

most標準入力から受け取ったテキストの色をポケットベルに正しく表示させるにはどうすればよいですか。

注:これが正しいかどうかはわかりませんmost

less私はと同じ問題を抱えていません。とmore同じ問題mostしかありませんman

私は画像を投稿せず、人々にこれを試すように招待しません(すでにインストールしているmost場合のみ)。

$ command apropos zip | command grep --color=always zip | command less
$ command apropos zip | command grep --color=always zip | command more
$ command apropos zip | command grep --color=always zip | command most

lessすべての色テキスト領域を囲む追加の「ガベージ」を使用して、色を表示しながらmore色を正しく表示します。most^[[K

驚くべきことに、次のように動作します。

$ (export PAGER=most; command man zip)

私が何かを見逃しているか(manページはmost役に立ちません)、コマンドを誤って使用していますか、それともバグとして報告する必要がありますか?

less(更新)に関する注意事項:

Sparhawkがコメントで述べたように、lessオプション(または)または(または)が指定されていない場合は効果がなく、環境変数でも設定できます。-R--RAW-CONTROL-CHARS-r--raw-control-charsLESS

実際、似たようなオプションを最初に検索してみましたが、見つかりませmostんでした。

修正する

これらはすべてUTF-8でエンコードされたカラーテキストに問題がありますmost。私の場合、端末は動作するため、端末ではありません。色付けされていない同じUTF-8テキストは、3つのページャの両方で機能するため、これは文字エンコーディングではありません。

ベストアンサー1

man grep 2>/dev/null | 
GREP_COLORS=$(man grep 2>/dev/null | 
grep '^ *ms=01;31' -m1):ne \
grep '^ *GREP_COLORS *$\|^ *ne ' -A9 --color=always | 
most

私のために動作します。ところで、mostこの問題を解決するためにインストールしたのですが、本当に気に入ります。ありがとうございます。

   GREP_COLORS
          Specifies  the  colors  and other attributes
          used  to  highlight  various  parts  of  the
          output.  Its value is a colon-separated list
          of    capabilities    that    defaults    to
          ms=01;31:mc=01;31:sl=:cx=:fn=35:ln=32:bn=32:se=36
          with the  rv  and  ne  boolean  capabilities
          omitted     (i.e.,     false).     Supported
          capabilities are as follows.

          ne     Boolean  value that prevents clearing
                 to the end of  line  using  Erase  in
                 Line  (EL) to Right (\33[K) each time
                 a  colorized  item  ends.   This   is
                 needed  on  terminals  on which EL is
                 not  supported.   It   is   otherwise
                 useful  on  terminals  for  which the
                 back_color_erase    (bce)     boolean
                 terminfo  capability  does not apply,
                 when the chosen highlight  colors  do
         ...

おすすめ記事