mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-30 14:53:11 +00:00
reader: Remove superfluous while-loop
It's possible this was useful at some point, but now it just always inserts the string the first time.
This commit is contained in:
parent
3262c5ff44
commit
eb41965ac3
1 changed files with 4 additions and 12 deletions
|
@ -1127,19 +1127,11 @@ void reader_data_t::remove_backward() {
|
||||||
/// using syntax highlighting, etc.
|
/// using syntax highlighting, etc.
|
||||||
/// Returns true if the string changed.
|
/// Returns true if the string changed.
|
||||||
bool reader_data_t::insert_string(editable_line_t *el, const wcstring &str) {
|
bool reader_data_t::insert_string(editable_line_t *el, const wcstring &str) {
|
||||||
size_t len = str.size();
|
if (str.empty()) return false;
|
||||||
if (len == 0) return false;
|
|
||||||
|
|
||||||
// Start inserting.
|
|
||||||
size_t cursor = 0;
|
|
||||||
while (cursor < len) {
|
|
||||||
// Insert from the cursor up to but not including the range end.
|
|
||||||
el->insert_string(str, cursor, len - cursor);
|
|
||||||
|
|
||||||
|
el->insert_string(str, 0, str.size());
|
||||||
update_buff_pos(el, el->position);
|
update_buff_pos(el, el->position);
|
||||||
command_line_changed(el);
|
command_line_changed(el);
|
||||||
cursor = len;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (el == &command_line) {
|
if (el == &command_line) {
|
||||||
suppress_autosuggestion = false;
|
suppress_autosuggestion = false;
|
||||||
|
|
Loading…
Reference in a new issue