add reload command with e
authorAli Gholami Rudi <ali@rudi.ir>
Sat, 5 Nov 2011 19:19:27 +0000 (5 22:49 +0330)
committerAli Gholami Rudi <ali@rudi.ir>
Sat, 5 Nov 2011 19:19:27 +0000 (5 22:49 +0330)
Suggested by Sara Fauzia <sfauzia@fas.harvard.edu>.

README
fbpdf.c

diff --git a/README b/README
index 335bcf0..7ca4e81 100644 (file)
--- a/README
+++ b/README
@@ -44,4 +44,5 @@ L             show bottom
 ' '/^D         (space) page down
 ^H/^U          (backspace) page up
 ^L             redraw
+e              reload current file
 ============== ================================================
diff --git a/fbpdf.c b/fbpdf.c
index 3e9edcd..fce0589 100644 (file)
--- a/fbpdf.c
+++ b/fbpdf.c
@@ -101,6 +101,13 @@ static void sigcont(int sig)
        term_setup();
 }
 
+static void reload(void)
+{
+       doc_close(doc);
+       doc = doc_open(filename);
+       showpage(num, head);
+}
+
 static void mainloop(void)
 {
        int step = fb_rows() / PAGESTEPS;
@@ -148,6 +155,9 @@ static void mainloop(void)
                                mark_head[c2] = head;
                        }
                        break;
+               case 'e':
+                       reload();
+                       break;
                case '`':
                case '\'':
                        c2 = readkey();