fix: image loading

This commit is contained in:
2026-07-04 18:24:49 +02:00
parent c31166c087
commit 96b85f0159
4 changed files with 56 additions and 33 deletions
+7 -8
View File
@@ -2747,10 +2747,9 @@ impl Terminal {
if !placement.suppress_cursor_move
&& !placement.virtual_placement
{
// Move cursor down by (rows - 1) since we're already on the first row
// Then set cursor to the column after the image
let new_row =
self.cursor_row + placement.rows.saturating_sub(1);
// Move cursor to the right and down by the image dimensions
self.cursor_col += placement.cols;
let new_row = self.cursor_row + placement.rows;
if new_row >= self.rows {
// Need to scroll
let scroll_amount = new_row - self.rows + 1;
@@ -2759,11 +2758,11 @@ impl Terminal {
} else {
self.cursor_row = new_row;
}
// Move cursor to after the image (or stay at column 0 of next line)
// Per protocol, cursor ends at the last row of the image
// If cursor is now beyond the right edge, it will be handled by the normal
// cursor movement logic (wrapping/scrolling) if applicable.
log::debug!(
"Cursor moved after image placement: row={} (moved {} rows)",
self.cursor_row, placement.rows.saturating_sub(1)
"Cursor moved after image placement: col={}, row={} (moved {}x{} cells)",
self.cursor_col, self.cursor_row, placement.cols, placement.rows
);
}
}