Menu

#167 Deleting next to last Directory entry corrupts the list

1.2
closed
None
Win32-GDI
1.2rc6
2024-11-14
2024-11-14
No

You probably need more than a screen full of directory entries to reproduce this issue.

Go to the next to last item in the list and delete it. Afterwards, the lightbar disappears.

I actually noticed this issue in SCFG and traced it down to this code in uifc32.c ulist() that you wrote:

            if(i+(height-vbrdrsize-1)>=opts) {
                (*bar)=(height-vbrdrsize);

This actually sets (*bar) out of the range of the current list box.

Since I can reproduce the same/similar behavior in SyncTERM, I figured I'd assign it to you here. :-P

1 Attachments

Discussion

  • Rob Swindell

    Rob Swindell - 2024-11-14

    If you arrow down while in this state, the cells below the list window are "hightlighted".

     
  • Stephen James Hurd

    Looks like that's a literal transcription of this code... not sure you can blame me for this one. :D

     
    • Rob Swindell

      Rob Swindell - 2024-11-14

      But that code isn't modifying bar.

       
  • Stephen James Hurd

    Heck, I still don't even know what cur and bar are.

     
    • Rob Swindell

      Rob Swindell - 2024-11-14

      bar is the lightbar offset from the top of the visible list of options (0 being the first visible option). If there are 18 lines (for options) in the list window, the bar should always be between 0 and the list height (the scrollable region of the window) - 1 (e.g. 17 in this example).
      cur is the currently selected "option" index (0 being the first option), cur should always between 0 and the option_count - 1.

       

      Last edit: Rob Swindell 2024-11-14
  • Stephen James Hurd

    Interesting, looks like it only happens with WIN_XTR...

     
  • Stephen James Hurd

    A simple script for playing with this issue:

    load("uifcdefs.js");
    
    var ctx = new uifc.list.CTX();
    
    var opts = [];
    for (i = 1; i < 30; i++)
            opts.push('Option '+i);
    
    uifc.init();
    for (;;) {
            var ret = uifc.list(WIN_ORG|WIN_ACT|WIN_L2R|WIN_T2B|WIN_DEL|WIN_DELACT|WIN_XTR, "Delete well", opts, ctx);
            if (ret == -1)
                    break;
            if (ret & MSK_DEL) {
                    opts.splice(ret & MSK_OFF, 1);
            }
    }
    
     
  • Rob Swindell

    Rob Swindell - 2024-11-14

    Are you close to a solution or I should be working on it too?

     
  • Stephen James Hurd

    Should be fixed in git now.

     
  • Stephen James Hurd

    • status: open --> closed
     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB