Skip to content

Commit 74cf67b

Browse files
Merge branch 'main' into feature/add-copy-to-clipboard
2 parents 8233445 + 3d97155 commit 74cf67b

File tree

20 files changed

+163
-192
lines changed

20 files changed

+163
-192
lines changed

.github/dependabot.yml

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,41 @@
11
version: 2
2+
23
updates:
34
- package-ecosystem: "gomod"
45
directory: "/"
56
schedule:
6-
interval: "daily"
7+
interval: "weekly"
8+
day: "monday"
9+
time: "05:00"
10+
timezone: "America/New_York"
711
labels:
812
- "dependencies"
913
commit-message:
1014
prefix: "chore"
1115
include: "scope"
16+
1217
- package-ecosystem: "github-actions"
1318
directory: "/"
1419
schedule:
15-
interval: "daily"
20+
interval: "weekly"
21+
day: "monday"
22+
time: "05:00"
23+
timezone: "America/New_York"
1624
labels:
1725
- "dependencies"
1826
commit-message:
1927
prefix: "chore"
2028
include: "scope"
29+
2130
- package-ecosystem: "docker"
2231
directory: "/"
2332
schedule:
24-
interval: "daily"
33+
interval: "weekly"
34+
day: "monday"
35+
time: "05:00"
36+
timezone: "America/New_York"
2537
labels:
2638
- "dependencies"
2739
commit-message:
28-
prefix: "chore"
40+
prefix: "feat"
2941
include: "scope"

.github/workflows/dependabot-sync.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: dependabot-sync
2+
on:
3+
schedule:
4+
- cron: "0 0 * * 0" # every Sunday at midnight
5+
workflow_dispatch: # allows manual triggering
6+
7+
permissions:
8+
contents: write
9+
pull-requests: write
10+
11+
jobs:
12+
dependabot-sync:
13+
uses: charmbracelet/meta/.github/workflows/dependabot-sync.yml@main
14+
with:
15+
repo_name: ${{ github.event.repository.name }}
16+
secrets:
17+
gh_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }}

.github/workflows/goreleaser.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ concurrency:
1414
jobs:
1515
goreleaser:
1616
uses: charmbracelet/meta/.github/workflows/goreleaser.yml@main
17+
with:
18+
macos_sign_entitlements: "./release/entitlements.plist"
1719
secrets:
1820
docker_username: ${{ secrets.DOCKERHUB_USERNAME }}
1921
docker_token: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -28,13 +30,3 @@ jobs:
2830
macos_notary_issuer_id: ${{ secrets.MACOS_NOTARY_ISSUER_ID }}
2931
macos_notary_key_id: ${{ secrets.MACOS_NOTARY_KEY_ID }}
3032
macos_notary_key: ${{ secrets.MACOS_NOTARY_KEY }}
31-
homebrew:
32-
name: Bump Homebrew formula
33-
runs-on: ubuntu-latest
34-
steps:
35-
- uses: mislav/bump-homebrew-formula-action@v3
36-
with:
37-
# A PR will be sent to github.com/Homebrew/homebrew-core to update this formula:
38-
formula-name: freeze
39-
env:
40-
COMMITTER_TOKEN: ${{ secrets.COMMITTER_TOKEN }}

.github/workflows/lint-soft.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.github/workflows/lint.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020

