I forgot to attach the patch in the original message.

On Fri, 5 Aug 2005, Pavel Tsekov wrote:

> Hello Roland,
>
> There is a small "bug" in the new viewer code. When the viewer is used in
> growing buffer mode it incorrectly displays in the status bar ">= size"
> even if the data source was exhausted and despite the fact the the
> size of the whole buffer is known. Please, take a look at the attached
> patch for a idea how to fix it. Of course you could find a better way to
> solve this since you know the code better.
>
Index: src/view.c
===================================================================
RCS file: /cvsroot/mc/mc/src/view.c,v
retrieving revision 1.313
diff -u -p -r1.313 view.c
--- src/view.c  31 Jul 2005 20:29:35 -0000      1.313
+++ src/view.c  5 Aug 2005 14:02:27 -0000
@@ -403,7 +403,9 @@ view_growbuf_read_until (WView *view, of
 
        if (view->datasource == DS_STDIO_PIPE) {
            nread = fread (p, 1, bytesfree, view->ds_stdio_pipe);
-           if (nread == 0) {
+           if (nread > 0)
+               view->growbuf_lastindex += nread;
+           if (nread < bytesfree) {
                view->growbuf_finished = TRUE;
                (void) pclose (view->ds_stdio_pipe);
                display (view);
@@ -414,14 +416,15 @@ view_growbuf_read_until (WView *view, of
        } else {
            assert (view->datasource == DS_VFS_PIPE);
            nread = mc_read (view->ds_vfs_pipe, p, bytesfree);
-           if (nread == -1 || nread == 0) {
+           if (nread > 0)
+               view->growbuf_lastindex += nread;
+           if (nread == -1 || nread < bytesfree) {
                view->growbuf_finished = TRUE;
                (void) mc_close (view->ds_vfs_pipe);
                view->ds_vfs_pipe = -1;
                return;
            }
        }
-       view->growbuf_lastindex += nread;
     }
 }
 
_______________________________________________
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel

Reply via email to