mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-23 04:46:55 +03:00
(editcmd_dialog_completion_show): adjust dialog position.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
4b9e5f50b1
commit
41d5ee716e
@ -339,7 +339,7 @@ editcmd_dialog_raw_key_query (const char *heading, const char *query, gboolean c
|
|||||||
char *
|
char *
|
||||||
editcmd_dialog_completion_show (const WEdit * edit, int max_len, GString ** compl, int num_compl)
|
editcmd_dialog_completion_show (const WEdit * edit, int max_len, GString ** compl, int num_compl)
|
||||||
{
|
{
|
||||||
|
const Widget *we = WIDGET (edit);
|
||||||
int start_x, start_y, offset, i;
|
int start_x, start_y, offset, i;
|
||||||
char *curr = NULL;
|
char *curr = NULL;
|
||||||
WDialog *compl_dlg;
|
WDialog *compl_dlg;
|
||||||
@ -350,12 +350,15 @@ editcmd_dialog_completion_show (const WEdit * edit, int max_len, GString ** comp
|
|||||||
/* calculate the dialog metrics */
|
/* calculate the dialog metrics */
|
||||||
compl_dlg_h = num_compl + 2;
|
compl_dlg_h = num_compl + 2;
|
||||||
compl_dlg_w = max_len + 4;
|
compl_dlg_w = max_len + 4;
|
||||||
start_x = edit->curs_col + edit->start_col - (compl_dlg_w / 2) +
|
start_x = we->x + edit->curs_col + edit->start_col + EDIT_TEXT_HORIZONTAL_OFFSET +
|
||||||
EDIT_TEXT_HORIZONTAL_OFFSET + (edit->fullscreen ? 0 : 1) + option_line_state_width;
|
(edit->fullscreen ? 0 : 1) + option_line_state_width;
|
||||||
start_y = edit->curs_row + EDIT_TEXT_VERTICAL_OFFSET + (edit->fullscreen ? 0 : 1) + 1;
|
start_y = we->y + edit->curs_row + EDIT_TEXT_VERTICAL_OFFSET +
|
||||||
|
(edit->fullscreen ? 0 : 1) + 1;
|
||||||
|
|
||||||
if (start_x < 0)
|
if (start_x < 0)
|
||||||
start_x = 0;
|
start_x = 0;
|
||||||
|
if (start_x < we->x + 1)
|
||||||
|
start_x = we->x + 1 + option_line_state_width;
|
||||||
if (compl_dlg_w > COLS)
|
if (compl_dlg_w > COLS)
|
||||||
compl_dlg_w = COLS;
|
compl_dlg_w = COLS;
|
||||||
if (compl_dlg_h > LINES - 2)
|
if (compl_dlg_h > LINES - 2)
|
||||||
@ -366,7 +369,7 @@ editcmd_dialog_completion_show (const WEdit * edit, int max_len, GString ** comp
|
|||||||
start_x -= offset;
|
start_x -= offset;
|
||||||
offset = start_y + compl_dlg_h - LINES;
|
offset = start_y + compl_dlg_h - LINES;
|
||||||
if (offset > 0)
|
if (offset > 0)
|
||||||
start_y -= (offset + 1);
|
start_y -= offset;
|
||||||
|
|
||||||
/* create the dialog */
|
/* create the dialog */
|
||||||
compl_dlg =
|
compl_dlg =
|
||||||
|
Loading…
Reference in New Issue
Block a user