Add contextual offline help to Files

Refs #131
This commit is contained in:
agrynco committed 2026-11-25 23:29:30 +02:00
1 parent a5a5724513
commit f4dcd0efd9
9 files changed
+352 -8

No files matched your search

+13 -3
View File
@@ -49,6 +49,7 @@
#include "files_menu_navigation.h"
#include "files_text_preferences.h"
#include "files_appearance.h"
#include "files_help.h"
#include "files_menu_paint.h"
#include "files_dropdown_paint.h"
#include "files_scrollbar.h"
@@ -2429,6 +2430,11 @@ void handleTerminalPromptInput(HWND owner,std::wstring_view action)
const auto key=std::find_if(std::begin(keys),std::end(keys),
[action](const auto &binding){ return binding.first==action; });
if(key==std::end(keys) || handleCompletionKey(key->second,0)) return;
if(key->second==VK_F1)
{
PostMessageW(owner,ks::files::filesHelpRequest,0,0);
return;
}
const auto character=key->second==VK_BACK || key->second==VK_ESCAPE;
SendMessageW(terminalInput,character?WM_CHAR:WM_KEYDOWN,key->second,0);
}
@@ -3933,6 +3939,7 @@ void showProcesses(HWND owner,std::vector<fs::path> paths={});
bool gitChangesAvailable(const Panel &panel);
void openGitChanges(HWND owner,const Panel &panel);
void showEnvironmentPanel(HWND owner);
void showFilesHelp(HWND owner,ks::files::FilesHelpTopic topic);
void editFilesKeySchemes(HWND owner,FilesKey initial,FilesKeySettings *pending=nullptr);
void showCommandHistory(HWND owner);
@@ -3989,6 +3996,7 @@ void selectDrive()
else if(menuIndex==2 && row==19) showCommandHistory(owner);
else if(menuIndex==2 && row==20) editFilesKeySchemes(owner,FilesKey::Refresh);
else if(menuIndex==2 && row==21) editFilesAppearance(owner,terminalVisible?AppearanceArea::terminal:AppearanceArea::panels);
else if(menuIndex==2 && row==22) showFilesHelp(owner,terminalVisible?ks::files::FilesHelpTopic::terminal:ks::files::FilesHelpTopic::panels);
else if(menuIndex==1 && row==4) createArchive(owner,panels[active]);
else if(menuIndex==1 && row==5) showPanelItemProperties(owner,panels[active]);
else if(menuIndex==1 && row==6) showPanelLockProcesses(owner,panels[active]);
@@ -8338,7 +8346,7 @@ void openMenu(HWND window, int index)
filesKeyMenuLabel(FilesKey::FullPath),L"Space Analyzer",filesKeyMenuLabel(FilesKey::HexView),
L"Viewer bookmarks…",L"Processes…",L"Git Changes…",L"Environment Variables…",filesKeyMenuLabel(FilesKey::Swap),
filesKeyMenuLabel(FilesKey::History),L"Keyboard shortcuts…",
terminalVisible?L"Terminal appearance…":L"Panel appearance…"};
terminalVisible?L"Terminal appearance…":L"Panel appearance…",L"Help…\tF1"};
}
const auto &panel=panels[active];
const bool remoteResults=remoteSearchResults(panel);
@@ -8385,7 +8393,7 @@ void openMenu(HWND window, int index)
}
if(quickViewWindow || (!panels[active].peer && !panels[active].ftp)) commandActions.push_back(10);
if(panels[active].peer) commandActions.insert(commandActions.end(),{-1,6,7});
commandActions.insert(commandActions.end(),{-1,19,20,21});
commandActions.insert(commandActions.end(),{-1,19,20,21,22});
}
else
for(size_t i=0;i<rows.size();++i) commandActions.push_back(static_cast<int>(i));
@@ -9452,6 +9460,8 @@ LRESULT CALLBACK filesWindow(HWND window, UINT message, WPARAM wp, LPARAM lp)
}
return DefWindowProcW(window, message, wp, lp);
}
#include "files_help.inl"
}
int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
@@ -9523,7 +9533,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE, PWSTR, int show)
{
if(GetForegroundWindow()==window || IsChild(window,GetFocus())) restoreCommandFocus();
if(GetMessageW(&message,nullptr,0,0)<=0) break;
if(handleComparisonMessage(message)) continue;
if(handleFilesHelpMessage(message) || handleComparisonMessage(message)) continue;
if(message.message==WM_KEYDOWN && message.wParam==VK_TAB &&
(GetKeyState(VK_CONTROL)&0x8000) && !(GetKeyState(VK_MENU)&0x8000) &&
ks::files::cycleTextWindows(GetAncestor(message.hwnd,GA_ROOT),(GetKeyState(VK_SHIFT)&0x8000)!=0))