curs_ins_wch(3X)
π curs_ins_wch β Library calls π
okay bestie, sit down, grab a boba, because today we're inserting complex characters into windows and it's gonna be iconic β¨
This one's from the Library calls section of the manual, and it's all about four lil functions: ins_wch, wins_wch, mvins_wch, and mvwins_wch β and their whole job is literally just insert a curses complex character in a window. that's it. that's the gig. slay. π
πΈ 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 π¦
So here's the tea, bestie π«: wins_wch inserts the curses complex character wch at the cursor position in the window win.
The character that was already chilling at the cursor β plus every character to its right β all scooch over one cell to the right. and the character that was formerly the rightmost one on that line? it gets discarded. gone. not invited to the function anymore. π
And here's the key difference that lowkey matters a lot: unlike add_wch(3X), wins_wch does NOT advance the cursor. it just inserts and stays put. main character energy, honestly.
ncurses(3X) describes the variants of this function, iykyk.
π RETURN VALUE π
These functions return OK on success and ERR on failure. periodt. π―
In ncurses, they return ERR if:
- the curses screen has not been initialized, or
- (for functions taking a
WINDOWpointer argument)winis a null pointer.
And the ones prefixed with βmvβ? those first perform cursor movement, and they fail if the position (y, x) is outside the window boundaries. so like, don't try to move somewhere that doesn't exist bestie, it will simply not work π
π NOTES π
ins_wch,mvins_wch, andmvwins_wchmay be implemented as macros. so heads up, they might not be real functions, they might be macro magic. β¨- curses does not necessarily employ the terminal's
insert_character(ich1) capability to achieve insertion. ngl, it just does its own thing sometimes.
π PORTABILITY π
X/Open Curses Issue 4 describes these functions. It specifies no error conditions for them. so like, X/Open said "no thoughts, head empty" on that one. π
π HISTORY π
X/Open Curses Issue 4 (1995) initially specified these functions. And then β plot twist β the System V Interface Definition Version 4 of the same year specified a function named winswch (and the usual variants). fr fr, two different standards, same year, different names, chaos.
winswch was a later addition to SVr4.x β it does not appear in the first SVr4 (1989). and the way it differed from X/Open's later wins_wch? it took an argument of type chtype instead of cchar_t. little glow-up, honestly. π§
π SEE ALSO π
curs_insch(3X)β describes comparable functions in the non-wide-character curses configuration.curses(3X),terminfo(5)
and that's the whole page bestie, you ate that π β¨
mwah π β this was ncurses 6.6, dated 2025-10-20, signing off from the curs_ins_wch(3X) era. go insert something iconic. π¦
π¦ where this page comes from
- alpine 3.24: ncurses-doc 6.6_p20260516-r0 Β· X11
- arch rolling: ncurses 6.6-2 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- fedora 44: ncurses-devel 6.6-1.fc44 Β· MIT-open-group
- Copyright 2019-2024,2025 Thomas E. Dickey
- Copyright 2002-2010,2017 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms