move(3NCURSES)

✨ move β€” bestie, let's talk cursor relocation ✨

okay so this is move and wmove from the ncurses library calls, and it's literally just "put the cursor somewhere else in your curses window." that's it. that's the whole vibe. πŸ’…


🌸 SYNOPSIS 🌸

#include <curses.h>

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

πŸ’– DESCRIPTION πŸ’–

so wmove takes the cursor that belongs to your curses window win and relocates it β€” line y, column x, no drama. 🫢

but here's the thing, and it's giving patience: the terminal's actual visible cursor does not move until you call refresh(3NCURSES). so you're moving the cursor in ncurses' head first, and then refresh is what makes it real. manifesting, basically. ✨

the position (y, x) is relative to the upper left-hand corner of the window, and that corner has coordinates (0, 0). so yes bestie, we're zero-indexed, as all iconic things are. πŸ‘‘

move does the exact same thing but for the stdscr window. same energy, default window.


πŸŽ€ RETURN VALUE πŸŽ€

these functions return OK on success and ERR on failure. and in ncurses, they fail if:

  • the curses screen has not been initialized πŸ™ˆ
  • (for wmove specifically) win is a null pointer πŸ’€
  • the position (y, x) is outside the window boundaries 🚫
like, if you're trying to put the cursor at a coordinate that doesn't exist in that window, that's an ERR and honestly? fair.

🌈 NOTES 🌈

move may be implemented as a macro. iykyk. so don't go doing anything weird with it like taking its address, okay bestie? 🧚


πŸ¦‹ PORTABILITY πŸ¦‹

X/Open Curses Issue 4 describes these functions. it specifies no error conditions for them. so the spec is out here being mysterious and vague, and ncurses is the one actually telling you when stuff breaks. ✨

SVr4 describes a successful return value only as "an integer value other than ERR". so like, not even promising you an OK. just "not ERR". the bar is on the floor. 😭


⭐ HISTORY ⭐

4BSD (1980) introduced these functions. so they're vintage, they're classic, they're the blueprint. respect the elders. πŸ‘‘


🌸 SEE ALSO 🌸

  • ncurses(3NCURSES)
  • refresh(3NCURSES)

and that's the whole page, bestie β€” stay slay, keep your coordinates in bounds, and remember to refresh before you expect anything to actually show up πŸ’œ

this has been brought to you by ncurses 6.6, dated 2025-04-05, and the letter M for move. periodt. πŸ’…πŸŽ€

πŸ“¦ where this page comes from