不同终端的不同 nCurses 行为
Different nCurses behaviours with different terminals
我使用不同的终端获得两种不同的行为,这是我的代码:
(use ncurses)
(initscr)
(curs_set 0)
(noecho)
(start_color)
(define win (newwin 20 50 1 1))
(wclear win)
(box win 0 0)
(for-each (lambda (y)
(for-each (lambda (x)
(mvwaddch win y x #\. ))
(iota 49)))
(iota 19))
(wrefresh win)
(wgetch win)
(endwin)
代码是用 Chicken Scheme 编写的,但任何了解 nCurses 的人都可以轻松阅读。我认为我的问题与库无关,因为它是一个调用 C 函数的简单包装器。
但是,如果我使用 xterm、uxterm 或可以使用 CTRL-ALT-F1 输入的 linux 终端,我会得到正确的行为(加框 window)。
.................................................┐
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
└────────────────────────────────────────────────┘
但是如果我使用任何其他终端,如 gnome-terminal、terminator 或 sakura,我会得到这个:
.┐
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
└─┘
我不认为这是库错误,但我可以尝试用 C 重写示例(我的 C 有点生锈)。
这听起来好像您的 TERM
变量设置为 xterm
,这偶尔会对基于 VTE 的终端(gnome-terminal, ETC)。这是一个常见问题 (Why not just use TERM set to "xterm"?).
这不是错误(无论如何在 ncurses 中)。
如果您有完整的终端数据库,将其设置为 vte
即可...
我使用不同的终端获得两种不同的行为,这是我的代码:
(use ncurses)
(initscr)
(curs_set 0)
(noecho)
(start_color)
(define win (newwin 20 50 1 1))
(wclear win)
(box win 0 0)
(for-each (lambda (y)
(for-each (lambda (x)
(mvwaddch win y x #\. ))
(iota 49)))
(iota 19))
(wrefresh win)
(wgetch win)
(endwin)
代码是用 Chicken Scheme 编写的,但任何了解 nCurses 的人都可以轻松阅读。我认为我的问题与库无关,因为它是一个调用 C 函数的简单包装器。
但是,如果我使用 xterm、uxterm 或可以使用 CTRL-ALT-F1 输入的 linux 终端,我会得到正确的行为(加框 window)。
.................................................┐
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
└────────────────────────────────────────────────┘
但是如果我使用任何其他终端,如 gnome-terminal、terminator 或 sakura,我会得到这个:
.┐
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
.│
└─┘
我不认为这是库错误,但我可以尝试用 C 重写示例(我的 C 有点生锈)。
这听起来好像您的 TERM
变量设置为 xterm
,这偶尔会对基于 VTE 的终端(gnome-terminal, ETC)。这是一个常见问题 (Why not just use TERM set to "xterm"?).
这不是错误(无论如何在 ncurses 中)。
如果您有完整的终端数据库,将其设置为 vte
即可...