From b2a249400843f57790f2b70df12235acde935ba3 Mon Sep 17 00:00:00 2001 From: Bob Nystrom Date: Thu, 14 Feb 2019 07:33:30 -0800 Subject: [PATCH] Regenerate REPL include. --- src/module/repl.wren.inc | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/module/repl.wren.inc b/src/module/repl.wren.inc index 7d355cf4..e14d33f3 100644 --- a/src/module/repl.wren.inc +++ b/src/module/repl.wren.inc @@ -73,6 +73,15 @@ static const char* replModuleSource = " deleteLeft()\n" " } else if (byte >= Chars.space && byte <= Chars.tilde) {\n" " insertChar(byte)\n" +" } else if (byte == Chars.ctrlW) { // Handle Ctrl+w\n" +" // Delete trailing spaces\n" +" while (_cursor != 0 && _line[_cursor - 1] == \" \") {\n" +" deleteLeft()\n" +" }\n" +" // Delete until the next space\n" +" while (_cursor != 0 && _line[_cursor - 1] != \" \") {\n" +" deleteLeft()\n" +" }\n" " } else {\n" " // TODO: Other shortcuts?\n" " System.print(\"Unhandled key-code [dec]: %(byte)\")\n" @@ -110,6 +119,14 @@ static const char* replModuleSource = " previousHistory()\n" " } else if (byte == EscapeBracket.down) {\n" " nextHistory()\n" +" } else if (byte == EscapeBracket.delete) {\n" +" deleteRight()\n" +" // Consume extra 126 character generated by delete\n" +" Stdin.readByte()\n" +" } else if (byte == EscapeBracket.end) {\n" +" _cursor = _line.count\n" +" } else if (byte == EscapeBracket.home) {\n" +" _cursor = 0\n" " }\n" " }\n" "\n" @@ -405,6 +422,7 @@ static const char* replModuleSource = " static ctrlN { 0x0e }\n" " static ctrlP { 0x10 }\n" " static ctrlU { 0x15 }\n" +" static ctrlW { 0x17 }\n" " static escape { 0x1b }\n" " static space { 0x20 }\n" " static bang { 0x21 }\n" @@ -472,10 +490,13 @@ static const char* replModuleSource = "}\n" "\n" "class EscapeBracket {\n" +" static delete { 0x33 }\n" " static up { 0x41 }\n" " static down { 0x42 }\n" " static right { 0x43 }\n" " static left { 0x44 }\n" +" static end { 0x46 }\n" +" static home { 0x48 }\n" "}\n" "\n" "class Token {\n"