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
wmovespecifically)winis 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
- ubuntu resolute: ncurses-doc 6.6+20251231-1 Β· MIT/X11
- ubuntu stonking: ncurses-doc 6.6+20260608-2 Β· MIT/X11
- Copyright 2018-2024,2025 Thomas E. Dickey
- Copyright 1998-2010,2017 Free Software Foundation, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms