curs_deleteln(3X)

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

✨ curs_deleteln β€” delete or insert lines in a curses window ✨

okay bestie, welcome to curs_deleteln(3X), a library call situation πŸ’… this is where you get to yeet lines out of a window or shove brand new ones in, and honestly? iconic behavior.


🌸 NAME 🌸

deleteln, wdeleteln, insertln, winsertln, insdelln, winsdelln β€” delete or insert lines in a curses window 🫢


🌈 SYNOPSIS 🌈

#include <curses.h>

int deleteln(void);
int wdeleteln(WINDOW * win);

int insertln(void);
int winsertln(WINDOW * win);

int insdelln(int n);
int winsdelln(WINDOW * win, int n);

πŸ’– DESCRIPTION πŸ’–

so here's the tea, one function at a time πŸ“

wdeleteln deletes the line at the cursor in win, and every line below it moves up one line. then curses fills the bottom line of win with the background character that you set up with wbkgdset(3X) β€” and if you're on the wide-character API, that's wbkgrndset(3X) for you, no cap. the cursor position? does not change. it stays exactly where it was, main character energy πŸ‘‘

winsertln inserts a new, empty line of characters above the line at the cursor in win, shifting all the existing lines down by one. heads up though: the content of the window's bottom line is lost 😭 and curses fills that new line with the background character. cursor position does not change. again. so consistent.

winsdelln inserts or deletes n lines in win β€” inserts when n is positive, deletes when n is negative β€” as if you'd just called winsertln or wdeleteln over and over and over. and winsdelln(..., 0)? performs no operation. it's giving "I'm just here for the vibes" πŸ’€


πŸ”₯ RETURN VALUE πŸ”₯

these functions return OK on success and ERR on failure. simple as that ✨

in ncurses, they fail if win is NULL. (like, bestie, you have to actually give them a window.)


πŸŽ€ NOTES πŸŽ€

all of these functions except winsdelln may be implemented as macros. surprise mechanics, iykyk πŸ™ˆ

these functions do not require the terminal to have hardware line deletion or insertion capabilities. and even if the terminal does have them? by default curses does not use them β€” go peek at idlok(3X) if you wanna know more. it's a whole thing.


πŸ¦‹ PORTABILITY πŸ¦‹

X/Open Curses Issue 4 describes these functions. it specifies no error conditions for them. so like… nothing to worry about there, apparently 🫠

SVr4 describes a successful return value only as β€œan integer value other than ERR”. that's it. that's the whole description. so vague. so mysterious. we love that for them πŸ’œ


⭐ HISTORY ⭐

4BSD in 1980 introduced deleteln, wdeleteln, insertln, and winsertln. pioneers fr fr πŸ‘‘

SVr3.1 in 1987 added insdelln and winsdelln. and then there were six.


πŸ‘‘ SEE ALSO πŸ‘‘

  • curses(3X)

and that's the whole page, bestie!! this was ncurses 6.6, dated 2025-07-05 β€” go forth and delete and insert lines responsibly πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from