Make sure the cursor resides inside the viewport. Move the viewport if not. Definition at line 50 of file gui_vfslist.c. 00051 { 00052 struct vfsref *vr; 00053 00054 /* Shortcut - nothing to adjust when the list is empty */ 00055 if (gv->vr_selected == NULL) 00056 return; 00057 00058 /* Three possible cases here */ 00059 if (gv->idx_top > gv->idx_selected) { 00060 /* 00061 * The entry is above the viewport. Move the viewport up 00062 * so we can see it. 00063 */ 00064 gv->vr_top = gv->vr_selected; 00065 gv->idx_top = gv->idx_selected; 00066 } else if (gv->idx_top + gv->winheight <= gv->idx_selected) { 00067 /* 00068 * The entry is below the viewport. Start counting 00069 * backward from the selected entry, so we can keep it 00070 * just in screen. This is faster than counting forward, 00071 * because there could be a lot of items in between. 00072 */ 00073 gv->vr_top = gv->vr_selected; 00074 gv->idx_top = gv->idx_selected; 00075 do { 00076 vr = vfs_list_prev(gv->vr_top); 00077 if (vr == NULL) 00078 break; 00079 gv->vr_top = vr; 00080 gv->idx_top--; 00081 } while (gv->idx_top + gv->winheight - 1 > gv->idx_selected); 00082 } else { 00083 /* 00084 * The item is in reach, but it could be possible that 00085 * there is some blank space at the bottom. Move the 00086 * viewport up, so we fill the terminal as much as 00087 * possible. 00088 */ 00089 while (gv->idx_top + gv->winheight - 1 > vfs_list_items(gv->list)) { 00090 vr = vfs_list_prev(gv->vr_top); 00091 if (vr == NULL) 00092 break; 00093 gv->vr_top = vr; 00094 gv->idx_top--; 00095 } 00096 } 00097 }
Here is the call graph for this function:
![]()
Here is the caller graph for this function:
![]() |
1.6.3