Borders don't draw properly when window has more than 8 columns

感情迁移 提交于 2019-11-29 17:54:30

ncurses uses a terminal capability database to get information about terminal control sequences that a terminal supports. It uses the value of the TERM environment variable to look up this information. PuTTY or KiTTY passes a desired value of the TERM environment variable to the SSH server. Often it is set to "xterm" by default, but it can be changed in the session settings under Connection -> Data -> Terminal-type string.

PuTTY and KiTTY used to support the control sequences for "xterm" in the terminal capability database quite well, but recent (mid-2017 onwards) versions of the database optimized the sequences defined for "xterm" to use sequences not currently supported by PuTTY or KiTTY. Specifically, it now makes use of the ECMA-48 REP (repeat character) control sequence which is not supported by PuTTY. To make line drawing work properly on systems with a recent terminal capability database, the TERM environment variable needs to be changed for PuTTY or KiTTY. (It can be changed in the session settings as discussed above.) Suitable values for recent versions of the terminal capability database include "putty" or "putty-256color". The value "xterm-old" may also work.

Check the "/usr/share/terminfo" directory on your host system to see which terminal types are actually defined by the system. The first letter of the terminal type is split off as a subdirectory so that, for example, the terminal capabilities for the "putty" terminal type are defined by the "/usr/share/terminfo/p/putty" file.

Note that this problem affects not only line-drawing, but any horizontal repeats of the same character more than six times. It is addressed by the ncurses FAQ:

That only covers the features which are in the terminal description, and does not address differences between terminal emulators. For example, in mid-2017, an update to the xterm terminal description added the ECMA-48 REP (repeat character) control. It was part of xterm since January 1997, but a terminal description using the feature was part of xterm only (not ncurses). After adding it to ncurses, it was observed that:

  • rxvt is unaffected, since it does not use TERM=xterm.
  • mlterm and OSX Terminal supported REP, using TERM=xterm.
  • VTE, konsole, PuTTY, iTerm2 did not support this standard, longstanding feature, of xterm although they set TERM to xterm or xterm-256color.
  • screen and tmux use a different TERM setting, and seemed to work (although tmux had some other issue with the test).
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!