Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,10 @@ Other settings:
standard input, for example `"claude -p --model sonnet"`
- `diff_signs`: `true` marks changed lines with `+` and `-`, in place of a coloured bar
- `cursor_line`: `false` turns off the tint of the line at the cursor
- `renderer`: `"kitty"` draws the screen as pictures with the kitty graphics
protocol, which Rex supports. A line changes at once, so the screen does not
flicker, and box lines join with no gap. The keys and the mouse work the
same. The default is `"text"`
- `review_prefix`
- `url_opener`
- `focus_agent_after_send`
Expand Down
1 change: 1 addition & 0 deletions cmd/rexdiff/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ local settings = {
-- placement = "split", -- split, zoomed, tab, or overlay
-- layout = "unified", -- split (side by side when it fits) or unified
-- guide_agent = "claude -p", -- the agent that writes the Guide tab
-- renderer = "kitty", -- draw with the kitty graphics protocol, with no flicker
}

`
Expand Down
11 changes: 6 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ require (
github.com/charmbracelet/x/ansi v0.11.9
github.com/rogpeppe/go-internal v1.16.0
github.com/sahilm/fuzzy v0.1.3
golang.org/x/image v0.48.0
golang.org/x/sys v0.50.0
)

require (
Expand All @@ -35,9 +37,8 @@ require (
github.com/xo/terminfo v1.0.0 // indirect
github.com/yuin/goldmark v1.7.8 // indirect
github.com/yuin/goldmark-emoji v1.0.5 // indirect
golang.org/x/net v0.42.0 // indirect
golang.org/x/sync v0.22.0 // indirect
golang.org/x/sys v0.47.0 // indirect
golang.org/x/text v0.27.0 // indirect
golang.org/x/tools v0.35.0 // indirect
golang.org/x/net v0.61.0 // indirect
golang.org/x/sync v0.25.0 // indirect
golang.org/x/text v0.44.0 // indirect
golang.org/x/tools v0.52.0 // indirect
)
22 changes: 12 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,15 @@ github.com/yuin/goldmark-emoji v1.0.5 h1:EMVWyCGPlXJfUXBXpuMu+ii3TIaxbVBnEX9uaDC
github.com/yuin/goldmark-emoji v1.0.5/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
golang.org/x/net v0.42.0 h1:jzkYrhi3YQWD6MLBJcsklgQsoAcw89EcZbJw8Z614hs=
golang.org/x/net v0.42.0/go.mod h1:FF1RA5d3u7nAYA4z2TkclSCKh68eSXtiFwcWQpPXdt8=
golang.org/x/sync v0.22.0 h1:SZjpbeLmrCk4xhRSZFNZW5gFUeCeFgjekvI/+gfScek=
golang.org/x/sync v0.22.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
golang.org/x/sys v0.47.0 h1:o7XGOvZQCADBQQ4Y7VNq2dRWQR7JmOUW8Kxx4ZsNgWs=
golang.org/x/sys v0.47.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
golang.org/x/text v0.27.0 h1:4fGWRpyh641NLlecmyl4LOe6yDdfaYNrGb2zdfo4JV4=
golang.org/x/text v0.27.0/go.mod h1:1D28KMCvyooCX9hBiosv5Tz/+YLxj0j7XhWjpSUF7CU=
golang.org/x/tools v0.35.0 h1:mBffYraMEf7aa0sB+NuKnuCy8qI/9Bughn8dC2Gu5r0=
golang.org/x/tools v0.35.0/go.mod h1:NKdj5HkL/73byiZSJjqJgKn3ep7KjFkBOkR/Hps3VPw=
golang.org/x/image v0.48.0 h1:1AvuPcuoOTJpA7s4VZ5umrb90T3So0rkB/bSGmxkxik=
golang.org/x/image v0.48.0/go.mod h1:mmtg64iqJKGqEgy+r13dfybl85tmxUd2lMnmaiSdWYY=
golang.org/x/net v0.61.0 h1:RR+6j/BTBCrggOLugxa+66R8FvoN6MHlzDlZIbN9YFw=
golang.org/x/net v0.61.0/go.mod h1:WgDCOTH8iwtB66T4/GfI94AHo/hhdb7Hah9NDseQfiI=
golang.org/x/sync v0.25.0 h1:dJnifr0nMV8/SBnBvdo4eSGGnrc3O4FFx6IqvtLcmRs=
golang.org/x/sync v0.25.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0=
golang.org/x/sys v0.50.0 h1:dkKZEFTEKaLr1sjhs0WiKqoi8Jj5nHbS3Njmx1UoMJs=
golang.org/x/sys v0.50.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og=
golang.org/x/text v0.44.0 h1:YItdp/mQNGnsmrgpcdA5yQ3bnRxCfo/Tj/iByGW9GGo=
golang.org/x/text v0.44.0/go.mod h1:S4FR1waQ9LbjQTls97SyRjDaUUVkaM+cXwwuG/G+MwY=
golang.org/x/tools v0.52.0 h1:ryxg4U63oaUYk7uOLTF37n43f4qgtGvqV4Ioit1BaEs=
golang.org/x/tools v0.52.0/go.mod h1:ItcP5UNaVGG+Yc4eIYmaFLNJ4soEopkx5Y2d4lcEurs=
15 changes: 15 additions & 0 deletions tui/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@ const (
markdownViewRendered markdownView = "rendered"
)

// renderer tells how rexdiff draws the screen.
type renderer string

const (
rendererText renderer = "text" // the cells of the terminal
rendererKitty renderer = "kitty" // pictures, with the kitty graphics protocol
)

// position is a side of the screen.
type position string

Expand All @@ -52,6 +60,7 @@ var (
configScopes = []Scope{ScopeUncommitted, ScopeBranch, ScopeLastTurn}
markdownViews = []markdownView{markdownViewSource, markdownViewRendered}
positions = []position{positionRight, positionLeft}
renderers = []renderer{rendererText, rendererKitty}
)

// config holds the settings of rexdiff. The settings are at the top of
Expand Down Expand Up @@ -81,6 +90,10 @@ type config struct {
DiffSigns bool `json:"diff_signs"`
// CursorLine tints the background of the line at the cursor.
CursorLine bool `json:"cursor_line"`
// Renderer draws the screen as text, or as pictures with the kitty
// graphics protocol. The pictures change a whole line at once, so the
// screen does not flicker.
Renderer renderer `json:"renderer"`
// FocusAgent tells if the focus moves to the agent after a send. Nil
// means true.
FocusAgent *bool `json:"focus_agent_after_send"`
Expand Down Expand Up @@ -168,6 +181,7 @@ func defaultConfig() config {
FileList: positionRight,
FileListWidth: 32,
CursorLine: true,
Renderer: rendererText,
}
}

Expand Down Expand Up @@ -260,6 +274,7 @@ func (c config) checkChoices() error {
{"default_scope", string(c.DefaultScope), names(configScopes...)},
{"markdown_view", string(c.MarkdownView), names(markdownViews...)},
{"file_list", string(c.FileList), names(positions...)},
{"renderer", string(c.Renderer), names(renderers...)},
}
for _, k := range choices {
if !slices.Contains(k.allowed, k.value) {
Expand Down
Loading
Loading