b (삭제) 키를 누른 상태에서 커서가 줄의 시작 부분에 있으면 커서를 이전 줄로 이동하려고합니다.커서를 ncurses의 이전 줄로 이동
void processKey()
{
char ch = getch();
char *check = unctrl(ch);
int safe = (check != 0 && strlen(check) == 1);
int Trow,Tcol; //Terminal's full rows and columns.
getmaxyx(stdscr,Trow,Tcol);
int row,col; //Current row and columns.
getyx(stdscr,row,col);
switch(ch)
{
case 0x11: //Ctrl + Q
closee();
break;
case 'b': //pressing "b" deletes the previous character.
if(col==0)
{
//This should move the cursor to the previous line. But that doesn't work.
move(row-1,Tcol);
addstr("\b \b");
refresh();
break;
}
else
{
addstr("\b \b");
break;
}
default:
if(safe)
{
addch(ch);
}
}
}
나는 이전 행으로 이동 커서를 원했다. 그러나 그런 일은 일어나지 않으며 커서는 현재 위치에서만 유지됩니다. mvcur()를 사용하여이 작업을 시도했지만 동일한 결과를 보여줍니다. 이 작업을 수행하는 올바른 방법은 무엇입니까? 사용
참고 : getch()는 "char"이 아닌 "int"를 반환합니다. – TonyB