Skip to content

Commit

Permalink
Merge pull request #604 from cracyc/winhelp
Browse files Browse the repository at this point in the history
with help_multikey just display the first result and use the 0 index …
  • Loading branch information
otya128 committed Jan 21, 2020
2 parents 40837fd + 71c4e40 commit cd045b0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion winhlp32/hlpfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,10 @@ static HLPFILE_PAGE* HLPFILE_Contents(HLPFILE *hlpfile, ULONG* relative)

if (!hlpfile) return NULL;

page = HLPFILE_PageByOffset(hlpfile, hlpfile->contents_start, relative);
if (hlpfile->version <= 16)
page = HLPFILE_PageByOffset(hlpfile, hlpfile->TOMap[0], relative);
else
page = HLPFILE_PageByOffset(hlpfile, hlpfile->contents_start, relative);
if (!page)
{
page = hlpfile->first_page;
Expand Down
6 changes: 3 additions & 3 deletions winhlp32/winhelp.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ BOOL WINHELP_SearchKey(char keyfile, LPCSTR keywords, LONG type, LPCSTR topic, L
key = strtok(NULL, ";");
}
if (!idn) return FALSE;
if ((type != 1) || (idn > 1))
if (type && ((type != 1) || (idn > 1)))
{
struct index_data idx;
idx.hlpfile = page->file;
Expand Down Expand Up @@ -532,7 +532,7 @@ static LRESULT WINHELP_HandleCommand(HWND hSrcWnd, WINEHELP *wh, BOOL w32)
break;
}
char *keywords = ((char *)wh + wh->ofsData);
if (!WINHELP_SearchKey('K', keywords, 1, NULL, NULL, Globals.active_win, hlpfile))
if (!WINHELP_SearchKey('K', keywords, 0, NULL, NULL, Globals.active_win, hlpfile))
{
HLPFILE_FreeHlpFile(hlpfile);
if (!WINHELP_HasWorkingWindow()) MACRO_Exit();
Expand All @@ -558,7 +558,7 @@ static LRESULT WINHELP_HandleCommand(HWND hSrcWnd, WINEHELP *wh, BOOL w32)
break;
}
MULTIKEYHELPA *mkhelp = (MULTIKEYHELPA *)((char *)wh + wh->ofsData);
if (!WINHELP_SearchKey(mkhelp->mkKeylist, mkhelp->szKeyphrase, 1, NULL, NULL, Globals.active_win, hlpfile))
if (!WINHELP_SearchKey(mkhelp->mkKeylist, mkhelp->szKeyphrase, 0, NULL, NULL, Globals.active_win, hlpfile))
{
HLPFILE_FreeHlpFile(hlpfile);
if (!WINHELP_HasWorkingWindow()) MACRO_Exit();
Expand Down

0 comments on commit cd045b0

Please sign in to comment.