summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPřemysl Janouch <p.janouch@gmail.com>2013-05-18 00:38:18 +0200
committerPřemysl Janouch <p.janouch@gmail.com>2013-05-18 00:38:18 +0200
commitc017d5b569e3b61e120192ed97b7ab5493aac829 (patch)
treeff85403b7817e30154f1f2be0f974f66ff2ec7c1 /src
parent9c024a57cd43eb10079cb2728a25c76f1a2a967c (diff)
downloadtdv-c017d5b569e3b61e120192ed97b7ab5493aac829.tar.gz
tdv-c017d5b569e3b61e120192ed97b7ab5493aac829.tar.xz
tdv-c017d5b569e3b61e120192ed97b7ab5493aac829.zip
Don't redraw the top line to restore the cursor
Consider this a rather temporary solution.
Diffstat (limited to 'src')
-rw-r--r--src/sdtui.c27
1 files changed, 18 insertions, 9 deletions
diff --git a/src/sdtui.c b/src/sdtui.c
index ff795ea..56259df 100644
--- a/src/sdtui.c
+++ b/src/sdtui.c
@@ -575,6 +575,13 @@ app_search_for_entry (Application *self)
static gboolean
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)
{
case KEY_RESIZE:
@@ -591,28 +598,28 @@ app_process_nonchar_code (Application *self, CursesEvent *event)
{
self->selected = event->mouse.y - 1;
app_redraw_view (self);
- app_redraw_top (self); // FIXME just focus
+ RESTORE_CURSOR
}
break;
case KEY_CTRL_UP:
app_one_entry_up (self);
- app_redraw_top (self); // FIXME just focus
+ RESTORE_CURSOR
break;
case KEY_CTRL_DOWN:
app_one_entry_down (self);
- app_redraw_top (self); // FIXME just focus
+ RESTORE_CURSOR
break;
case KEY_ALT_LEFT:
self->division = (app_get_left_column_width (self) - 1.) / COLS;
app_redraw_view (self);
- app_redraw_top (self); // FIXME just focus
+ RESTORE_CURSOR
break;
case KEY_ALT_RIGHT:
self->division = (app_get_left_column_width (self) + 1.) / COLS;
app_redraw_view (self);
- app_redraw_top (self); // FIXME just focus
+ RESTORE_CURSOR
break;
case KEY_UP:
@@ -623,7 +630,7 @@ app_process_nonchar_code (Application *self, CursesEvent *event)
}
else
app_scroll_up (self, 1);
- app_redraw_top (self); // FIXME just focus
+ RESTORE_CURSOR
break;
case KEY_DOWN:
if ((gint) self->selected < LINES - 2 &&
@@ -634,15 +641,17 @@ app_process_nonchar_code (Application *self, CursesEvent *event)
}
else
app_scroll_down (self, 1);
- app_redraw_top (self); // FIXME just focus
+ RESTORE_CURSOR
break;
case KEY_PPAGE:
app_scroll_up (self, LINES - 1);
- app_redraw_top (self); // FIXME just focus
+ // FIXME selection
+ RESTORE_CURSOR
break;
case KEY_NPAGE:
app_scroll_down (self, LINES - 1);
- app_redraw_top (self); // FIXME just focus
+ // FIXME selection
+ RESTORE_CURSOR
break;
case KEY_HOME: