简体   繁体   English

在虚拟终端中使用 ncurses

[英]using ncurses in a virtual terminal

I'm new to Linux and virtual terminals as well as to Curses, so please forgive me if this description isn't clear as it could be.我是 Linux 和虚拟终端以及 Curses 的新手,所以如果这个描述不清楚,请原谅我。 I'm trying to use Curses on Fedora 12 to output status information to a virtual terminal (you know one of the terminals you can get to by pressing ctrl-alt-Fx).我正在尝试在 Fedora 12 上使用 Curses 将状态信息输出到虚拟终端(您知道可以通过按 ctrl-alt-Fx 到达的终端之一)。 When I start up my application on one of the virtual terminals ($TERM=linux), the lines for the boxes come out as the characters 'j', 'q', 'k'....(and a few other characters).当我在其中一个虚拟终端 ($TERM=linux) 上启动我的应用程序时,框的行显示为字符 'j'、'q'、'k'....(以及一些其他字符)。 Yet when I start it within a terminal window ($TERM=xterm), everything displays as it should.然而,当我在终端窗口 ($TERM=xterm) 中启动它时,一切都按原样显示。 Can someone explain to me what I need to do to get the VT output to appear as the xterm?有人可以向我解释我需要做什么才能使 VT 输出显示为 xterm 吗? Is there a terminal setting that I can set from within my program to cause the output to be correct?是否可以从程序中设置终端设置以使输出正确? Any help would be greatly appreciated.任何帮助将不胜感激。

This is an ncurses FAQ: Line-drawing characters come out as x's and q's :这是一个 ncurses 常见问题解答: 画线字符以 x 和 q 的形式出现

The x's and q's correspond to a table (from terminfo/termcap) which tells ncurses how to map the “alternate” character set to the terminal's set of graphic characters. x 和 q 对应于一个表(来自 terminfo/termcap),它告诉 ncurses 如何将“备用”字符集映射到终端的图形字符集。 The reference for this table comes from the vt100.此表的参考来自 vt100。 If the unmapped characters appear, then the terminal emulator does not recognize the escape sequence for switching between normal and alternate fonts that is given in the terminfo description.如果出现未映射的字符,则终端仿真器无法识别用于在 terminfo 描述中给出的正常字体和备用字体之间切换的转义序列。
... ...

  • Terminal emulators which use a different escape sequence or different range for mapping the resulting characters.终端仿真器使用不同的转义序列或不同的范围来映射结果字符。 For instance the so-called vt100-compatibles such as Linux console and Tera Term.例如 Linux 控制台和 Tera Term 等所谓的 vt100-compatibles。
  • Terminal emulators which are locale-sensitive.对语言环境敏感的终端仿真器。 Again, Linux console is a problem area when running in UTF-8 mode, since its nominal vt100-compatibility is further lessened by ignoring the escape sequences dealing with fonts.同样,在 UTF-8 模式下运行时,Linux 控制台是一个问题区域,因为忽略处理字体的转义序列会进一步降低其标称的 vt100 兼容性。 The screen utility also has the same problem; screen 实用程序也有同样的问题; whether to make the implementation simple or to copy the Linux console.是简化实现还是复制 Linux 控制台。 It ignores vt100-style font switching when the locale is a UTF-8 flavor.当语言环境是 UTF-8 风格时,它会忽略 vt100 风格的字体切换。

But for the Linux console, it is largely obsolete, given the improvements made to the terminal database in 2011:但是对于 Linux 控制台,它在很大程度上已经过时了,因为 2011 年对终端数据库进行了改进:

20110205 20110205

  • add xterm-utf8 entry as a demo of the U8 feature -TD添加 xterm-utf8 条目作为 U8 功能的演示 -TD
  • add U8 feature to denote entries for terminal emulators which do not support VT100 SI/SO when processing UTF-8 encoding -TD添加 U8 功能以表示处理 UTF-8 编码时不支持 VT100 SI/SO 的终端仿真器的条目 -TD
  • improve the NCURSES_NO_UTF8_ACS feature by adding a check for an extended terminfo capability U8 (prompted by mailing list discussion ).通过添加对扩展 terminfo 功能 U8 的检查(由邮件列表讨论提示)来改进 NCURSES_NO_UTF8_ACS 功能。

Although that change was from February 2011 (six months before OP's question), Fedora 12 provided a development version of ncurses 5.7 (2009/02/09 versus 2008/11/2) packaged in August 2009 .尽管该更改是从 2011 年 2 月(OP 提出问题前六个月)开始的,但 Fedora 12 提供了 2009 年8 月打包的ncurses 5.7的开发版本(2009/02/09 与 2008/11/2)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM