https://git.reactos.org/?p=reactos.git;a=commitdiff;h=0d500b642b435e6175ab4…
commit 0d500b642b435e6175ab4a3d1727c2fac68da5de
Author: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
AuthorDate: Sun Feb 9 00:32:53 2020 +0100
Commit: Hermès Bélusca-Maïto <hermes.belusca-maito(a)reactos.org>
CommitDate: Sun Feb 9 00:38:32 2020 +0100
[CONSRV] Simplify parts of code in the line-input module.
---
win32ss/user/winsrv/consrv/lineinput.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/win32ss/user/winsrv/consrv/lineinput.c
b/win32ss/user/winsrv/consrv/lineinput.c
index 20d66c68e12..2aab09254ef 100644
--- a/win32ss/user/winsrv/consrv/lineinput.c
+++ b/win32ss/user/winsrv/consrv/lineinput.c
@@ -106,11 +106,14 @@ LineInputEdit(PCONSRV_CONSOLE Console,
if (GetConsoleInputBufferMode(Console) & ENABLE_ECHO_INPUT)
{
- for (i = Pos; i < NewSize; i++)
+ if (Pos < NewSize)
{
- TermWriteStream(Console, ActiveBuffer, &Console->LineBuffer[i], 1,
TRUE);
+ TermWriteStream(Console, ActiveBuffer,
+ &Console->LineBuffer[Pos],
+ NewSize - Pos,
+ TRUE);
}
- for (; i < Console->LineSize; i++)
+ for (i = NewSize; i < Console->LineSize; ++i)
{
TermWriteStream(Console, ActiveBuffer, L" ", 1, TRUE);
}
@@ -431,12 +434,10 @@ LineInputKeyDown(PCONSRV_CONSOLE Console,
LineInputSetPos(Console, Console->LineSize);
Console->LineBuffer[Console->LineSize++] = L'\r';
- if (GetConsoleInputBufferMode(Console) & ENABLE_ECHO_INPUT)
+ if ((GetType(Console->ActiveBuffer) == TEXTMODE_BUFFER) &&
+ (GetConsoleInputBufferMode(Console) & ENABLE_ECHO_INPUT))
{
- if (GetType(Console->ActiveBuffer) == TEXTMODE_BUFFER)
- {
- TermWriteStream(Console,
(PTEXTMODE_SCREEN_BUFFER)(Console->ActiveBuffer), L"\r", 1, TRUE);
- }
+ TermWriteStream(Console, (PTEXTMODE_SCREEN_BUFFER)(Console->ActiveBuffer),
L"\r", 1, TRUE);
}
/*
@@ -448,12 +449,10 @@ LineInputKeyDown(PCONSRV_CONSOLE Console,
Console->LineSize < Console->LineMaxSize)
{
Console->LineBuffer[Console->LineSize++] = L'\n';
- if (GetConsoleInputBufferMode(Console) & ENABLE_ECHO_INPUT)
+ if ((GetType(Console->ActiveBuffer) == TEXTMODE_BUFFER) &&
+ (GetConsoleInputBufferMode(Console) & ENABLE_ECHO_INPUT))
{
- if (GetType(Console->ActiveBuffer) == TEXTMODE_BUFFER)
- {
- TermWriteStream(Console,
(PTEXTMODE_SCREEN_BUFFER)(Console->ActiveBuffer), L"\n", 1, TRUE);
- }
+ TermWriteStream(Console,
(PTEXTMODE_SCREEN_BUFFER)(Console->ActiveBuffer), L"\n", 1, TRUE);
}
}
Console->LineComplete = TRUE;