()
| 663 | } |
| 664 | |
| 665 | func (ed *DiffTextEditor) Init() { |
| 666 | ed.Editor.Init() |
| 667 | ed.Styler(func(s *styles.Style) { |
| 668 | s.Grow.Set(1, 1) |
| 669 | }) |
| 670 | ed.OnDoubleClick(func(e events.Event) { |
| 671 | pt := ed.PointToRelPos(e.Pos()) |
| 672 | if pt.X >= 0 && pt.X < int(ed.LineNumberOffset) { |
| 673 | newPos := ed.PixelToCursor(pt) |
| 674 | ln := newPos.Ln |
| 675 | dv := ed.diffEditor() |
| 676 | if dv != nil && ed.Buffer != nil { |
| 677 | if ed.Name == "text-a" { |
| 678 | dv.applyDiff(0, ln) |
| 679 | } else { |
| 680 | dv.applyDiff(1, ln) |
| 681 | } |
| 682 | } |
| 683 | e.SetHandled() |
| 684 | return |
| 685 | } |
| 686 | }) |
| 687 | } |
| 688 | |
| 689 | func (ed *DiffTextEditor) diffEditor() *DiffEditor { |
| 690 | return tree.ParentByType[*DiffEditor](ed) |
nothing calls this directly
no test coverage detected