From 0fa4a175e024e8d60c5f467795bbaf2d2a12790f Mon Sep 17 00:00:00 2001 From: Aiken Harris Date: Mon, 1 Sep 2025 11:40:48 +0200 Subject: [PATCH] Correct Backspace behavior in input dialog --- xtldr/textui.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/xtldr/textui.c b/xtldr/textui.c index 8ea7e29..a9d4bb5 100644 --- a/xtldr/textui.c +++ b/xtldr/textui.c @@ -856,9 +856,9 @@ BlDisplayInputDialog(IN PWCHAR Caption, /* Check if buffer is not empty */ if(InputFieldLength > 0 && TextPosition > 0 && TextPosition <= InputFieldLength) { - /* Delete character */ - RtlMoveMemory(InputFieldBuffer + TextPosition, InputFieldBuffer + TextPosition + 1, - (InputFieldLength - TextPosition) * sizeof(WCHAR)); + /* Move memory to overwrite the character to the left of the cursor */ + RtlMoveMemory(InputFieldBuffer + TextPosition - 1, InputFieldBuffer + TextPosition, + (InputFieldLength - TextPosition + 1) * sizeof(WCHAR)); /* Decrement length, position and null terminate string */ TextPosition--;