28 lines
513 B
C
28 lines
513 B
C
|
|
#include "line-ed.h"
|
||
|
|
#include "cursor.h"
|
||
|
|
#include "prompt.h"
|
||
|
|
|
||
|
|
void line_ed_coords_to_physical_coords(struct line_ed *ed,
|
||
|
|
unsigned int x, unsigned int y,
|
||
|
|
unsigned int *out_x, unsigned int *out_y)
|
||
|
|
{
|
||
|
|
unsigned int prompt_len = 0;
|
||
|
|
if (ed->l_cursor_y == 0) {
|
||
|
|
prompt_len = prompt_length(ed, PROMPT_MAIN);
|
||
|
|
} else if (ed->l_cursor_y <= ed->l_continuations) {
|
||
|
|
prompt_len = prompt_length(ed, PROMPT_CONT);
|
||
|
|
}
|
||
|
|
|
||
|
|
if (y == 0) {
|
||
|
|
x += prompt_len;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (out_x) {
|
||
|
|
*out_x = x;
|
||
|
|
}
|
||
|
|
|
||
|
|
if (out_y) {
|
||
|
|
*out_y = y;
|
||
|
|
}
|
||
|
|
}
|