I'm attempting to implement deleting characters in a simple window that utilizes the Curses library.
Basically, the window gets created with the following code for the border:
box(local_win, 0 , 0); // Set the border of the window to the default border style.
and later on when I go on to process a backspace, I do it with the following code:
initscr();
cbreak();
keypad(window, TRUE);
int ch; // The character pressed by the user.
while((ch = wgetch(window)) != EOF)
{
switch(ch)
{
case KEY_BACKSPACE: // Handle the backspace.
{
wdelch(window); // Delete the character at the position in the window.
wrefresh(window);
refresh();
}
}
}
Although it does delete characters, it ends up pulling the right-hand-side vertical bar with it from the border, therefore creating a hole in the border. Am I doing something wrong here or is this a case where I'll have to manually insert a space after every delete in order to keep the border in its initial spot.
Thanks for any help with this!
Yes, you need to re-insert a space just before the vertical bar, or (I'm not sure if this is possible) setup a scrolling region that's less than the full width of the terminal.