From a9a68474f789855e92ded7ddebf10e7b4a282f96 Mon Sep 17 00:00:00 2001
From: James R <justsomejames2@gmail.com>
Date: Fri, 24 Jul 2020 04:06:04 -0700
Subject: [PATCH] Ctrl + Backspace/Delete in Console

---
 src/console.c | 61 ++++++++++++++++++++++++++++++++-------------------
 1 file changed, 38 insertions(+), 23 deletions(-)

diff --git a/src/console.c b/src/console.c
index aac94d473c..387f2cbe98 100644
--- a/src/console.c
+++ b/src/console.c
@@ -835,6 +835,44 @@ boolean CON_Responder(event_t *ev)
 		return true;
 	}
 
+	// backspace and delete command prompt
+	if (input_sel != input_cur)
+	{
+		if (key == KEY_BACKSPACE || key == KEY_DEL)
+		{
+			CON_InputDelSelection();
+			return true;
+		}
+	}
+	else if (key == KEY_BACKSPACE)
+	{
+		if (ctrldown)
+		{
+			input_sel = M_JumpWordReverse(inputlines[inputline], input_cur);
+			CON_InputDelSelection();
+		}
+		else
+			CON_InputDelChar();
+		return true;
+	}
+	else if (key == KEY_DEL)
+	{
+		if (input_cur == input_len)
+			return true;
+
+		if (ctrldown)
+		{
+			input_sel = input_cur + M_JumpWord(&inputlines[inputline][input_cur]);
+			CON_InputDelSelection();
+		}
+		else
+		{
+			++input_cur;
+			CON_InputDelChar();
+		}
+		return true;
+	}
+
 	// ctrl modifier -- changes behavior, adds shortcuts
 	if (ctrldown)
 	{
@@ -1025,29 +1063,6 @@ boolean CON_Responder(event_t *ev)
 		return true;
 	}
 
-	// backspace and delete command prompt
-	if (input_sel != input_cur)
-	{
-		if (key == KEY_BACKSPACE || key == KEY_DEL)
-		{
-			CON_InputDelSelection();
-			return true;
-		}
-	}
-	else if (key == KEY_BACKSPACE)
-	{
-		CON_InputDelChar();
-		return true;
-	}
-	else if (key == KEY_DEL)
-	{
-		if (input_cur == input_len)
-			return true;
-		++input_cur;
-		CON_InputDelChar();
-		return true;
-	}
-
 	// move back in input history
 	if (key == KEY_UPARROW)
 	{
-- 
GitLab