From 60eccf1c150285a236e6405f2fb4b7a150698ab6 Mon Sep 17 00:00:00 2001 From: augustin64 Date: Fri, 17 Nov 2023 11:08:17 +0100 Subject: [PATCH] input: Add Begin & End --- src/input.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/input.cpp b/src/input.cpp index 45f0df8..4f0d436 100644 --- a/src/input.cpp +++ b/src/input.cpp @@ -92,6 +92,19 @@ string get_line_with_hist(vector history, int line_num) { if (input_index < (int)input.size()) cout << "\033[" << input.size() - input_index << "D"; } + break; + } case 'H': { //* Begin + if (input_index > 0) { + cout << "\033[" << input_index << "D"; // Go left input_index + input_index = 0; + } + break; + } case 'F': { //* End + if (input_index < (int)input.size()) { + cout << "\033[" << (input.size() - input_index) << "C"; // Go right input.size() - input_index + input_index = input.size(); + } + break; } } } else if (ch == '\b' || ch == 127) { //* Backspace