diffview

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Copyright 2026 Teradata

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Package diffview provides diff viewing components (stub).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DiffView

type DiffView = Model

DiffView is an alias for Model (for compatibility with usage patterns).

type LineStyle

type LineStyle struct {
	Line       lipgloss.Style
	Number     lipgloss.Style
	LineNumber lipgloss.Style
	Gutter     lipgloss.Style
	GutterSet  string
	Code       lipgloss.Style
	Symbol     lipgloss.Style
}

LineStyle configures a diff line style.

type Model

type Model struct {
	// contains filtered or unexported fields
}

Model is a diff viewer component.

func New

func New() *Model

New creates a new diff viewer.

func (*Model) After

func (m *Model) After(path string, content ...string) *Model

After sets the new content and returns self for chaining.

func (*Model) Before

func (m *Model) Before(path string, content ...string) *Model

Before sets the old content and returns self for chaining.

func (*Model) ChromaStyle

func (m *Model) ChromaStyle(style *chroma.Style) *Model

ChromaStyle sets the chroma style and returns self for chaining.

func (*Model) GetHeight

func (m *Model) GetHeight() int

GetHeight returns the viewer height.

func (*Model) GetWidth

func (m *Model) GetWidth() int

GetWidth returns the viewer width.

func (*Model) Height

func (m *Model) Height(h int) *Model

Height sets the height and returns self for chaining.

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the viewer.

func (*Model) SetContent

func (m *Model) SetContent(old, new string)

SetContent sets the diff content.

func (*Model) SetSize

func (m *Model) SetSize(width, height int)

SetSize sets the viewer size.

func (*Model) SetStyles

func (m *Model) SetStyles(s Styles)

SetStyles sets the styles.

func (*Model) Split

func (m *Model) Split() *Model

Split sets the diff to split view mode.

func (*Model) String

func (m *Model) String() string

String returns the rendered diff as a string.

func (*Model) Style

func (m *Model) Style(s Styles) *Model

Style sets the diff styles and returns self for chaining.

func (*Model) TabWidth

func (m *Model) TabWidth(width int) *Model

TabWidth sets the tab width and returns self for chaining.

func (*Model) Unified

func (m *Model) Unified() *Model

Unified sets the diff to unified view mode.

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (*Model, tea.Cmd)

Update handles messages.

func (*Model) View

func (m *Model) View() string

View renders the diff viewer.

func (*Model) Width

func (m *Model) Width(w int) *Model

Width sets the width and returns self for chaining.

func (*Model) XOffset

func (m *Model) XOffset(x int) *Model

XOffset sets the X offset and returns self for chaining.

func (*Model) YOffset

func (m *Model) YOffset(y int) *Model

YOffset sets the Y offset and returns self for chaining.

type Style

type Style = Styles

Style is an alias for Styles for compatibility.

type Styles

type Styles struct {
	Added       lipgloss.Style
	Removed     lipgloss.Style
	Changed     lipgloss.Style
	Unchanged   lipgloss.Style
	LineNumber  lipgloss.Style
	Header      lipgloss.Style
	DividerLine LineStyle
	MissingLine LineStyle
	EqualLine   LineStyle
	InsertLine  LineStyle
	DeleteLine  LineStyle
}

Styles configures diff viewer appearance.

func DefaultStyles

func DefaultStyles() Styles

DefaultStyles returns default styles.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL