conhost: Fix wrapping search in edit_line_find_in_history.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50000
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2021-01-04 21:13:50 +01:00 committed by Alexandre Julliard
parent 849e521dba
commit 105db4c538
1 changed files with 20 additions and 19 deletions

View File

@ -691,6 +691,7 @@ static void edit_line_find_in_history( struct console *console )
unsigned int len, oldoffset;
WCHAR *line;
if (!console->history_index) return;
if (ctx->history_index && ctx->history_index == console->history_index)
{
start_pos--;
@ -702,7 +703,7 @@ static void edit_line_find_in_history( struct console *console )
line = edit_line_history(console, ctx->history_index);
if (ctx->history_index) ctx->history_index--;
else ctx->history_index = console->history_index;
else ctx->history_index = console->history_index - 1;
len = lstrlenW(line) + 1;
if (len >= ctx->cursor && !memcmp( ctx->buf, line, ctx->cursor * sizeof(WCHAR) ))