Different nCurses behaviours with different terminals

187 views Asked by At

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

There are 1 answers

0
Thomas Dickey On BEST ANSWER

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...