Teach up-line to cross empty lines

The line offset of a trailing newline on the commandline was computed incorrectly.
As a result, up-arrow did not work for a commandline like the one inserted by:

	commandline -i echo '' ''

Note this and the previous commit in the changelog.
This commit is contained in:
Johannes Altmanninger
2020-08-29 11:07:12 +02:00
parent ac60522373
commit cf075b4179
3 changed files with 4 additions and 3 deletions

View File

@@ -3236,8 +3236,8 @@ void reader_data_t::handle_readline_command(readline_cmd_t c, readline_loop_stat
assert(base_pos_new != static_cast<size_t>(-1) &&
base_pos_old != static_cast<size_t>(-1));
int indent_old = indents.at(base_pos_old);
int indent_new = indents.at(base_pos_new);
int indent_old = indents.at(std::min(indents.size() - 1, base_pos_old));
int indent_new = indents.at(std::min(indents.size() - 1, base_pos_new));
size_t line_offset_old = el->position() - base_pos_old;
size_t total_offset_new = parse_util_get_offset(