diff --git a/tools/cmd/diff/render.go b/tools/cmd/diff/render.go index 40e215712..d62a6164f 100644 --- a/tools/cmd/diff/render.go +++ b/tools/cmd/diff/render.go @@ -309,7 +309,7 @@ func image_lines(left_path, right_path string, screen_size screen_size, margin_s } return margin_filler_format(m) + filler } - for i := 0; i < utils.Min(len(left_lines), len(right_lines)); i++ { + for i := 0; i < utils.Max(len(left_lines), len(right_lines)); i++ { left, right := get_line(i, left_lines, removed_margin_format), get_line(i, right_lines, added_margin_format) ll.screen_lines = append(ll.screen_lines, left+right) } diff --git a/tools/cmd/diff/ui.go b/tools/cmd/diff/ui.go index 8f5087067..30562400a 100644 --- a/tools/cmd/diff/ui.go +++ b/tools/cmd/diff/ui.go @@ -322,7 +322,7 @@ func (self *Handler) draw_image_pair(ll *LogicalLine, starting_row int) { } if ll.right_image.key != "" { self.lp.MoveCursorHorizontally(self.logical_lines.margin_size + self.logical_lines.columns/2) - self.draw_image(ll.left_image.key, ll.left_image.count, starting_row) + self.draw_image(ll.right_image.key, ll.right_image.count, starting_row) self.lp.QueueWriteString("\r") } } @@ -344,9 +344,9 @@ func (self *Handler) draw_screen() { ll := self.logical_lines.At(pos.logical_line) is_image := ll != nil && ll.line_type == IMAGE_LINE sl := self.logical_lines.ScreenLineAt(pos) - if is_image && seen_images.Has(pos.logical_line) { + if is_image && !seen_images.Has(pos.logical_line) && pos.screen_line >= ll.image_lines_offset { seen_images.Add(pos.logical_line) - self.draw_image_pair(ll, pos.screen_line) + self.draw_image_pair(ll, pos.screen_line-ll.image_lines_offset) } if self.current_search != nil { sl = self.current_search.markup_line(sl, pos) diff --git a/tools/tui/graphics/collection.go b/tools/tui/graphics/collection.go index 689250bfe..aab637618 100644 --- a/tools/tui/graphics/collection.go +++ b/tools/tui/graphics/collection.go @@ -174,7 +174,7 @@ func (self *ImageCollection) PlaceImageSubRect(lp *loop.Loop, key string, page_s height = utils.Max(0, utils.Min(r.img.Height-top, height)) gc := &GraphicsCommand{} gc.SetAction(GRT_action_display).SetLeftEdge(uint64(left)).SetTopEdge(uint64(top)).SetWidth(uint64(width)).SetHeight(uint64(height)) - gc.SetImageId(r.image_id).SetPlacementId(1) + gc.SetImageId(r.image_id).SetPlacementId(1).SetCursorMovement(GRT_cursor_static) gc.WriteWithPayloadToLoop(lp, nil) }