Currently coding in C++20, using Ubuntu WSL2.
Using the code shown below, the cursor goes invisible when running the program in WSL2 in Windows Terminal, working as intended.
However, when running the program in WSL2 in vscode's integrated terminal, the cursor is visible throughout the whole program (just in case, I even put terminal.integrated.scrollback
to 0).
The function curs_set(0)
doesn't return ERR
when it runs in either of the terminals. Is this a problem with vscode's integrated terminal? Is there a way to fix this?
Code:
#include <ncurses.h>
int main() {
initscr();
noecho();
cbreak();
if (curs_set(0) == ERR) {
addstr("Not working");
}
mvaddstr(1, 1, "Random sentence.");
refresh();
getch();
mvaddstr(2, 1, "Random sentence number two.");
getch();
endwin();
}
I was able to resolve this issue on my end by calling refresh()
once first before using curs_set()
.