curs_border_set(3X)

✨ curs_border_set β€” bestie, it's giving borders πŸ’…

okay so this is a page from the 3X manual (that's the library-calls section, iykyk), and it's literally all about drawing borders and lines in a curses window β€” but with wide characters, which is the fancy complex-character version. no cap. πŸ¦‹


πŸŽ€ NAME πŸŽ€

border_set, wborder_set, box_set, hline_set, whline_set, mvhline_set, mvwhline_set, vline_set, wvline_set, mvvline_set, mvwvline_set β€” draw borders and lines in a curses window of wide characters πŸ‘‘


🌈 SYNOPSIS 🌈

#include <curses.h>

int border_set(const cchar_t *ls, const cchar_t *rs,
      const cchar_t *ts, const cchar_t *bs,
      const cchar_t *tl, const cchar_t *tr,
      const cchar_t *bl, const cchar_t *br);
int wborder_set(WINDOW *win,
      const cchar_t *ls, const cchar_t *rs,
      const cchar_t *ts, const cchar_t *bs,
      const cchar_t *tl, const cchar_t *tr,
      const cchar_t *bl, const cchar_t *br);

int box_set(WINDOW *win, const cchar_t *verch,
      const cchar_t *horch);

int hline_set(const cchar_t *wch, int n);
int whline_set(WINDOW *win, const cchar_t *wch, int n);
int mvhline_set(int y, int x, const cchar_t *wch, int n);
int mvwhline_set(WINDOW *win, int y, int x,
      const cchar_t *wch, int n);

int vline_set(const cchar_t *wch, int n);
int wvline_set(WINDOW *win, const cchar_t *wch, int n);
int mvvline_set(int y, int x, const cchar_t *wch, int n);
int mvwvline_set(WINDOW *win, int y, int x,
      const cchar_t *wch, int n);

like yes bestie there are a LOT of them. it's a whole family. a whole friend group. 🫢


πŸ’– DESCRIPTION πŸ’–

so. border_set and wborder_set draw a border around the edges of the current window or the specified window (that's the w one, obviously). the way these work: they do not change the cursor position, and they do not wrap. cursor stays exactly where it was. periodt. ✨

other than the window, every argument is a complex character β€” and it comes with attributes, okay, it's not just a plain char:

  • ls β€” left side
  • rs β€” right side
  • ts β€” top side
  • bs β€” bottom side
  • tl β€” top left-hand corner
  • tr β€” top right-hand corner
  • bl β€” bottom left-hand corner
  • br β€” bottom right-hand corner

now here's the cute part πŸ‘€ if any of these arguments is zero, then the corresponding default values (defined in curses.h) get used instead. and the defaults are, in order:

  • WACS_VLINE
  • WACS_VLINE
  • WACS_HLINE
  • WACS_HLINE
  • WACS_ULCORNER
  • WACS_URCORNER
  • WACS_LLCORNER
  • WACS_LRCORNER

(yes, WACS_VLINE shows up twice and WACS_HLINE shows up twice β€” that's literally how it is, don't come for me. πŸ™ˆ)


okay so box_set(win, verch, horch); is just a shorthand for this exact call, no thoughts:

wborder_set(win, verch, verch,
    horch, horch, NULL, NULL, NULL, NULL);

slay, that's it. that's the whole shortcut. πŸŽ€


the *line_set functions use wch to draw a line starting at the current cursor position in the window. the line is at most n characters long, or as many as fit into the window β€” whichever comes first, bestie. and the current cursor position is not changed. nope. untouched. πŸ’œ

  • hline_set, mvhline_set, mvwhline_set, and whline_set draw a line proceeding toward the last column of the same line.
  • vline_set, mvvline_set, mvwvline_set, and wvline_set draw a line proceeding toward the last line of the window.

horizontal besties vs vertical besties. both iconic. πŸ¦‹


🫢 RETURN VALUE 🫢

upon successful completion, these functions return OK. otherwise they return ERR. that's the whole vibe check right there.

  • functions that take a window parameter return ERR if it's null. (like, of course. you can't draw on a window that doesn't exist, bestie 😭)
  • functions prefixed with mv first perform cursor movement, and they fail if the position (y, x) is outside the window boundaries. so watch those coordinates fr fr.

πŸ“ NOTES πŸ“

border_set, hline_set, mvhline_set, mvvline_set, mvwhline_set, mvwvline_set, and vline_set may be implemented as macros.

okay so that means don't go taking their address or doing weird preprocessor shenanigans, because macro-ness is a thing here. lowkey important. πŸ’…

🌍 PORTABILITY 🌍

X/Open Curses Issue 4 describes these functions. it specifies no error conditions for them. (so like, the spec just. didn't. the drama is ours to figure out ✨)


πŸ›οΈ HISTORY πŸ›οΈ

X/Open Curses Issue 4, back in 1995, initially specified these functions. so they're vintage, but like, vintage in a cute way. πŸ‘‘


πŸ‘€ SEE ALSO πŸ‘€

  • curses(3X)
  • curs_add_wch(3X)
  • curs_border(3X)
  • curs_outopts(3X)

and that's the whole page, bestie!! go forth and draw gorgeous little boxes. this was ncurses 6.6, dated 2025-10-20, and it was called curs_border_set(3X) β€” mwah, obsessed, no notes πŸ’–βœ¨πŸŽ€πŸ¦‹πŸ’…

πŸ“¦ where this page comes from