if (win) { ADD(rv, INTEGER_OBJ(win->w_cursor.lnum)); ADD(rv, INTEGER_OBJ(win->w_cursor.col)); } return rv; } /// Sets the cursor position in the window /// /// @param window The window handle /// @param pos the (row, col) tuple representing the new position /// @param[out] err Details of an error that may have occurred void window_set_cursor(Window window, ArrayOf(Integer, 2) pos, Error *err) { win_T *win = find_window_by_handle(window, err); if (pos.size != 2 || pos.items[0].type != kObjectTypeInteger || pos.items[1].type != kObjectTypeInteger) { api_set_error(err, Validation, _("Argument \"pos\" must be a [row, col] array")); return; } if (!win) { return; } int64_t row = pos.items[0].data.integer; int64_t col = pos.items[1].data.integer;
/// Checks if a window is valid /// /// @param window The window handle /// @return true if the window is valid, false otherwise Boolean window_is_valid(Window window) { Error stub = ERROR_INIT; return find_window_by_handle(window, &stub) != NULL; }