Module: wine Branch: master Commit: 3a8aad4834c18d459cfa86a2c21be3f5ca18429e URL: https://gitlab.winehq.org/wine/wine/-/commit/3a8aad4834c18d459cfa86a2c21be3f...
Author: Eric Pouech epouech@codeweavers.com Date: Wed Jun 19 09:15:25 2024 +0200
cmd: Move prompt handling into line reading.
Signed-off-by: Eric Pouech epouech@codeweavers.com
---
programs/cmd/wcmdmain.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index d97aff3bcd3..8d854c356bf 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -2540,8 +2540,16 @@ static BOOL node_builder_generate(struct node_builder *builder, CMD_NODE **node)
static WCHAR *fetch_next_line(BOOL feed, BOOL first_line, HANDLE from, WCHAR* buffer) { - if (!context && !first_line) - WCMD_output_asis( WCMD_LoadMessage(WCMD_MOREPROMPT)); + /* display prompt */ + if (interactive && !context) + { + /* native does is this way... not symmetrical wrt. echo_mode */ + if (!first_line) + WCMD_output_asis(WCMD_LoadMessage(WCMD_MOREPROMPT)); + else if (echo_mode) + WCMD_show_prompt(); + } + if (feed && !WCMD_fgets(buffer, MAXSTRING, from)) { buffer[0] = L'\0'; @@ -3999,7 +4007,6 @@ int __cdecl wmain (int argc, WCHAR *argvW[])
/* Read until EOF (which for std input is never, but if redirect in place, may occur */ - if (echo_mode) WCMD_show_prompt(); if (!WCMD_ReadAndParseLine(NULL, &toExecute, GetStdHandle(STD_INPUT_HANDLE))) break; WCMD_process_commands(toExecute, FALSE, FALSE);