{"modulePath":"github.com/oligo/gvcode","version":"v0.8.2","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package diff\n\n## Types\n\n```go\ntype DiffPopup struct {\n\t// Hunk is the diff hunk to display.\n\tHunk *providers.DiffHunk\n\n\t// Colors defines the color scheme.\n\tColors PopupColors\n\n\t// TextSize is the size of the text.\n\tTextSize unit.Sp\n\n\t// ShowStageButton controls whether to show the stage button.\n\tShowStageButton bool\n\n\t// MaxHeight is the maximum height of the popup.\n\tMaxHeight unit.Dp\n\t// contains filtered or unexported fields\n}\n```\nDiffPopup displays a diff hunk with actions to revert or stage changes.\n\n```go\nfunc NewDiffPopup(hunk *providers.DiffHunk, textSize unit.Sp, popupLine int) *DiffPopup\n```\nNewDiffPopup creates a new diff popup for the given hunk.\n\n```go\nfunc (p *DiffPopup) Layout(gtx layout.Context, th *material.Theme) layout.Dimensions\n```\nLayout renders the diff popup.\n\n```go\nfunc (p *DiffPopup) PopupLine() int\n```\n\n```go\nfunc (p *DiffPopup) Update(gtx layout.Context) (PopupEvent, bool)\n```\nUpdate processes events and returns any action taken.\n\n```go\ntype GitDiff struct {\n\t// contains filtered or unexported fields\n}\n```\nGitDiff is a helper that can be used to parse git diff output. Use the NewGitDiff function to build a new instance to make sure we are dealing with a real git repository.\n\n```go\nfunc NewGitDiff(filePath string) *GitDiff\n```\n\n```go\nfunc (d *GitDiff) ParseDiff(content []byte) []*providers.DiffHunk\n```\nParseDiff diffs the given buffer content against HEAD. All hunks are marked Staged if the buffer matches the index (staged) version, meaning the user hasn't made further edits beyond what's staged.\n\n```go\ntype PopupAction int\n```\nPopupAction represents an action that can be performed on a diff hunk.\n\n```go\nconst (\n\t// ActionNone indicates no action was taken.\n\tActionNone PopupAction = iota\n\t// DiffActionRevert indicates the user wants to revert the changes.\n\tActionRevert\n\t// ActionStage indicates the user wants to stage the changes.\n\tActionStage\n\t// ActionClose indicates the user closed the popup.\n\tActionClose\n)\n```\n\n```go\ntype PopupColors struct {\n\t// Background is the popup background color.\n\tBackground gvcolor.Color\n\t// Border is the popup border color.\n\tBorder gvcolor.Color\n\t// AddedBackground is the background for added lines.\n\tAddedBackground gvcolor.Color\n\t// AddedText is the text color for added lines.\n\tAddedText gvcolor.Color\n\t// DeletedBackground is the background for deleted lines.\n\tDeletedBackground gvcolor.Color\n\t// DeletedText is the text color for deleted lines.\n\tDeletedText gvcolor.Color\n\t// ButtonBackground is the button background color.\n\tButtonBackground gvcolor.Color\n\t// ButtonText is the button text color.\n\tButtonText gvcolor.Color\n\t// HeaderText is the header text color.\n\tHeaderText gvcolor.Color\n}\n```\nPopupColors defines the color scheme for the diff popup.\n\n```go\nfunc DefaultPopupColors() PopupColors\n```\nDefaultPopupColors returns the default color scheme for the diff popup.\n\n```go\ntype PopupEvent struct {\n\tAction PopupAction\n\tHunk   *providers.DiffHunk\n}\n```\nPopupEvent is emitted when the user interacts with the diff popup.\n\n","path":"github.com/oligo/gvcode/addons/diff","name":"diff","synopsis":"","isRedistributable":true}
