diff --git a/src/lib/direct.c b/src/lib/direct.c index 834f4b6c4..d1f930f36 100644 --- a/src/lib/direct.c +++ b/src/lib/direct.c @@ -195,7 +195,12 @@ cursor_yx_get(int ttyfd, const char* u7, int* y, int* x){ int r; char in; do{ +#ifndef __MINGW64__ while((r = read(ttyfd, &in, 1)) == 1){ +#else + while((r = getc(stdin)) >= 0){ // FIXME + in = r; +#endif bool valid = false; switch(state){ case CURSOR_ESC: valid = (in == NCKEY_ESC); state = CURSOR_LSQUARE; break; @@ -244,6 +249,7 @@ cursor_yx_get(int ttyfd, const char* u7, int* y, int* x){ if(x){ *x = column; } + loginfo("cursor at y=%d x=%d\n", row, column); return 0; } @@ -315,6 +321,8 @@ detect_cursor_inversion(ncdirect* n, const char* u7, int rows, int cols, int* y, // do not use normal ncdirect_cursor_*() commands, because those go to ttyfp // instead of tcache.ttyfd. since we always talk directly to the terminal, we need // to move the cursor directly via the terminal. + // FIXME since we're always moving 1, we could also just use cuu1 etc (which + // i believe to be the only form implemented by Windows Terminal?...) const char* cuu = get_escape(&n->tcache, ESCAPE_CUU); const char* cuf = get_escape(&n->tcache, ESCAPE_CUF); const char* cub = get_escape(&n->tcache, ESCAPE_CUB); diff --git a/src/lib/fd.c b/src/lib/fd.c index 4a57c4aa2..255447e9c 100644 --- a/src/lib/fd.c +++ b/src/lib/fd.c @@ -475,7 +475,7 @@ int get_tty_fd(FILE* ttyfp){ if(isatty(fd)){ fd = dup(fd); }else{ - loginfo("File descriptor %d was not a TTY\n", fd); + loginfo("fd %d not a TTY\n", fd); fd = -1; } }