| 3432 | |
| 3433 | #ifdef USE_EXPLORATION_BY_KEYS |
| 3434 | bool IGFD::KeyExplorerFeature::m_LocateItem_Loop(FileDialogInternal& vFileDialogInternal, ImWchar vC) { |
| 3435 | bool found = false; |
| 3436 | |
| 3437 | auto& fdi = vFileDialogInternal.fileManager; |
| 3438 | if (!fdi.IsFilteredListEmpty()) { |
| 3439 | auto countFiles = fdi.GetFilteredListSize(); |
| 3440 | for (size_t i = m_LocateFileByInputChar_lastFileIdx; i < countFiles; i++) { |
| 3441 | auto nfo = fdi.GetFilteredFileAt(i); |
| 3442 | if (nfo.use_count()) { |
| 3443 | if (nfo->fileNameExt_optimized[0] == vC || // lower case search //-V522 |
| 3444 | nfo->fileNameExt[0] == vC) // maybe upper case search |
| 3445 | { |
| 3446 | // float p = ((float)i) * ImGui::GetTextLineHeightWithSpacing(); |
| 3447 | float p = (float)((double)i / (double)countFiles) * ImGui::GetScrollMaxY(); |
| 3448 | ImGui::SetScrollY(p); |
| 3449 | m_LocateFileByInputChar_lastFound = true; |
| 3450 | m_LocateFileByInputChar_lastFileIdx = i; |
| 3451 | m_StartFlashItem(m_LocateFileByInputChar_lastFileIdx); |
| 3452 | |
| 3453 | auto pInfos = fdi.GetFilteredFileAt(m_LocateFileByInputChar_lastFileIdx); |
| 3454 | if (pInfos.use_count()) { |
| 3455 | if (pInfos->fileType.isDir()) //-V522 |
| 3456 | { |
| 3457 | if (fdi.dLGDirectoryMode) // directory chooser |
| 3458 | { |
| 3459 | fdi.SelectFileName(pInfos); |
| 3460 | } |
| 3461 | } else { |
| 3462 | fdi.SelectFileName(pInfos); |
| 3463 | } |
| 3464 | |
| 3465 | found = true; |
| 3466 | break; |
| 3467 | } |
| 3468 | } |
| 3469 | } |
| 3470 | } |
| 3471 | } |
| 3472 | |
| 3473 | return found; |
| 3474 | } |
| 3475 | |
| 3476 | void IGFD::KeyExplorerFeature::m_LocateByInputKey(FileDialogInternal& vFileDialogInternal) { |
| 3477 | ImGuiContext& g = *GImGui; |
nothing calls this directly
no test coverage detected