1 2 3 4 5 6 7 8 9 10 11 12 13
struct Cursor { int x; int y; Window *w; void move_left() { if (x > 0) x--; } void move_right() { if (x < w->width - 1 && w->pos(x + 1, y) != 0) x++; } };