[Bug 59591] New: Total Commander brief view jumps upward after rename due to inconsistent top_item clamping in comctl32_v6 listbox
http://bugs.winehq.org/show_bug.cgi?id=59591 Bug ID: 59591 Summary: Total Commander brief view jumps upward after rename due to inconsistent top_item clamping in comctl32_v6 listbox Product: Wine Version: 11.4 Hardware: x86-64 OS: Linux Status: UNCONFIRMED Severity: normal Priority: P2 Component: comctl32 Assignee: wine-bugs@list.winehq.org Reporter: lldmakhbfcrmqyluns@nesopf.com Distribution: --- Reproduced with Wine devel 11.4 on Kubuntu 25.10 using Total Commander in brief view. Steps to reproduce: 1. Start Total Commander. 2. Open a directory with enough files to make the brief view span multiple columns. 3. Switch the panel to brief view. 4. Scroll to the bottom / end of the file list. 5. Rename the last file (Enter) or otherwise trigger a content refresh. 6. Observe that the panel jumps upward instead of keeping the previous scroll position. Expected result: The panel should keep the same visible position after the rename / redraw. Actual result: The top item is moved upwards after the redraw. Investigation: The affected control is not user32 listbox but the comctl32_v6 listbox implementation in: dlls/comctl32_v6/listbox.c The problem is that top_item is clamped inconsistently in two different code paths: 1. LISTBOX_SetTopItem() clamps top_item via: LISTBOX_GetMaxTopIndex( descr ) 2. LISTBOX_SetRedraw() later reclamps it via: descr->nb_items - descr->page_size In brief / multi-column listbox mode these two values are not equivalent. In the failing case I traced, LISTBOX_SetTopItem() restored: top_item = 140 for a list with: nb_items = 157 Later LISTBOX_SetRedraw() reclamped the same listbox to: top_item = 122 That secondary clamp caused the visible upward jump. Proposed fix: Use LISTBOX_GetMaxTopIndex( descr ) in LISTBOX_SetRedraw() as well, so both code paths use the same limit. Patch: diff --git a/dlls/comctl32_v6/listbox.c b/dlls/comctl32_v6/listbox.c index 7dec0e2d999..d2029cca434 100644 --- a/dlls/comctl32_v6/listbox.c +++ b/dlls/comctl32_v6/listbox.c @@ -730,8 +730,7 @@ static void LISTBOX_SetRedraw( LB_DESCR *descr, BOOL on ) InvalidateRect(descr->self, NULL, TRUE); if ((descr->top_item + descr->page_size) > descr->nb_items) { /* reset top of page if less than number of items/page */ - descr->top_item = descr->nb_items - descr->page_size; - if (descr->top_item < 0) descr->top_item = 0; + descr->top_item = LISTBOX_GetMaxTopIndex( descr ); } descr->style &= ~LBS_DISPLAYCHANGED; } This fixes the issue locally for me: after rebuilding and replacing comctl32_v6.dll, the panel no longer jumps upward after rename/refresh in brief view. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59591 --- Comment #1 from T_Im <lldmakhbfcrmqyluns@nesopf.com> --- FYI: I'm not a C dev and don't plan to submit a formal patch. I'm just sharing analysis to help fix the bug for everyone. Feel free to use or rewrite the code. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59591 T_Im <lldmakhbfcrmqyluns@nesopf.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |stefan@codeweavers.com -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59591 T_Im <lldmakhbfcrmqyluns@nesopf.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |zzhang@codeweavers.com -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
http://bugs.winehq.org/show_bug.cgi?id=59591 --- Comment #2 from T_Im <lldmakhbfcrmqyluns@nesopf.com> --- Added Stefan Dösinger and Zhiyi Zhang to CC as recent contributors to these files. -- Do not reply to this email, post in Bugzilla using the above URL to reply. You are receiving this mail because: You are watching all bug changes.
participants (1)
-
WineHQ Bugzilla