ins_wch(3NCURSES)

πŸ’– ins_wch β€” bestie, we're inserting a complex character ✨

(that's ins_wch, wins_wch, mvins_wch, mvwins_wch from the 3NCURSES library calls crew πŸŽ€)


🌸 NAME 🌸

ins_wch, wins_wch, mvins_wch, mvwins_wch β€” insert a curses complex character in a window πŸ’…


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <curses.h>

int ins_wch(const cchar_t * wch);
int wins_wch(WINDOW * win, const cchar_t * wch);
int mvins_wch(int y, int x, const cchar_t * wch);
int mvwins_wch(WINDOW * win, int y, int x, const cchar_t * wch);

✨ DESCRIPTION ✨

okay so wins_wch inserts the curses complex character wch at the cursor position in the window win. iconic

the character that was previously at the cursor β€” and literally everything to its right β€” moves one cell to the right 🫢. and the character that used to be the rightmost one on the line? bestie, it's discarded πŸ’€ gone, not coming back.

and here's the thing that makes it different from add_wch(3NCURSES): wins_wch does not advance the cursor. not even a little. nope. stay put, king πŸ‘‘

ncurses(3NCURSES) is where you go to read about the variants of this function, iykyk.


πŸ’œ RETURN VALUE πŸ’œ

these functions return OK when things go right and ERR when they don't 😭

in ncurses specifically, they return ERR if:

  • the curses screen has not been initialized, or
  • (only for the functions that take a WINDOW pointer argument) win is a null pointer 🚫

also! the functions prefixed with "mv" first do cursor movement, and they fail if the position (y, x) is outside the window boundaries. no cap.


πŸŽ€ NOTES πŸŽ€

  • ins_wch, mvins_wch, and mvwins_wch may be implemented as macros πŸ‘€
  • curses does not necessarily employ the terminal's insert_character (ich1) capability to achieve insertion. it might, it might not. that's just the vibe.

🌈 PORTABILITY 🌈

X/Open Curses Issue 4 describes these functions πŸ’–. it specifies no error conditions for them. wild, right?


πŸ‘‘ HISTORY πŸ‘‘

X/Open Curses Issue 4 (1995) initially specified these functions ⭐

the System V Interface Definition Version 4 of the same year specified a function named winswch (plus the usual variants). this was a later addition to SVr4.x β€” it did not appear in the first SVr4 (1989). πŸ™ˆ

it differed from X/Open's later wins_wch in that it took an argument of type chtype instead of cchar_t. subtle but real πŸ’…


πŸ”₯ SEE ALSO πŸ”₯

  • insch(3NCURSES) β€” describes comparable functions in the non-wide-character curses configuration
  • ncurses(3NCURSES)
  • terminfo(5)

and that's the whole page, bestie 🫢 this was ncurses 6.6, dated 2025-10-20 β€” go insert some complex characters, you absolute main character πŸ’–βœ¨πŸŽ€

πŸ“¦ where this page comes from