Code

Add notice about empty pager view
authorJonas Fonseca <fonseca@diku.dk>
Tue, 29 May 2007 14:11:58 +0000 (16:11 +0200)
committerJonas Fonseca <fonseca@diku.dk>
Tue, 29 May 2007 14:11:58 +0000 (16:11 +0200)
Similar to notice for blob view, mention when there is no pager content
to view and suggest the user to open the prompt to run a command.

tig.c

diff --git a/tig.c b/tig.c
index 45e47b9da6f3a8666ad08f822551a4c884d8ae48..4b4a8c201317be91a8ccaa0d43f1a895dbbe53e1 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -2152,13 +2152,23 @@ view_driver(struct view *view, enum request request)
                               get_key(REQ_VIEW_TREE));
                        break;
                }
-               /* Fall-through */
+               open_view(view, request, OPEN_DEFAULT);
+               break;
+
+       case REQ_VIEW_PAGER:
+               if (!VIEW(REQ_VIEW_PAGER)->lines) {
+                       report("No pager content, press %s to run command from prompt",
+                              get_key(REQ_PROMPT));
+                       break;
+               }
+               open_view(view, request, OPEN_DEFAULT);
+               break;
+
        case REQ_VIEW_MAIN:
        case REQ_VIEW_DIFF:
        case REQ_VIEW_LOG:
        case REQ_VIEW_TREE:
        case REQ_VIEW_HELP:
-       case REQ_VIEW_PAGER:
                open_view(view, request, OPEN_DEFAULT);
                break;