Skip to content

Instantly share code, notes, and snippets.

@tablacus
Last active April 27, 2021 12:20
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tablacus/53d6cbc7df60f52c1f77b0e25611c8e3 to your computer and use it in GitHub Desktop.
Save tablacus/53d6cbc7df60f52c1f77b0e25611c8e3 to your computer and use it in GitHub Desktop.
Jump to the boundary between files and folders
var FV = GetFolderView(Ctrl,pt);
var Items = FV.Items();
var bFolder = !IsFolderEx(Items.Item(0));
var nCount = Items.Count;
var nIndex = Math.floor((nCount - 1) / 2);
var nDiff = nIndex;
while (nDiff) {
if (bFolder ^ IsFolderEx(Items.Item(nIndex))) {
nIndex += nDiff;
} else {
nIndex -= nDiff;
}
nDiff = Math.floor(nDiff / 2);
}
while (bFolder ^ IsFolderEx(Items.Item(nIndex))) {
if (nIndex++ >= nCount) {
break;
};
}
FV.SelectItem(Items.Item(nIndex), SVSI_SELECT | SVSI_DESELECTOTHERS | SVSI_ENSUREVISIBLE | SVSI_FOCUSED);
@tablacus
Copy link
Author

tablacus commented Sep 5, 2017

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment