1
0
mirror of https://github.com/rkd77/elinks.git synced 2024-09-27 02:56:18 -04:00

terminfo_cursor_address

This commit is contained in:
Witold Filipczyk 2017-11-23 13:39:04 +01:00
parent 49f41d4371
commit 2bd6ac3f08
3 changed files with 14 additions and 1 deletions

View File

@ -638,8 +638,13 @@ done_screen_drivers(struct module *xxx)
static inline struct string *
add_cursor_move_to_string(struct string *screen, int y, int x)
{
#ifdef CONFIG_TERMINFO
if (get_cmd_opt_bool("terminfo")) {
return add_to_string(screen, terminfo_cursor_address(y-1, x-1));
} else
#endif
#define CURSOR_NUM_LEN 10 /* 10 chars for @y and @x numbers should be more than enough. */
unsigned char code[4 + 2 * CURSOR_NUM_LEN + 1];
{ unsigned char code[4 + 2 * CURSOR_NUM_LEN + 1];
unsigned int length = 2;
code[0] = '\033';
@ -656,6 +661,7 @@ add_cursor_move_to_string(struct string *screen, int y, int x)
code[length++] = 'H';
return add_bytes_to_string(screen, code, length);
}
#undef CURSOR_NUM_LEN
}

View File

@ -66,3 +66,9 @@ terminfo_max_colors(void)
{
return max_colors;
}
char *
terminfo_cursor_address(int y, int x)
{
return tiparm(cursor_address, y, x);
}

View File

@ -9,4 +9,5 @@ char *terminfo_set_underline(int arg);
char *terminfo_set_foreground(int arg);
char *terminfo_set_background(int arg);
int terminfo_max_colors(void);
char *terminfo_cursor_address(int y, int x);
#endif