Don't redraw the top line to restore the cursor

Consider this a rather temporary solution.
This commit is contained in:
Přemysl Eric Janouch 2013-05-18 00:38:18 +02:00
parent 9c024a57cd
commit c017d5b569
1 changed files with 18 additions and 9 deletions

View File

@ -575,6 +575,13 @@ app_search_for_entry (Application *self)
static gboolean static gboolean
app_process_nonchar_code (Application *self, CursesEvent *event) app_process_nonchar_code (Application *self, CursesEvent *event)
{ {
int last_x, last_y;
getyx (stdscr, last_y, last_x);
#define RESTORE_CURSOR \
move (last_y, last_x); \
refresh ();
switch (event->code) switch (event->code)
{ {
case KEY_RESIZE: case KEY_RESIZE:
@ -591,28 +598,28 @@ app_process_nonchar_code (Application *self, CursesEvent *event)
{ {
self->selected = event->mouse.y - 1; self->selected = event->mouse.y - 1;
app_redraw_view (self); app_redraw_view (self);
app_redraw_top (self); // FIXME just focus RESTORE_CURSOR
} }
break; break;
case KEY_CTRL_UP: case KEY_CTRL_UP:
app_one_entry_up (self); app_one_entry_up (self);
app_redraw_top (self); // FIXME just focus RESTORE_CURSOR
break; break;
case KEY_CTRL_DOWN: case KEY_CTRL_DOWN:
app_one_entry_down (self); app_one_entry_down (self);
app_redraw_top (self); // FIXME just focus RESTORE_CURSOR
break; break;
case KEY_ALT_LEFT: case KEY_ALT_LEFT:
self->division = (app_get_left_column_width (self) - 1.) / COLS; self->division = (app_get_left_column_width (self) - 1.) / COLS;
app_redraw_view (self); app_redraw_view (self);
app_redraw_top (self); // FIXME just focus RESTORE_CURSOR
break; break;
case KEY_ALT_RIGHT: case KEY_ALT_RIGHT:
self->division = (app_get_left_column_width (self) + 1.) / COLS; self->division = (app_get_left_column_width (self) + 1.) / COLS;
app_redraw_view (self); app_redraw_view (self);
app_redraw_top (self); // FIXME just focus RESTORE_CURSOR
break; break;
case KEY_UP: case KEY_UP:
@ -623,7 +630,7 @@ app_process_nonchar_code (Application *self, CursesEvent *event)
} }
else else
app_scroll_up (self, 1); app_scroll_up (self, 1);
app_redraw_top (self); // FIXME just focus RESTORE_CURSOR
break; break;
case KEY_DOWN: case KEY_DOWN:
if ((gint) self->selected < LINES - 2 && if ((gint) self->selected < LINES - 2 &&
@ -634,15 +641,17 @@ app_process_nonchar_code (Application *self, CursesEvent *event)
} }
else else
app_scroll_down (self, 1); app_scroll_down (self, 1);
app_redraw_top (self); // FIXME just focus RESTORE_CURSOR
break; break;
case KEY_PPAGE: case KEY_PPAGE:
app_scroll_up (self, LINES - 1); app_scroll_up (self, LINES - 1);
app_redraw_top (self); // FIXME just focus // FIXME selection
RESTORE_CURSOR
break; break;
case KEY_NPAGE: case KEY_NPAGE:
app_scroll_down (self, LINES - 1); app_scroll_down (self, LINES - 1);
app_redraw_top (self); // FIXME just focus // FIXME selection
RESTORE_CURSOR
break; break;
case KEY_HOME: case KEY_HOME: