Ticket #2334: quick_view.patch

File quick_view.patch, 1.6 KB (added by andrew_b, 5 years ago)

Patch from #3888

  • src/viewer/actions_cmd.c

    diff --git a/src/viewer/actions_cmd.c b/src/viewer/actions_cmd.c
    index 87743fb8b..0bcfe1b94 100644
    a b mcview_hook (void *v) 
    189189{ 
    190190    WView *view = (WView *) v; 
    191191    WPanel *panel; 
     192    const char* path = NULL; 
     193    const vfs_path_t *vfile = NULL; 
    192194 
    193195    /* If the user is busy typing, wait until he finishes to update the 
    194196       screen */ 
    mcview_hook (void *v) 
    210212 
    211213    mcview_done (view); 
    212214    mcview_init (view); 
    213     mcview_load (view, 0, panel->dir.list[panel->selected].fname, 0, 0, 0); 
     215    path = panel->dir.list[panel->selected].fname; 
     216    vfile = vfs_path_from_str(path); 
     217    if (regex_command_for (view, vfile, "View", NULL) == 0) 
     218        mcview_load (view, NULL, path, 0, 0, 0); 
    214219    mcview_display (view); 
    215220} 
    216221 
  • src/viewer/growbuf.c

    diff --git a/src/viewer/growbuf.c b/src/viewer/growbuf.c
    index c1172b6d6..e9349f465 100644
    a b mcview_growbuf_read_until (WView * view, off_t ofs) 
    218218                return; 
    219219            } 
    220220        } 
    221         else 
     221        else if (view->datasource == DS_VFS_PIPE) 
    222222        { 
    223             g_assert (view->datasource == DS_VFS_PIPE); 
    224223            do 
    225224            { 
    226225                nread = mc_read (view->ds_vfs_pipe, p, bytesfree); 
    mcview_growbuf_read_until (WView * view, off_t ofs) 
    233232                return; 
    234233            } 
    235234        } 
     235        else 
     236        { 
     237            // Skip the rest of file 
     238            nread = bytesfree; 
     239        } 
    236240        short_read = ((size_t) nread < bytesfree); 
    237241        view->growbuf_lastindex += nread; 
    238242    }