forked from dankamongmen/notcurses
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
When we're doing cursor querying, whether for detection of inversion or just straight up localizing ourselves, we need to talk to a real terminal, or else there's not much point. When detecting cursor inversion, we need move the cursor, *and have it reflected in the terminal feedback*, which means we need write directly to the terminal (if one exists). This requires ctermfd over ttyfp, which we now hardcode. Fixes cursor crap when redirected away from the terminal dankamongmen#1668.
- Loading branch information
1 parent
a7fe436
commit a903f32
Showing
3 changed files
with
66 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#include <notcurses/direct.h> | ||
|
||
int main(void){ | ||
struct ncdirect* n = ncdirect_core_init(NULL, stdout, 0); | ||
if(n == NULL){ | ||
return EXIT_FAILURE; | ||
} | ||
int y, x; | ||
if(ncdirect_cursor_yx(n, &y, &x)){ | ||
goto err; | ||
} | ||
int dimx = ncdirect_dim_x(n); | ||
int dimy = ncdirect_dim_y(n); | ||
printf("Cursor: column %d/%d row %d/%d\n", x, dimx, y, dimy); | ||
ncdirect_stop(n); | ||
return EXIT_SUCCESS; | ||
|
||
err: | ||
ncdirect_stop(n); | ||
return EXIT_FAILURE; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters