-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wclrtoeol() erases character at the end of the window #324
Comments
I see what you mean. The behavior is identical in PDCursesMod and in PDCurses, so this may be of interest to @wmcbrine. In PDCurses*, you get 'XX' and a blank at the end of the line, and the cursor ends up at the start of that same line. Make the window more than one line high, and you get the same thing, but the 'X' is not erased. In ncurses, you get 'XXX' and the cursor remains at the end of the line, blinking over the final 'X'. Make the window more than one line high, and the cursor moves to the start of the next line. More generally, it appears that in ncurses, the cursor gets moved around to be after the 'XXX' (or left in the final position of the window if that's where the third 'X' ends up). In PDCurses*, the screen cursor doesn't move. (Obviously, the window cursor is getting moved around.) |
Question is whether you consider this a bug or just a given difference in implementation. |
I think the following example may get us down to the underlying issue : #include <curses.h>
int main( void)
{
initscr();
refresh( );
WINDOW *win = newwin(0, 0, 0, 0);
wmove( win, LINES / 2, COLS / 2);
wrefresh( win);
getch();
endwin();
return 0;
} With ncurses, this shows the cursor at the middle of the screen ( I don't know which is correct. I doubt it would be considered a difference in implementation; my bet is that either we're wrong or that ncurses is. A comment in |
Okay, I think I see a bit more about what's going on here. In the code just above this, insert
The thing that puzzles me is that the refresh is only supposed to happen if the window has changed (identical code is in PDCursesMod). So presumably, the window has gotten touched somewhere along the line. Will investigate... though may be a while. Mostly writing this so I'll have some record of the above to jog my memory in a few days. If you use |
I think we have two issues here, not one. First, there's the problem of handling what happens when you add a character at the lower right corner of the window (which we do with the third 'X' above). Both PDCurses* and ncurses output the character and don't advance the cursor. ncurses, though, must have some sort of logic to recognize that it's "gone past the end of the window", and that subsequent clearing to end of line or end of window should do nothing. PDCurses* doesn't. The second issue (the one I leapt onto immediately, thinking it was the only issue) is of what happens when you move the cursor in a window, do an update of that window, and then do a I don't see an easy solution to either issue. The second may very well be implementation-specific (i.e., we can ignore it). On the first issue, though, I have to say that it seems to me that (as in your example) if you put 'XXX' in the last three cells of a window, |
In the following example, the last "X" got erased,
apparently by wclrtoeol():
Interestingly this works as expected when writing directly to stdscr at the line end.
The text was updated successfully, but these errors were encountered: