Code

Cleanup and fix the main loop to make view point to the current view
authorJonas Fonseca <fonseca@diku.dk>
Sat, 11 Oct 2008 12:14:48 +0000 (14:14 +0200)
committerJonas Fonseca <fonseca@diku.dk>
Sat, 11 Oct 2008 12:14:48 +0000 (14:14 +0200)
tig.c

diff --git a/tig.c b/tig.c
index 84e7bfc3b98864141466d49807fc43275ced2fc0..507ecdbf5c6a3750e568a7505e1ef4614b3fb5d5 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -6073,7 +6073,7 @@ main(int argc, const char *argv[])
        if (load_refs() == ERR)
                die("Failed to load refs.");
 
-       for (i = 0; i < ARRAY_SIZE(views) && (view = &views[i]); i++)
+       foreach_view (view, i)
                view->cmd_env = getenv(view->cmd_env);
 
        init_display();
@@ -6084,6 +6084,7 @@ main(int argc, const char *argv[])
 
                foreach_view (view, i)
                        update_view(view);
+               view = display[current_view];
 
                /* Refresh, accept single keystroke of input */
                key = wgetch(status_win);
@@ -6095,7 +6096,7 @@ main(int argc, const char *argv[])
                        continue;
                }
 
-               request = get_keybinding(display[current_view]->keymap, key);
+               request = get_keybinding(view->keymap, key);
 
                /* Some low-level request handling. This keeps access to
                 * status_win restricted. */