mirror of
https://gitlab.freedesktop.org/plymouth/plymouth.git
synced 2026-05-08 08:58:05 +02:00
add new api for moving text cursor around
This commit is contained in:
parent
6bda9aa4d1
commit
83a23fc456
2 changed files with 15 additions and 0 deletions
|
|
@ -53,6 +53,8 @@
|
|||
#define KEY_RETURN '\r'
|
||||
#define KEY_BACKSPACE '\177'
|
||||
|
||||
#define MOVE_CURSOR_SEQUNCE(column,row) "\033[f"#row","#column
|
||||
|
||||
struct _ply_window
|
||||
{
|
||||
ply_event_loop_t *loop;
|
||||
|
|
@ -438,6 +440,16 @@ ply_window_get_number_of_text_columns (ply_window_t *window)
|
|||
return window->number_of_text_columns;
|
||||
}
|
||||
|
||||
void
|
||||
ply_window_set_text_cursor_position (ply_window_t *window,
|
||||
int column,
|
||||
int row)
|
||||
{
|
||||
write (window->tty_fd,
|
||||
MOVE_CURSOR_SEQUNCE(row,column),
|
||||
strlen (MOVE_CURSOR_SEQUNCE(row,column)));
|
||||
}
|
||||
|
||||
static void
|
||||
ply_window_detach_from_event_loop (ply_window_t *window)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -74,6 +74,9 @@ bool ply_window_set_mode (ply_window_t *window,
|
|||
ply_window_mode_t mode);
|
||||
int ply_window_get_number_of_text_rows (ply_window_t *window);
|
||||
int ply_window_get_number_of_text_columns (ply_window_t *window);
|
||||
void ply_window_set_text_cursor_position (ply_window_t *window,
|
||||
int column,
|
||||
int row);
|
||||
|
||||
void ply_window_attach_to_event_loop (ply_window_t *window,
|
||||
ply_event_loop_t *loop);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue