[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
This is a patch against Allegro 3.9.34 WIP from 17-nov-2000. It corrects
the browsing through directories in fsel.c - the 'bug' was introduced with the
file selector stretching. The problem was that after a successful 'cd ..'
the routine which was responsible for displaying the correct part of the
filelist assumed that the visible part of the filelist was 11 lines
high - now it computes the size automatically.
diff -r -U 3 -N allegro.old/src/fsel.c allegro/src/fsel.c
--- allegro.old/src/fsel.c Thu Nov 23 23:31:52 2000
+++ allegro/src/fsel.c Fri Nov 24 10:58:28 2000
@@ -296,6 +296,8 @@
static int fs_edit_proc(int msg, DIALOG *d, int c)
{
char *s = d->dp;
+ int list_size;
+ int found = 0;
char b[512];
int ch, attr;
int i;
@@ -332,13 +334,21 @@
for (i = 0; i<flist->size; i++) {
if (!ustrcmp(updir, flist->name[i])) { /* we got it ! */
file_selector[FS_FILES].d1 = i;
- if (i>11)
- file_selector[FS_FILES].d2 = i-11;
+ /* we have to know the number of visible lines in the filelist */
+ list_size = (file_selector[FS_FILES].h-4) / text_height(font);
+ if (i>list_size)
+ file_selector[FS_FILES].d2 = i-list_size;
else
file_selector[FS_FILES].d2 = 0;
+ found = 1;
break; /* ok, our work is done... */
}
}
+ /* by some strange reason, we didn't find the old directory... */
+ if (!found) {
+ file_selector[FS_FILES].d1 = 0;
+ file_selector[FS_FILES].d2 = 0;
+ }
}
/* and continue... */
SEND_MESSAGE(file_selector+FS_FILES, MSG_DRAW, 0);