curs_in_wch(3X)

✨ curs_in_wch β€” the ncurses manual page, but make it cute ✨

okay bestie, so this is page curs_in_wch from the 3X manual section, and it's literally all about snatching a complex character out of a curses window. no cap. πŸ’–


πŸŽ€ NAME πŸŽ€

in_wch, win_wch, mvin_wch, mvwin_wch β€” get a curses complex character from a window πŸ¦‹


🌸 SYNOPSIS 🌸

#include <curses.h>

int in_wch(cchar_t * wch);
int win_wch(WINDOW * win, cchar_t * wch);
int mvin_wch(int y, int x, cchar_t * wch);
int mvwin_wch(WINDOW * win, int y, int x, cchar_t * wch);

πŸ’… DESCRIPTION πŸ’…

So here's the tea, bestie: win_wch copies the curses complex character that's chilling at the cursor position in win and drops it right into wch. ✨

And like, if you wanna actually do something with it after that? Use getcchar(3X) to pull out its character code, its attributes, and its color pair identifier. the whole package deal πŸ’–

ncurses(3X) is where you go if you wanna read up on the variants of this function β€” that's the lore. πŸ‘‘


πŸ”₯ RETURN VALUE πŸ”₯

These functions are giving OK when everything slays, and ERR when it does not. 😭

In ncurses, they return ERR if win is NULL. periodt.

And the functions with the mv prefix? They do a little cursor movement first, and they fail if the position (y, x) is outside the window boundaries. 🚫


🫢 NOTES 🫢

  • in_wch, mvin_wch, and mvwin_wch may be implemented as macros. lowkey sneaky of them ngl πŸ‘€
  • Unlike winch(3X), win_wch and its variants store the value of the retrieved character in an additional wch parameter instead of the return value. it's giving main character energy in the argument list πŸ’…

🌈 PORTABILITY 🌈

X/Open Curses Issue 4 describes these functions. It specifies no error conditions for them. iconic, honestly β€” no rules, just vibes. πŸ™ˆ


πŸ“œ HISTORY πŸ“œ

X/Open Curses Issue 4 (1995) initially specified these functions. πŸ•°οΈ

Then the System V Interface Definition Version 4 of the same year specified a function named winwch (and the usual variants, iykyk). This was a later addition to SVr4.x β€” it did not appear in the first SVr4 (1989). πŸ’€

And the way that it differed from X/Open's later win_wch?? It returned a value of type chtype instead of cchar_t. not the same vibe at all bestie. πŸ¦‹


πŸ’œ SEE ALSO πŸ’œ

  • curs_inch(3X) describes comparable functions of the ncurses library in its non-wide-character configuration.
  • curses(3X)
  • curs_inwstr(3X)

and that's the whole page, bestie β€” go forth and grab those complex characters πŸ’–

this was ncurses 6.6, dated 2025-02-01, from the curs_in_wch(3X) page. mwah, go touch some terminals πŸŽ€βœ¨

πŸ“¦ where this page comes from