Ticket #2591: mouse clicks ignored on the bottom line of editor.

Initial step: fixups of WEdit resizing.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2011-08-12 10:02:16 +04:00
parent c819eb1fa3
commit 5ae3697e58
2 changed files with 35 additions and 10 deletions

View File

@ -204,17 +204,30 @@ print_to_widget (WEdit * edit, long row, int start_col, int start_col_real,
if (!show_right_margin)
{
tty_draw_hline (edit->widget.y + y, edit->widget.x + x1, ' ', end_col + 1 - start_col);
int len;
len = end_col + 1 - start_col;
if (len > 0)
tty_draw_hline (edit->widget.y + y, edit->widget.x + x1, ' ', len);
}
else if (edit->start_col < option_word_wrap_line_length)
{
tty_draw_hline (edit->widget.y + y,
edit->widget.x + x1, ' ', option_word_wrap_line_length - edit->start_col);
int len;
tty_setcolor (EDITOR_RIGHT_MARGIN_COLOR);
tty_draw_hline (edit->widget.y + y,
edit->widget.x + x1 + option_word_wrap_line_length + edit->start_col,
' ', end_col + 1 - start_col);
len = option_word_wrap_line_length - edit->start_col;
if (len > 0)
{
tty_draw_hline (edit->widget.y + y, edit->widget.x + x1, ' ', len);
len = end_col + 1 - start_col;
if (len > 0)
{
tty_setcolor (EDITOR_RIGHT_MARGIN_COLOR);
tty_draw_hline (edit->widget.y + y,
edit->widget.x + x1 + option_word_wrap_line_length +
edit->start_col, ' ', len);
}
}
}
if (option_line_state)
@ -610,6 +623,9 @@ render_edit_text (WEdit * edit, long start_row, long start_column, long end_row,
int force = edit->force;
long b;
edit->widget.lines = max (edit->widget.lines, 1);
edit->widget.cols = max (edit->widget.cols, 1);
/*
* If the position of the page has not moved then we can draw the cursor
* character only. This will prevent line flicker when using arrow keys.
@ -829,14 +845,20 @@ edit_scroll_screen_over_cursor (WEdit * edit)
if (b_extreme + t_extreme + 1 > edit->widget.lines)
{
int n;
n = b_extreme + t_extreme;
if (n == 0)
n = 1;
b_extreme = (b_extreme * (edit->widget.lines - 1)) / n;
t_extreme = (t_extreme * (edit->widget.lines - 1)) / n;
}
if (l_extreme + r_extreme + 1 > edit->widget.cols)
{
int n;
n = l_extreme + t_extreme;
if (n == 0)
n = 1;
l_extreme = (l_extreme * (edit->widget.cols - 1)) / n;
r_extreme = (r_extreme * (edit->widget.cols - 1)) / n;
}

View File

@ -266,10 +266,13 @@ edit_dialog_callback (Dlg_head * h, Widget * sender, dlg_msg_t msg, int parm, vo
return MSG_HANDLED;
case DLG_RESIZE:
widget_set_size (&edit->widget, 0, 0, LINES - 1, COLS);
widget_set_size (&buttonbar->widget, LINES - 1, 0, 1, COLS);
widget_set_size (&menubar->widget, 0, 0, 1, COLS);
/* dlg_set_size() is surplus for this case */
h->lines = LINES;
h->cols = COLS;
widget_set_size (&buttonbar->widget, h->lines - 1, h->x, 1, h->cols);
widget_set_size (&menubar->widget, h->y, h->x, 1, h->cols);
menubar_arrange (menubar);
widget_set_size (&edit->widget, h->y, h->x, h->lines - 1, h->cols);
return MSG_HANDLED;
case DLG_ACTION: