wresize(3X)

πŸ’– wresize β€” from the 3X manual, library calls section πŸ’–

okay bestie, gather round, because we're about to resize a curses window and it's literally the cutest little realloc you've ever seen πŸŽ€


✨ NAME ✨

wresize β€” resize a curses window πŸ¦‹


✨ SYNOPSIS ✨

#include <curses.h>

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

✨ DESCRIPTION ✨

so wresize is an ncurses extension to the curses library (iykyk, it's not in the old-school ones, more on that below πŸ‘€), and what it does is reallocate storage for win, adjusting its dimensions to lines and columns. glow-up for your window, no cap πŸ’…

and if either dimension is bigger than its current value? ncurses fills that expanded part of the window with the window's background character, exactly as configured by wbkgdset(3X) β€” or, if you're on the wide-character API, by wbkgrndset(3X). so it's not just bigger, it's bigger and on-brand 🌸


✨ RETURN VALUE ✨

  • OK β€” slay, it worked, success πŸ’–
  • ERR β€” nope, failure 😭

it fails if either lines or columns is less than or equal to zero, or if an error pops off while (re)allocating memory for win. those are the two ways to lose, bestie.


✨ NOTES ✨

okay so the only restriction 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(3X) simple. iconic design choice, honestly.

🫢 so the caller must ensure that win's dimensions actually fit within those of the screen. that's a you problem, not a wresize problem. no cap.

✨ EXTENSIONS ✨

wresize is an ncurses(3X) extension, and it is not found in SVr4 curses, 4.4BSD curses, or any other previous curses implementation. it's giving ncurses-only, main character energy πŸ‘‘


✨ PORTABILITY ✨

if you're using ncurses extensions, bestie, you should condition their use on the visibility of the NCURSES_VERSION preprocessor macro. fr fr, do the #ifdef, your future self will thank you πŸ™ˆ

NetBSD curses adopted wresize in 2001 (release 1.5.3), and PDCurses in 2004 (version 2.7). so it's traveled a bit 🌈

πŸ’€ and just so we're clear: it is not possible to resize windows with SVr4 curses. at all. periodt.

✨ HISTORY ✨

Thomas Dickey developed wresize as an extension to BSD curses in 1988, and brought it to ncurses in mid-1995. a true legend, we stan 🫢✨


✨ AUTHORS ✨

Thomas Dickey πŸ‘‘


✨ SEE ALSO ✨

  • resizeterm(3X) πŸ’œ

and that's the whole page, bestie!! this was the wresize(3X) manual from ncurses 6.6, dated 2025-01-18 β€” go forth and resize responsibly, mwah πŸ’–πŸ’…πŸŽ€

πŸ“¦ where this page comes from