wresize(3NCURSES)

πŸ’– wresize β€” bestie edition πŸ’–

okay so this is wresize from the ncurses library calls club, and she is the girl for making a curses window change its whole shape. no cap. πŸ¦‹


🌸 NAME 🌸

wresize β€” resize a curses window πŸ’…


✨ SYNOPSIS ✨

#include <curses.h>

int wresize(WINDOW * win, int lines, int columns);

πŸŽ€ DESCRIPTION πŸŽ€

okay so wresize is an ncurses extension to the curses library β€” meaning she's not in the og lineup, she's the bonus track β€” and what she does is reallocate storage for win, adjusting its dimensions to lines and columns. iconic behavior honestly.

and here's the cute part: if either dimension is bigger than its current value, ncurses fills the expanded part of the window with the window's background character, exactly as configured by wbkgdset(3NCURSES). and if you're living in the wide-character API era? that's wbkgrndset(3NCURSES) for you, bestie. 🌈


πŸ’– RETURN VALUE πŸ’–

  • wresize returns OK on success πŸ’š
  • and ERR on failure πŸ’€

she fails if either lines or columns is less than or equal to zero, or if an error happens while (re)allocating memory for win. so yeah, memory said no, and she respects that. 😭


🧚 NOTES 🧚

the only restriction placed on the values of lines and columns is that they be greater than zero. that's it. that's the whole vibe check.

they are not compared to the dimensions of the curses screen β€” and that's on purpose, because it keeps the logic of resizeterm(3NCURSES) simple. 🫢

but bestie, listen: the caller must ensure that win's dimensions fit within those of the screen. that part is on you, not her. πŸ‘‘

πŸ”₯ EXTENSIONS πŸ”₯

wresize is an ncurses(3NCURSES) extension, and is not found in SVr4 curses, 4.4BSD curses, or any other previous curses implementation. she's built different, fr fr. ⭐


🌟 PORTABILITY 🌟

applications employing ncurses extensions should condition their use on the visibility of the NCURSES_VERSION preprocessor macro. like, check before you use her, she's not everywhere. 🧐

NetBSD curses adopted wresize in 2001 (release 1.5.3), and PDCurses in 2004 (version 2.7). so she did eventually go mainstream. we love a glow-up. ✨

and lowkey important: it is not possible to resize windows with SVr4 curses. nope. not a thing. don't try it. πŸ™ˆ


πŸ‘‘ HISTORY πŸ‘‘

Thomas Dickey developed wresize as an extension to BSD curses in 1988, and brought it to ncurses in mid-1995. a true main character moment across two whole eras. πŸ’œ


πŸ’œ AUTHORS πŸ’œ

Thomas Dickey 🫢


πŸ¦‹ SEE ALSO πŸ¦‹

  • resizeterm(3NCURSES)

okay that's the whole page!! and a lil sign-off for you: this was ncurses 6.6, dated 2025-01-18, and yes she ate. go resize something responsibly, bestie. periodt. πŸ’…πŸŽ€πŸŒΈ

πŸ“¦ where this page comes from