diff options
Diffstat (limited to 'core/term')
| -rw-r--r-- | core/term/terminal.zig | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/core/term/terminal.zig b/core/term/terminal.zig index 45c01841..88eb1443 100644 --- a/core/term/terminal.zig +++ b/core/term/terminal.zig @@ -927,9 +927,19 @@ pub fn prompt(state: ?*State) Term.Prompt { // Nothing further right counts: that is where fish draws a right // prompt, and fish suggests nothing on an empty line. const empty = ready and empty: { + var prompted = false; const row = cursor.page_pin.cells(.all); - for (row[0..@min(cursor.x + 1, row.len)]) |cell| + for (row[0..@min(cursor.x + 1, row.len)]) |cell| { if (cell.semantic_content == .input and !cell.isEmpty()) break :empty false; + prompted = prompted or cell.semantic_content == .prompt; + } + // A row with no prompt on it, begun by a newline in the input: the + // line above was taken, its Enter echoed and the command's C still + // to come (bash writes them apart), so it is typed still. + if (!prompted and cursor.page_row.semantic_prompt == .prompt_continuation) if (cursor.page_pin.up(1)) |above| { + for (above.cells(.all)) |cell| + if (cell.semantic_content == .input and !cell.isEmpty()) break :empty false; + }; break :empty true; }; return .{ |
