bug-ncurses
[Top][All Lists]
Advanced

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

ncurses mvaddch() cursor movement a possible bug?


From: Avinash Sonawane
Subject: ncurses mvaddch() cursor movement a possible bug?
Date: Mon, 30 Mar 2015 16:11:22 +0530

Hello there! I have a query regarding mvaddch cursor movement. Please
go through the following code snippet. I am using xterm BTW.

Code:

#include <ncurses.h>

int main(int argc, char **argv)
{
    initscr();
    noecho();
    cbreak();

    mvprintw(0, 0, curses_version());
    mvprintw(1, 0, "Hello World");
    mvaddch(2, 0, mvinch(1, 4));                 // Why doesn't this work?

    getch();
    endwin();

    return 0;
}

Output:

ncurses 5.9.20130608
Hello World

with pointer blinking (waiting for getch ) just after o of Hello.

Question:
As in C, arguments passed to a function are evaluated first before
calling that function, mvinch() will be called first and when it'll
return the character o the call to mvaddch() will be made.
But then why character o is not printed on line 2 (just below Hello
World)? Instead mvaddch prints o at current cursor position (thanks to
winch which is 1,4). Here mvaddch() behaves just like addch paying no
respect to the mv prefix and the explicit movement coordinates given
to it. Why?

Is this a possible bug in mvaddch() or am I missing something?

-- 
Avinash Sonawane (RootKea)
PICT, Pune
http://rootkea.wordpress.com



reply via email to

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