From 1a39fc81ebdc96e2017ef816cb8b3fd4e1ab16f1 Mon Sep 17 00:00:00 2001 From: Chenguang Wang Date: Sun, 4 Jun 2023 22:01:18 -0700 Subject: [PATCH] support fish-shell-style C-e for accepting history suggestion --- PSReadLine/Movement.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/PSReadLine/Movement.cs b/PSReadLine/Movement.cs index da52230e6..255ecdcf5 100644 --- a/PSReadLine/Movement.cs +++ b/PSReadLine/Movement.cs @@ -18,9 +18,19 @@ public partial class PSConsoleReadLine /// If the input has multiple lines, move to the end of the current line, /// or if already at the end of the line, move to the end of the input. /// If the input has a single line, move to the end of the input. + /// If already at the end of input, accept edit suggestion. /// public static void EndOfLine(ConsoleKeyInfo? key = null, object arg = null) { + if (TryGetArgAsInt(arg, out var numericArg, 1)) + { + if (_singleton._current == _singleton._buffer.Length && numericArg > 0) + { + AcceptSuggestion(key, arg); + return; + } + } + int i = _singleton._current; for (; i < _singleton._buffer.Length; i++) {