2121
- uses: actions/checkout@v4
2222
- name: golangci-lint
23-
uses: golangci/golangci-lint-action@v6
23+
uses: golangci/golangci-lint-action@v7
2424
with:
2525
# Optional: golangci-lint command line arguments.
2626
#args:

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
!test/golden/**/*.png
55
!examples/*.svg
66
/result
7+
dist/

.golangci-soft.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

.golangci.yml

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,9 @@
1+
version: "2"
12
run:
23
tests: false
3-
4-
issues:
5-
include:
6-
- EXC0001
7-
- EXC0005
8-
- EXC0011
9-
- EXC0012
10-
- EXC0013
11-
12-
max-issues-per-linter: 0
13-
max-same-issues: 0
14-
154
linters:
165
enable:
176
- bodyclose
18-
- goimports
197
- gosec
208
- nilerr
219
- predeclared
@@ -26,3 +14,23 @@ linters:
2614
- unconvert
2715
- unparam
2816
- whitespace
17+
exclusions:
18+
generated: lax
19+
presets:
20+
- common-false-positives
21+
paths:
22+
- third_party$
23+
- builtin$
24+
- examples$
25+
issues:
26+
max-issues-per-linter: 0
27+
max-same-issues: 0
28+
formatters:
29+
enable:
30+
- goimports
31+
exclusions:
32+
generated: lax
33+
paths:
34+
- third_party$
35+
- builtin$
36+
- examples$

.goreleaser.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1+
# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json
2+
version: 2
13
includes:
24
- from_url:
35
url: charmbracelet/meta/main/goreleaser-simple.yaml
4-
56
variables:
67
main: "."
78
description: "Generate images of code and terminal output."

ansi.go

Lines changed: 15 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package main
1+
package main //nolint:revive
22

33
import (
44
"fmt"
@@ -19,17 +19,6 @@ type dispatcher struct {
1919
bgWidth int
2020
}
2121

22-
func (p *dispatcher) dispatch(s ansi.Sequence) {
23-
switch s := s.(type) {
24-
case ansi.Rune:
25-
p.Print(rune(s))
26-
case ansi.ControlCode:
27-
p.Execute(byte(s))
28-
case ansi.CsiSequence:
29-
p.CsiDispatch(s)
30-
}
31-
}
32-
3322
func (p *dispatcher) Print(r rune) {
3423
p.row = clamp(p.row, 0, len(p.lines)-1)
3524
// insert the rune in the last tspan
@@ -109,8 +98,8 @@ func (p *dispatcher) endBackground() {
10998
p.bgWidth = 0
11099
}
111100

112-
func (p *dispatcher) CsiDispatch(s ansi.CsiSequence) {
113-
if s.Cmd != 'm' {
101+
func (p *dispatcher) CsiDispatch(cmd ansi.Cmd, params ansi.Params) {
102+
if cmd != 'm' {
114103
// ignore incomplete or non Style (SGR) sequences
115104
return
116105
}
@@ -121,19 +110,21 @@ func (p *dispatcher) CsiDispatch(s ansi.CsiSequence) {
121110
// reset ANSI, this is done by creating a new empty tspan,
122111
// which would reset all the styles such that when text is appended to the last
123112
// child of this line there is no styling applied.
124-
p.lines[p.row].AddChild(span)
113+
if p.row < len(p.lines) {
114+
p.lines[p.row].AddChild(span)
115+
}
125116
p.endBackground()
126117
}
127118

128-
if len(s.Params) == 0 {
119+
if len(params) == 0 {
129120
// zero params means reset
130121
reset()
131122
return
132123
}
133124

134125
var i int
135-
for i < len(s.Params) {
136-
v := s.Param(i)
126+
for i < len(params) {
127+
v := params[i].Param(0)
137128
switch v {
138129
case 0:
139130
reset()
@@ -154,29 +145,29 @@ func (p *dispatcher) CsiDispatch(s ansi.CsiSequence) {
154145
p.lines[p.row].AddChild(span)
155146
case 38:
156147
i++
157-
switch s.Param(i) {
148+
switch params[i] {
158149
case 5:
159-
n := s.Param(i + 1)
150+
n := params[i+1]
160151
i++
161152
fill := palette[n]
162153
span.CreateAttr("fill", fill)
163154
p.lines[p.row].AddChild(span)
164155
case 2:
165-
span.CreateAttr("fill", fmt.Sprintf("#%02x%02x%02x", s.Param(i+1), s.Param(i+2), s.Param(i+3)))
156+
span.CreateAttr("fill", fmt.Sprintf("#%02x%02x%02x", params[i+1], params[i+2], params[i+3]))
166157
p.lines[p.row].AddChild(span)
167158
i += 3
168159
}
169160
case 48:
170161
p.endBackground()
171162
i++
172-
switch s.Param(i) {
163+
switch params[i] {
173164
case 5:
174-
n := s.Param(i + 1)
165+
n := params[i+1]
175166
i++
176167
fill := palette[n]
177168
p.beginBackground(fill)
178169
case 2:
179-
fill := fmt.Sprintf("#%02x%02x%02x", s.Param(i+1), s.Param(i+2), s.Param(i+3))
170+
fill := fmt.Sprintf("#%02x%02x%02x", params[i+1], params[i+2], params[i+3])
180171
p.beginBackground(fill)
181172
i += 3
182173
}

0 commit comments

Comments
 (0)