bug-ncurses
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

the cursor is misplaced after writing the very last column


From: Benno Schulenberg
Subject: the cursor is misplaced after writing the very last column
Date: Wed, 24 Aug 2016 21:31:35 +0200

Hello Thomas,

When something is written to the very last column of the last line
of a window, and one then tries to place the cursor somewhere near
that last column, the cursor actually appears one column further.
See the small program below for a demonstration.

I see this on a Gnome Terminal and on an Xfce-terminal.  It works
fine on a Linux console.  It works fine on an Xterm too, but *not*
when the width is artificially reduced with, say, 'stty cols 35'.

Any idea who or what is at fault here?

Below program writes some words to the lower right corner and then
places the cursor in the penultimate column.  This goes wrong when
a character is written to the very last column.  Notice how, as the
first two exes are written, it seems to do an insert.  Notice also
how it requires changing something at least six characters away from
the last column before the abnormal cursor position gets corrected.

Benno


#include <ncurses.h>

WINDOW *bottom;

void putstring(const char *message)
{
        mvwaddstr(bottom, 0, COLS - 11, message);
        wmove(bottom, 0, COLS - 2);
        wnoutrefresh(bottom);
        doupdate();
        napms(1800);
}

int main (void)
{
        (void) initscr();

        bottom = newwin(1, COLS, LINES - 1, 0);

        putstring("Starting");
        putstring("Bitlonger");
        putstring("Morelonger");
        putstring("Fillingitup");

        beep();
        putstring("Fillingx");
        beep();
        putstring("Fillix");
        beep();
        putstring("Fillx");

        napms(3500);
        endwin();
}

-- 
http://www.fastmail.com - Same, same, but different...




reply via email to

[Prev in Thread] Current Thread [Next in Thread]