deleteln(3NCURSES)

πŸ’– deleteln, wdeleteln, insertln, winsertln, insdelln, winsdelln β€” the 3NCURSES besties πŸ’–

okay so bestie. you know how sometimes a window has a line you simply cannot look at anymore and it has to GO? and sometimes you need a whole new blank line to show up like it manifested? yeah. this is that. line deletion and line insertion in a curses window. no cap. πŸ‘‘


✨ 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);

like literally that's it, that's the whole entrance exam πŸŽ€


🌸 DESCRIPTION 🌸

πŸ—‘οΈ wdeleteln β€” the "this line is over" function

wdeleteln deletes the line at the cursor in win, and every line below it just... moves up one line. like a queue where someone left. πŸšΆβ™€οΈ

then curses fills the bottom line of win with the background character that you configured with wbkgdset(3NCURSES) β€” and if you're on the wide-character API side of the group chat, that's wbkgrndset(3NCURSES) for you babes. πŸ’œ

and here's the thing that lowkey matters: the cursor position does not change. it just sits there, unbothered, main character energy. πŸ’…

βž• winsertln β€” the "make room, new line incoming" function

winsertln inserts a new, empty line of characters above the line at the cursor in win, and it shifts all the existing lines down by one. push everybody down, bestie, we're making space. 🫢

the content of the window's bottom line is lost β€” yeah, gone, sorry, it had to go 😭 β€” and curses fills the new line with the background character.

and once again: the cursor position does not change. iconic behavior. no notes. ✨

🎚️ winsdelln β€” the "both, depending on the vibe" function

winsdelln inserts or deletes n lines in win depending on whether n is positive or negative. positive n = insert, negative n = delete. it's basically repeatedly calling winsertln or wdeleteln for you, like a friend who handles the group plan. 🌈

and winsdelln(..., 0)? performs no operation. zero. nothing. it's giving "I'll be there in five minutes". πŸ’€


🫧 RETURN VALUE 🫧

these functions return OK when it works and ERR when it doesn't. slay or cry, no in-between. πŸŽ€

in ncurses, they fail if win is NULL. so like... maybe don't do that. πŸ™ˆ


⭐ NOTES ⭐

  • all of these functions except winsdelln may be implemented as macros. so watch out, 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. see idlok(3NCURSES) for the whole tea. β˜•

🌍 PORTABILITY 🌍

X/Open Curses Issue 4 describes these functions, and it specifies no error conditions for them. so like, it said nothing. silence. 🀐

SVr4 describes a successful return value only as β€œan integer value other than ERR”. that's the whole description. an integer. not ERR. groundbreaking. πŸ’€


πŸ“œ HISTORY πŸ“œ

  • 4BSD (1980) introduced deleteln, wdeleteln, insertln, and winsertln. the originals. the OGs. πŸ‘‘
  • SVr3.1 (1987) added insdelln and winsdelln. the sequels, and honestly they ate. πŸ”₯

πŸ‘€ SEE ALSO πŸ‘€

  • ncurses(3NCURSES)

okay bestie that's the whole page, go forth and delete some lines πŸ’–βœ¨

this was brought to you by ncurses 6.6, dated 2025-07-05, and it's literally the deleteln(3NCURSES) page. periodt. πŸ’…πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from