2

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

Andrea Ciceri
  • 436
  • 6
  • 16
  • I think it's a bug of the library version I'm using, I've tried this code on a Xubuntu 17.04 machine with the 2016-06-25 ncurses package and it works perfectly. I tried other terminals on my pc, ArchLinux with the last package *ncurses 6.0+20170902-1* and the problem persists. – Andrea Ciceri Sep 11 '17 at 19:48
  • 1
    If your terminal window is smaller than 20x50, this will fail: `(define win (newwin 20 50 1 1))` – Thomas Dickey Sep 11 '17 at 20:16
  • @ThomasDickey my terminal isn't so small, besides the program executes and ends without any error. – Andrea Ciceri Sep 11 '17 at 21:01
  • I confirm that downgrading the package on ArchLinux the problem does not occur, I don't know if it's a bug or what – Andrea Ciceri Sep 11 '17 at 21:13

1 Answers1

4

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

Thomas Dickey
  • 51,086
  • 7
  • 70
  • 105