From 758817c3c800ac7961d2fe71582ac6d07936ba8b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 19 Feb 2025 05:08:27 +0530 Subject: [PATCH] Only modify prompt_kind in resize.c --- kitty/history.c | 4 +--- kitty/resize.c | 7 +++++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/kitty/history.c b/kitty/history.c index 829637ed4..fbe9e93ca 100644 --- a/kitty/history.c +++ b/kitty/history.c @@ -638,9 +638,7 @@ historybuf_next_dest_line(HistoryBuf *self, ANSIBuf *as_ansi_buf, Line *src_line history_buf_set_last_char_as_continuation(self, 0, continued); bool needs_clear; index_type idx = historybuf_push(self, as_ansi_buf, &needs_clear); - LineAttrs *a = attrptr(self, idx); - *a = src_line->attrs; - if (continued) a->prompt_kind = UNKNOWN_PROMPT_KIND; + *attrptr(self, idx) = src_line->attrs; init_line(self, idx, dest_line); if (needs_clear) { zero_at_ptr_count(dest_line->cpu_cells, dest_line->xnum); diff --git a/kitty/resize.c b/kitty/resize.c index f684d5899..78980b788 100644 --- a/kitty/resize.c +++ b/kitty/resize.c @@ -87,8 +87,10 @@ init_src_line(Rewrap *r) { static void first_dest_line(Rewrap *r) { - if (r->src.hb_count) historybuf_next_dest_line(r->dest.hb, r->as_ansi_buf, &r->src.line, 0, &r->dest.line, false); - else { + if (r->src.hb_count) { + historybuf_next_dest_line(r->dest.hb, r->as_ansi_buf, &r->src.line, 0, &r->dest.line, false); + r->src.line.attrs.prompt_kind = UNKNOWN_PROMPT_KIND; + } else { r->dest_line_from_linebuf = true; linebuf_init_line_at(r->dest.lb, 0, &r->dest.line); set_dest_line_attrs(0); @@ -133,6 +135,7 @@ next_dest_line(Rewrap *r, bool continued) { } } else { r->dest.y = historybuf_next_dest_line(r->dest.hb, r->as_ansi_buf, &r->src.line, r->dest.y, &r->dest.line, continued); + r->src.line.attrs.prompt_kind = UNKNOWN_PROMPT_KIND; } if (r->sb->line_attrs[0].has_dirty_text) { CPUCell *cpu_cells; GPUCell *gpu_cells;