Add hack to allow view loading to have multiple phases
authorJonas Fonseca <fonseca@diku.dk>
Sat, 22 Mar 2008 20:35:31 +0000 (21:35 +0100)
committerJonas Fonseca <fonseca@diku.dk>
Sat, 22 Mar 2008 20:35:31 +0000 (21:35 +0100)
.. by avoiding end_update() call after last read line.

tig.c

diff --git a/tig.c b/tig.c
index f8132fd..2551ba3 100644 (file)
--- a/tig.c
+++ b/tig.c
@@ -2234,8 +2234,8 @@ alloc_error:
        report("Allocation failure");
 
 end:
-       view->ops->read(view, NULL);
-       end_update(view);
+       if (view->ops->read(view, NULL))
+               end_update(view);
        return FALSE;
 }
 
@@ -3077,6 +3077,8 @@ tree_read(struct view *view, char *text)
        enum line_type type;
        bool first_read = view->lines == 0;
 
+       if (!text)
+               return TRUE;
        if (textlen <= SIZEOF_TREE_ATTR)
                return FALSE;