Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit add26d9

Browse files
malxau-msftmalxau
andauthored
Repaint the drive window after changing drive selection in goto (#445)
Co-authored-by: Malcolm <[email protected]>
1 parent e3075d5 commit add26d9

File tree

1 file changed

+55
-43
lines changed

1 file changed

+55
-43
lines changed

src/wfcomman.c

Lines changed: 55 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -533,12 +533,13 @@ CreateDirWindow(
533533
{
534534
HWND hwndT;
535535
INT dxSplit;
536+
BOOLEAN bDriveChanged;
536537

537538
if (hwndActive == hwndSearch) {
538-
bReplaceOpen = FALSE;
539-
dxSplit = -1;
539+
bReplaceOpen = FALSE;
540+
dxSplit = -1;
540541
} else {
541-
dxSplit = GetSplit(hwndActive);
542+
dxSplit = GetSplit(hwndActive);
542543
}
543544

544545
//
@@ -552,52 +553,63 @@ CreateDirWindow(
552553
return hwndT;
553554
}
554555

556+
bDriveChanged = FALSE;
557+
555558
//
556559
// Are we replacing the contents of the currently active child?
557560
//
558561
if (bReplaceOpen) {
559-
CharUpperBuff(szPath, 1); // make sure
562+
DRIVE drive;
563+
INT i;
560564

561-
DRIVE drive = DRIVEID(szPath);
562-
for (INT i = 0; i<cDrives; i++)
563-
{
564-
if (drive == rgiDrive[i])
565-
{
566-
// if not already selected, do so now
567-
if (i != SendMessage(hwndDriveList, CB_GETCURSEL, i, 0L))
568-
{
569-
SelectToolbarDrive(i);
570-
}
571-
break;
572-
}
573-
}
565+
CharUpperBuff(szPath, 1); // make sure
574566

575-
if (hwndT = HasDirWindow(hwndActive))
576-
{
577-
WCHAR szFileSpec[MAXPATHLEN];
567+
drive = DRIVEID(szPath);
568+
for (i = 0; i<cDrives; i++)
569+
{
570+
if (drive == rgiDrive[i])
571+
{
572+
// if not already selected, do so now
573+
if (i != SendMessage(hwndDriveList, CB_GETCURSEL, i, 0L))
574+
{
575+
SelectToolbarDrive(i);
576+
bDriveChanged = TRUE;
577+
}
578+
break;
579+
}
580+
}
578581

579-
AddBackslash(szPath); // default to all files
580-
SendMessage(hwndT, FS_GETFILESPEC, COUNTOF(szFileSpec), (LPARAM)szFileSpec);
581-
lstrcat(szPath, szFileSpec);
582-
SendMessage(hwndT, FS_CHANGEDISPLAY, CD_PATH, (LPARAM)szPath);
583-
StripFilespec(szPath);
584-
}
582+
if (hwndT = HasDirWindow(hwndActive))
583+
{
584+
WCHAR szFileSpec[MAXPATHLEN];
585585

586-
//
587-
// update the tree if necessary
588-
//
589-
;
590-
if (hwndT = HasTreeWindow(hwndActive))
591-
{
592-
SendMessage(hwndT, TC_SETDRIVE, 0, (LPARAM)(szPath));
593-
}
586+
AddBackslash(szPath); // default to all files
587+
SendMessage(hwndT, FS_GETFILESPEC, COUNTOF(szFileSpec), (LPARAM)szFileSpec);
588+
lstrcat(szPath, szFileSpec);
589+
SendMessage(hwndT, FS_CHANGEDISPLAY, CD_PATH, (LPARAM)szPath);
590+
StripFilespec(szPath);
591+
}
592+
593+
//
594+
// update the tree if necessary
595+
//
594596

595-
//
596-
// Update the status in case we are "reading"
597-
//
598-
UpdateStatus(hwndActive);
597+
if (hwndT = HasTreeWindow(hwndActive))
598+
{
599+
SendMessage(hwndT, TC_SETDRIVE, 0, (LPARAM)(szPath));
600+
}
601+
602+
//
603+
// Update the status in case we are "reading"
604+
//
605+
UpdateStatus(hwndActive);
606+
if (bDriveChanged)
607+
{
608+
InvalidateRect(hwndDriveBar, NULL, TRUE);
609+
UpdateWindow(hwndDriveBar);
610+
}
599611

600-
return hwndActive;
612+
return hwndActive;
601613
}
602614

603615
AddBackslash(szPath); // default to all files
@@ -610,10 +622,10 @@ CreateDirWindow(
610622

611623
// call TC_SETDRIVE like use of CreateTreeWindow in NewTree()
612624
if (hwndActive && (hwndT = HasTreeWindow(hwndActive)))
613-
SendMessage(hwndT,
614-
TC_SETDRIVE,
615-
MAKELONG(MAKEWORD(FALSE, 0), TRUE),
616-
0L);
625+
SendMessage(hwndT,
626+
TC_SETDRIVE,
627+
MAKELONG(MAKEWORD(FALSE, 0), TRUE),
628+
0L);
617629

618630
return hwndActive;
619631
}

0 commit comments

Comments
 (0)