在tmux(v1.8) 中,将less(v458) 与包含比终端宽度更长的行的管道或文件一起使用已开始在 Ubuntu 上给我带来问题。
寻呼机最初滚动到第一行之外,而不是从顶部开始。当我尝试向后滚动时,来自不同行的字符一起运行到一个块中,没有换行符。
有时候,像翻页(命令b或<C-b>)出现跳过去的文件的末尾,留下了一堆在底线的:
some-line
another-line
last-line-in-file
~
~
~
~
~
(END)
Run Code Online (Sandbox Code Playgroud)
从那里,寻呼机永远无法向上滚动。
我之前我想通了这一点成品发帖:我曾化名less到less -r保留的颜色,但显然这螺丝涨少:
-r or --raw-control-chars
Causes "raw" control characters to be displayed. The default is to
display control characters using the caret notation; for example, a
control-A (octal 001) is displayed as "^A". Warning: when the -r
option is used, less cannot keep track of the actual appearance of the
screen (since this depends on how the screen responds to each type of
control character). Thus, various display problems may result, such
Run Code Online (Sandbox Code Playgroud)
我将删除该别名或尝试使用-R它,它只保留 ANSI 颜色转义序列,并且“在大多数情况下”应该可以工作。
一段时间后,less -R完全按照我的意愿工作并且没有引起任何显示问题。
-R or --RAW-CONTROL-CHARS
Like -r, but only ANSI "color" escape sequences are output in "raw"
form. Unlike -r, the screen appearance is maintained correctly in
most cases. ANSI "color" escape sequences are sequences of the form:
ESC [ ... m
where the "..." is zero or more color specification characters For the
purpose of keeping track of screen appearance, ANSI color escape
sequences are assumed to not move the cursor. You can make less think
that characters other than "m" can end ANSI color escape sequences by
setting the environment variable LESSANSIENDCHARS to the list of char?
acters which can end a color escape sequence. And you can make less
think that characters other than the standard ones may appear between
the ESC and the m by setting the environment variable LESSANSIMIDCHARS
to the list of characters which can appear.
Run Code Online (Sandbox Code Playgroud)