curs_move(3X)

πŸ“¦ version 15.1, in freebsd 14.5, freebsd 15.1

πŸ’– curs_move(3X) β€” library calls, bestie edition πŸ’–

okay so this is the curs_move page from the ncurses library calls section, and it's genuinely so useful it's not even funny. sit down, hydrate, let's talk about moving a cursor around a window πŸ¦‹


✨ NAME ✨

move, wmove β€” move the cursor in a curses window πŸ’…

🌸 SYNOPSIS 🌸

#include <curses.h>

int move(int y, int x);
int wmove(WINDOW * win, int y, int x);

πŸŽ€ DESCRIPTION πŸŽ€

so wmove relocates the cursor that's chillin' with the curses window win, and it puts it at line y and column x. that's it. that's the whole job. 🫢

but here's the tea, bestie β€” the terminal's actual cursor does not move until you call refresh(3X). so you're basically doing a vibe-check move in the background and the terminal doesn't find out until refresh. it's giving secretive. πŸ’€

the position (y, x) is relative to the upper left-hand corner of the window, and that corner has coordinates (0, 0). so like, top-left is home base, periodt. 🌈

move is the same deal but it moves the cursor in the stdscr window instead. iconic sibling behaviour honestly. πŸ‘‘

πŸ’œ RETURN VALUE πŸ’œ

these functions return OK on success and ERR on failure. slay when it works, 😭 when it doesn't.

in ncurses, these functions fail if:

  • the curses screen has not been initialized β€” like, you gotta set the whole thing up first, bestie, no skipping steps πŸ™ˆ
  • (for wmove) win is a null pointer β€” literally pointing at nothing, not the vibe πŸ’€
  • the position (y, x) is outside the window boundaries β€” you're trying to stand outside the window, that's not a thing, no cap ✨

⭐ NOTES ⭐

move may be implemented as a macro. so like, don't be weird about it, iykyk. 🧚

πŸ”₯ PORTABILITY πŸ”₯

X/Open Curses Issue 4 describes these functions. it specifies no error conditions for them. so like, the spec is out here being mysterious and vague and honestly? respect. πŸ’…

SVr4 describes a successful return value only as "an integer value other than ERR". that's the whole description. that's all they gave us. the audacity. 😭

🌟 HISTORY 🌟

4BSD (1980) introduced these functions. so they've been eating since before most of us were born. generational. πŸ‘‘

πŸ¦‹ SEE ALSO πŸ¦‹

  • curses(3X)
  • curs_refresh(3X)

and that's the whole page!! brought to you by ncurses 6.6, dated 2025-04-05, from the curs_move(3X) manual. go move a cursor, bestie, you got this πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from