curs_insch(3X)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’– curs_insch(3X) β€” the "scoot over, bestie" of curses πŸ’–

okay so this is a Library calls page from the curses family, and it's all about insch, winsch, mvinsch, and mvwinsch β€” the four girlies who insert a character into a window and make everybody else shuffle right. no cap. 🫢


✨ NAME ✨

insch, winsch, mvinsch, mvwinsch β€” insert a curses character in a window 🌸


✨ SYNOPSIS ✨

#include <curses.h>

int insch(chtype ch);
int winsch(WINDOW * win, chtype ch);
int mvinsch(int y, int x, chtype ch);
int mvwinsch(WINDOW * win, int y, int x, chtype ch);

✨ DESCRIPTION ✨

so winsch inserts the curses character ch at the cursor position in the window win. that's the whole vibe. πŸ’…

the character that was previously sitting at the cursor β€” plus every single one to its right β€” gets moved one cell to the right. and the character that used to be the rightmost one on the line? discarded. gone. bye bestie. 😭

here's the plot twist tho: unlike addch(3X), winsch does not advance the cursor. it stays exactly where it is. icon behaviour honestly. ✨

and if you wanna know all about the variants of this function, ncurses(3X) describes them. iykyk. πŸ’œ


✨ RETURN VALUE ✨

these functions return OK on success and ERR on failure. that's it, that's the whole thing. πŸŽ€

in ncurses, they return ERR if:

  • the curses screen has not been initialized, or 🌚
  • (for functions taking a WINDOW pointer argument) win is a null pointer. πŸ’€

also!! functions prefixed with β€œmv” first perform cursor movement, and they fail if the position (y, x) is outside the window boundaries. stay in your lane or get ERR'd, periodt. πŸ‘‘


✨ NOTES ✨

  • insch, mvinsch, and mvwinsch may be implemented as macros. so like… they might not be real functions. sneaky. πŸ™ˆ
  • curses does not necessarily employ the terminal's insert_character (ich1) capability to achieve insertion. don't assume, bestie. πŸ¦‹

✨ PORTABILITY ✨

X/Open Curses Issue 4 describes these functions. and it specifies no error conditions for them. zero. none. not a single one. πŸ’€

SVr4 describes a successful return value only as β€œan integer value other than ERR”. that's the entire definition. so vague. so mysterious. main character energy fr fr. ✨


✨ HISTORY ✨

SVr2 (1984) introduced these functions. vintage. iconic. a classic for the girlies. πŸ‘‘


✨ SEE ALSO ✨

  • curs_ins_wch(3X) β€” describes comparable functions in the wide-character curses configuration 🌈
  • curses(3X)
  • terminfo(5)

and that's the whole page, bestie!! πŸŽ€ this was ncurses 6.6, dated 2025-03-08, and it's the curs_insch(3X) manual page. go insert some characters, don't advance that cursor, and stay slaying. πŸ’–βœ¨πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from