#173 Bug:file list not indexing correctly onCmdDirUp


My home directory has 106 subdirs and my src
directory has 158. Both go on for many pages in
the panel.

If I scroll down more than a page, enter a subdir,
then back out, the file listing is back at the top,
and the selected subdir that I just came from is
way off the bottom of the panel.

This doesn't seem correct to me. I believe it should
try to locate the selected subdir somewhere in visible

I realize that bumping the down arrow brings it back in
range, but it happens in one big jump, and the up arrow
still leaves it just off the bottom of the panel. The mouse
wheel just scrolls like normal and does nothing to fix the

I find this behavior very disorienting and difficult to use
in sprawling directories like these. And of course they're
always the one's I'm poking around in.

After moving to parent directory, the logic I've used
successfully in the past goes something like this:

/* if selected is near the end of the list
* we end up with selected in the middle
* of the panel and the list running out
* before the end of the panel.
* If selected is > (filecount - panelheight) then offset
* needs to be (filecount - panelheight).
* But we need to know what filecount is first
* so we need to count the entire list first.
if ( filecount <= panelheight ) { // short list
offset = 0; // index into the file list, eg top file shown in panel
} else if ( (filecount - selected) < ( panelheight / 2 ) ) { // near the end of the list
offset = filecount - panelheight + 1;
} else { // somewhere in the middle
offset = selected - ( panelheight / 2 );
if ( offset < 0 )
offset = 0;

Unfortunately, I haven't been able to figure where exactly to
put this snippet to fix the problem. Any clues?


  • miven

    miven - 2012-10-31

    Sorry, that C-style comment is a description of the problem, not the end result of the code snippet. The problem is figuring out what the offset should be, to keep selected in the middle of the panel (if you can), and what goes wrong if you get it wrong.

  • Roland Baudin

    Roland Baudin - 2013-02-09

    This is done in Xfe 1.34.

  • Roland Baudin

    Roland Baudin - 2013-02-09
    • status: open --> closed

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks