input: Add Begin & End
This commit is contained in:
parent
9b0c3900f8
commit
60eccf1c15
@ -92,6 +92,19 @@ string get_line_with_hist(vector<string> 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
|
||||
|
Loading…
Reference in New Issue
Block a user