terminal: address todo to re-resolve 905

This commit is contained in:
Mitchell Hashimoto
2024-03-25 11:20:28 -07:00
parent efa18d6971
commit fe43462eb3

View File

@ -1890,35 +1890,39 @@ pub fn eraseDisplay(
// at a prompt scrolls the screen contents prior to clearing. // at a prompt scrolls the screen contents prior to clearing.
// Most shells send `ESC [ H ESC [ 2 J` so we can't just check // Most shells send `ESC [ H ESC [ 2 J` so we can't just check
// our current cursor position. See #905 // our current cursor position. See #905
// if (self.active_screen == .primary) at_prompt: { if (self.active_screen == .primary) at_prompt: {
// // Go from the bottom of the viewport up and see if we're // Go from the bottom of the active up and see if we're
// // at a prompt. // at a prompt.
// const viewport_max = Screen.RowIndexTag.viewport.maxLen(&self.screen); const active_br = self.screen.pages.getBottomRight(
// for (0..viewport_max) |y| { .active,
// const bottom_y = viewport_max - y - 1; ) orelse break :at_prompt;
// const row = self.screen.getRow(.{ .viewport = bottom_y }); var it = active_br.rowIterator(
// if (row.isEmpty()) continue; .left_up,
// switch (row.getSemanticPrompt()) { self.screen.pages.getTopLeft(.active),
// // If we're at a prompt or input area, then we are at a prompt. );
// .prompt, while (it.next()) |p| {
// .prompt_continuation, const row = p.rowAndCell().row;
// .input, switch (row.semantic_prompt) {
// => break, // If we're at a prompt or input area, then we are at a prompt.
// .prompt,
// // If we have command output, then we're most certainly not .prompt_continuation,
// // at a prompt. .input,
// .command => break :at_prompt, => break,
//
// // If we don't know, we keep searching. // If we have command output, then we're most certainly not
// .unknown => {}, // at a prompt.
// } .command => break :at_prompt,
// } else break :at_prompt;
// // If we don't know, we keep searching.
// self.screen.scroll(.{ .clear = {} }) catch { .unknown => {},
// // If we fail, we just fall back to doing a normal clear }
// // so we don't worry about the error. } else break :at_prompt;
// };
// } self.screen.scrollClear() catch {
// If we fail, we just fall back to doing a normal clear
// so we don't worry about the error.
};
}
// All active area // All active area
self.screen.clearRows( self.screen.clearRows(