Different nCurses behaviours with different terminals

限于喜欢 提交于 2019-12-02 04:33:51

问题


I obtain two different behaviours using different terminals, this is my code:

(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)

The code is written in Chicken Scheme but it's easily readable by anyone who knows nCurses. I think my problem doesn't concern the library because it's a simple wrapper which calls the C functions.

However, I get the correct behaviour (a boxed window) if I use xterm, uxterm or the linux terminal you can enter with CTRL-ALT-F1.

.................................................┐
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
.................................................│
└────────────────────────────────────────────────┘

But if I use any other terminals like gnome-terminal, terminator or sakura I get this:

 .┐
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 .│
 └─┘

I don't think it's a library fault but I can try to rewrite the example in C (my C is a little rusted).


回答1:


That sounds as if your TERM variable is set to xterm, which occasionally produces problems for the VTE-based terminals (gnome-terminal, etc). It's an FAQ (Why not just use TERM set to "xterm"?).

It's not a bug (in ncurses, at any rate).

Setting it to vte will work if you have a complete terminal database...



来源:https://stackoverflow.com/questions/46162793/different-ncurses-behaviours-with-different-terminals

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!