border_set(3NCURSES)
π border_set β bestie, we're drawing borders in wide characters π
ok so this is a library call from the ncurses fam (that's the manual page name, keep up π«Ά), and it's literally the wide-character glow-up of the regular border stuff. Same energy, fancier characters. Let's get into it β¨
β¨ 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, but make it 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);
ok that's a LOT of signatures but don't panic, they're all variations on the same vibe π
π DESCRIPTION π
So border_set and wborder_set draw a border around the edges of the current window (or the one you specify, in wborder_set's case). They do not move the cursor position, and they do not wrap. Respectful. Considerate. Iconic. π
Other than the window, every argument is a complex character with attributes, and here's the lil legend bestie:
lsβ left sidersβ right sidetsβ top sidebsβ bottom sidetlβ top left-hand cornertrβ top right-hand cornerblβ bottom left-hand cornerbrβ bottom right-hand corner
Now, if any of those arguments is zero, it doesn't break anything β the corresponding default values kick in instead, and those defaults are defined in curses.h:
WACS_VLINEWACS_VLINEWACS_HLINEWACS_HLINEWACS_ULCORNERWACS_URCORNERWACS_LLCORNERWACS_LRCORNER
(yeah WACS_VLINE and WACS_HLINE each show up twice, that's not a typo, that's just the order, we don't make the rules π« )
π the box_set shorthand π
box_set(win, verch, horch); is literally just a shorthand for this call:
wborder_set(win, verch, verch,
horch, horch, NULL, NULL, NULL, NULL);
so cute, so efficient, we love a shortcut πβ¨
π¦ the *line_set girlies π¦
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 actually fit into the window, whichever comes first. And the current cursor position is not changed. Queen behavior, honestly π
- The
hline_set,mvhline_set,mvwhline_set, andwhline_setfunctions draw a line going toward the last column of the same line. - The
vline_set,mvvline_set,mvwvline_set, andwvline_setfunctions draw a line going toward the last line of the window.
β RETURN VALUE β
Upon successful completion, these functions return OK. Otherwise, they return ERR. That's it, that's the whole deal π
Functions that take a window parameter return ERR if that window is null. No window, no service.
Functions prefixed with mv first perform cursor movement, and they fail if the position (y, x) is outside the window boundaries. So like, stay in your lane, literally π
π NOTES π
border_set, hline_set, mvhline_set, mvvline_set, mvwhline_set, mvwvline_set, and vline_set may be implemented as macros. Not a big deal, just so you're not out here taking their address or whatever π«Ά
π PORTABILITY π
X/Open Curses Issue 4 describes these functions. It specifies no error conditions for them. So like, the spec is vibing and leaving the error handling to us π
π HISTORY π
X/Open Curses Issue 4 (1995) initially specified these functions. Old money, fr fr β¨
π SEE ALSO π
ncurses(3NCURSES)add_wch(3NCURSES)border(3NCURSES)outopts(3NCURSES)
ok bestie that's the whole page, go forth and draw the prettiest borders, no cap ππ¦β¨
this was ncurses 6.6, dated 2025-10-20, and yeah the page is called border_set(3NCURSES) β mwah, take care of her π
π¦ where this page comes from
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2019-2024,2025 Thomas E. Dickey
- Copyright 2002-2011,2012 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms