From 033c7f01413d0cbd39e6c6235c5f1554f72f3a73 Mon Sep 17 00:00:00 2001 From: ucwong Date: Tue, 26 Nov 2024 03:10:50 +0800 Subject: [PATCH] accounts/abi: fix MakeTopics mutation of big.Int inputs --- accounts/abi/topics.go | 2 +- accounts/abi/topics_test.go | 17 + go.mod | 44 +- go.sum | 88 +-- .../aws-sdk-go-v2/aws/go_module_metadata.go | 2 +- .../aws/aws-sdk-go-v2/config/CHANGELOG.md | 5 + .../config/go_module_metadata.go | 2 +- .../aws-sdk-go-v2/credentials/CHANGELOG.md | 5 + .../credentials/go_module_metadata.go | 2 +- .../feature/ec2/imds/CHANGELOG.md | 5 + .../feature/ec2/imds/go_module_metadata.go | 2 +- .../internal/configsources/CHANGELOG.md | 5 + .../configsources/go_module_metadata.go | 2 +- .../internal/endpoints/v2/CHANGELOG.md | 5 + .../endpoints/v2/go_module_metadata.go | 2 +- .../internal/accept-encoding/CHANGELOG.md | 4 + .../accept-encoding/go_module_metadata.go | 2 +- .../internal/presigned-url/CHANGELOG.md | 5 + .../presigned-url/go_module_metadata.go | 2 +- .../service/route53/CHANGELOG.md | 5 + .../service/route53/go_module_metadata.go | 2 +- .../aws-sdk-go-v2/service/sso/CHANGELOG.md | 5 + .../service/sso/go_module_metadata.go | 2 +- .../service/ssooidc/CHANGELOG.md | 5 + .../service/ssooidc/go_module_metadata.go | 2 +- .../aws-sdk-go-v2/service/sts/CHANGELOG.md | 5 + .../service/sts/go_module_metadata.go | 2 +- .../bits-and-blooms/bitset/bitset.go | 13 + .../charmbracelet/bubbletea/.gitignore | 1 + .../charmbracelet/bubbletea/.goreleaser.yml | 5 +- .../bubbletea/standard_renderer.go | 19 + .../charmbracelet/x/ansi/background.go | 97 ++- vendor/github.com/charmbracelet/x/ansi/c0.go | 7 + .../charmbracelet/x/ansi/charset.go | 55 ++ vendor/github.com/charmbracelet/x/ansi/csi.go | 75 +- .../github.com/charmbracelet/x/ansi/ctrl.go | 105 ++- .../github.com/charmbracelet/x/ansi/cursor.go | 402 ++++++++++- vendor/github.com/charmbracelet/x/ansi/cwd.go | 26 + vendor/github.com/charmbracelet/x/ansi/dcs.go | 85 +-- .../github.com/charmbracelet/x/ansi/focus.go | 9 + .../github.com/charmbracelet/x/ansi/keypad.go | 28 + .../github.com/charmbracelet/x/ansi/mode.go | 641 ++++++++++++++++-- .../github.com/charmbracelet/x/ansi/mouse.go | 36 + vendor/github.com/charmbracelet/x/ansi/osc.go | 27 +- .../github.com/charmbracelet/x/ansi/parser.go | 356 +++++----- .../charmbracelet/x/ansi/parser_decode.go | 199 +++--- .../charmbracelet/x/ansi/parser_sync.go | 7 +- .../github.com/charmbracelet/x/ansi/paste.go | 7 + .../github.com/charmbracelet/x/ansi/reset.go | 11 + .../github.com/charmbracelet/x/ansi/screen.go | 306 ++++++++- .../charmbracelet/x/ansi/sequence.go | 90 ++- vendor/github.com/charmbracelet/x/ansi/sgr.go | 95 +++ .../github.com/charmbracelet/x/ansi/status.go | 115 ++++ .../github.com/charmbracelet/x/ansi/style.go | 7 - .../charmbracelet/x/ansi/termcap.go | 12 +- .../github.com/charmbracelet/x/ansi/util.go | 63 ++ .../github.com/charmbracelet/x/ansi/xterm.go | 83 +++ .../cloudflare/cloudflare-go/CHANGELOG.md | 19 +- .../cloudflare-go/access_identity_provider.go | 1 + .../cloudflare/cloudflare-go/snippets.go | 4 +- .../cloudflare-go/snippets_rules.go | 4 +- .../cloudflare-go/teams_accounts.go | 2 +- .../cloudflare/cloudflare-go/turnstile.go | 11 +- vendor/github.com/go-resty/resty/v2/README.md | 6 +- vendor/github.com/go-resty/resty/v2/client.go | 1 - .../github.com/go-resty/resty/v2/request.go | 2 + vendor/github.com/go-resty/resty/v2/resty.go | 2 +- vendor/github.com/go-resty/resty/v2/util.go | 37 +- vendor/github.com/pion/sctp/.golangci.yml | 8 +- vendor/github.com/pion/sctp/association.go | 52 +- vendor/github.com/pion/sctp/queue.go | 4 + vendor/modernc.org/libc/ccgo_linux_arm.go | 24 - vendor/modernc.org/libc/libc_linux_arm.go | 55 +- vendor/modules.txt | 46 +- 74 files changed, 2814 insertions(+), 675 deletions(-) create mode 100644 vendor/github.com/charmbracelet/x/ansi/charset.go create mode 100644 vendor/github.com/charmbracelet/x/ansi/cwd.go create mode 100644 vendor/github.com/charmbracelet/x/ansi/focus.go create mode 100644 vendor/github.com/charmbracelet/x/ansi/keypad.go create mode 100644 vendor/github.com/charmbracelet/x/ansi/mouse.go create mode 100644 vendor/github.com/charmbracelet/x/ansi/paste.go create mode 100644 vendor/github.com/charmbracelet/x/ansi/reset.go create mode 100644 vendor/github.com/charmbracelet/x/ansi/sgr.go create mode 100644 vendor/github.com/charmbracelet/x/ansi/status.go diff --git a/accounts/abi/topics.go b/accounts/abi/topics.go index 8c74c65449..6110939741 100644 --- a/accounts/abi/topics.go +++ b/accounts/abi/topics.go @@ -42,7 +42,7 @@ func MakeTopics(query ...[]any) ([][]common.Hash, error) { case common.Address: copy(topic[common.HashLength-common.AddressLength:], rule[:]) case *big.Int: - copy(topic[:], math.U256Bytes(rule)) + copy(topic[:], math.U256Bytes(new(big.Int).Set(rule))) case bool: if rule { topic[common.HashLength-1] = 1 diff --git a/accounts/abi/topics_test.go b/accounts/abi/topics_test.go index c65fa01822..7aa538978d 100644 --- a/accounts/abi/topics_test.go +++ b/accounts/abi/topics_test.go @@ -150,6 +150,23 @@ func TestMakeTopics(t *testing.T) { } }) } + + t.Run("does not mutate big.Int", func(t *testing.T) { + t.Parallel() + want := [][]common.Hash{{common.HexToHash("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff")}} + + in := big.NewInt(-1) + got, err := MakeTopics([]interface{}{in}) + if err != nil { + t.Fatalf("makeTopics() error = %v", err) + } + if !reflect.DeepEqual(got, want) { + t.Fatalf("makeTopics() = %v, want %v", got, want) + } + if orig := big.NewInt(-1); in.Cmp(orig) != 0 { + t.Fatalf("makeTopics() mutated an input parameter from %v to %v", orig, in) + } + }) } type args struct { diff --git a/go.mod b/go.mod index 05d13ddad5..1eb4448f2e 100644 --- a/go.mod +++ b/go.mod @@ -8,16 +8,16 @@ require ( github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.5.0 github.com/CortexFoundation/inference v1.0.2-0.20230307032835-9197d586a4e8 github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66 - github.com/CortexFoundation/torrentfs v1.0.69-0.20241114140948-a53b7b20e4c1 + github.com/CortexFoundation/torrentfs v1.0.69-0.20241125143232-6e25c28c7a3c github.com/VictoriaMetrics/fastcache v1.12.2 github.com/arsham/figurine v1.3.0 - github.com/aws/aws-sdk-go-v2 v1.32.4 - github.com/aws/aws-sdk-go-v2/config v1.28.4 - github.com/aws/aws-sdk-go-v2/credentials v1.17.45 - github.com/aws/aws-sdk-go-v2/service/route53 v1.46.1 + github.com/aws/aws-sdk-go-v2 v1.32.5 + github.com/aws/aws-sdk-go-v2/config v1.28.5 + github.com/aws/aws-sdk-go-v2/credentials v1.17.46 + github.com/aws/aws-sdk-go-v2/service/route53 v1.46.2 github.com/cespare/cp v1.1.1 - github.com/charmbracelet/bubbletea v1.2.2 - github.com/cloudflare/cloudflare-go v0.109.0 + github.com/charmbracelet/bubbletea v1.2.3 + github.com/cloudflare/cloudflare-go v0.110.0 github.com/cockroachdb/pebble v1.1.2 github.com/consensys/gnark-crypto v0.14.0 github.com/crate-crypto/go-kzg-4844 v1.1.0 @@ -107,27 +107,27 @@ require ( github.com/antlabs/timer v0.1.4 // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect github.com/arsham/rainbow v1.2.1 // indirect - github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.19 // indirect - github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23 // indirect - github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23 // indirect + github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20 // indirect + github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.24 // indirect + github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.24 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 // indirect - github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.4 // indirect - github.com/aws/aws-sdk-go-v2/service/sso v1.24.5 // indirect - github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4 // indirect - github.com/aws/aws-sdk-go-v2/service/sts v1.33.0 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 // indirect + github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sso v1.24.6 // indirect + github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.5 // indirect + github.com/aws/aws-sdk-go-v2/service/sts v1.33.1 // indirect github.com/aws/smithy-go v1.22.1 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/bahlo/generic-list-go v0.2.0 // indirect github.com/benbjohnson/immutable v0.4.3 // indirect github.com/beorn7/perks v1.0.1 // indirect - github.com/bits-and-blooms/bitset v1.15.0 // indirect + github.com/bits-and-blooms/bitset v1.16.0 // indirect github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect github.com/bwmarrin/snowflake v0.3.0 // indirect github.com/cespare/xxhash v1.1.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/charmbracelet/lipgloss v1.0.0 // indirect - github.com/charmbracelet/x/ansi v0.4.5 // indirect + github.com/charmbracelet/x/ansi v0.5.2 // indirect github.com/charmbracelet/x/term v0.2.1 // indirect github.com/cockroachdb/errors v1.11.3 // indirect github.com/cockroachdb/fifo v0.0.0-20240816210425-c5d0cb0b6fc0 // indirect @@ -152,7 +152,7 @@ require ( github.com/go-logr/logr v1.4.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.3.0 // indirect - github.com/go-resty/resty/v2 v2.16.0 // indirect + github.com/go-resty/resty/v2 v2.16.2 // indirect github.com/go-sourcemap/sourcemap v2.1.4+incompatible // indirect github.com/goccy/go-json v0.10.3 // indirect github.com/gogo/protobuf v1.3.2 // indirect @@ -161,11 +161,11 @@ require ( github.com/google/btree v1.1.3 // indirect github.com/google/flatbuffers v24.3.25+incompatible // indirect github.com/google/go-querystring v1.1.0 // indirect - github.com/google/pprof v0.0.0-20241101162523-b92577c0c142 // indirect + github.com/google/pprof v0.0.0-20241122213907-cbe949e5a41b // indirect github.com/hashicorp/golang-lru/v2 v2.0.7 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/influxdata/line-protocol v0.0.0-20210922203350-b1ad95c89adf // indirect - github.com/jedib0t/go-pretty/v6 v6.6.1 // indirect + github.com/jedib0t/go-pretty/v6 v6.6.2 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/klauspost/compress v1.17.11 // indirect github.com/klauspost/cpuid/v2 v2.2.9 // indirect @@ -197,7 +197,7 @@ require ( github.com/pion/randutil v0.1.0 // indirect github.com/pion/rtcp v1.2.14 // indirect github.com/pion/rtp v1.8.9 // indirect - github.com/pion/sctp v1.8.33 // indirect + github.com/pion/sctp v1.8.34 // indirect github.com/pion/sdp/v3 v3.0.9 // indirect github.com/pion/srtp/v3 v3.0.4 // indirect github.com/pion/stun/v3 v3.0.0 // indirect @@ -244,7 +244,7 @@ require ( golang.org/x/term v0.26.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.3.0 // indirect - modernc.org/libc v1.61.1 // indirect + modernc.org/libc v1.61.2 // indirect modernc.org/mathutil v1.6.0 // indirect modernc.org/memory v1.8.0 // indirect modernc.org/sqlite v1.34.1 // indirect diff --git a/go.sum b/go.sum index aec4b5d50b..2cb4f38764 100644 --- a/go.sum +++ b/go.sum @@ -70,8 +70,8 @@ github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66/go.mod h1: github.com/CortexFoundation/torrentfs v1.0.13-0.20200623060705-ce027f43f2f8/go.mod h1:Ma+tGhPPvz4CEZHaqEJQMOEGOfHeQBiAoNd1zyc/w3Q= github.com/CortexFoundation/torrentfs v1.0.14-0.20200703071639-3fcabcabf274/go.mod h1:qnb3YlIJmuetVBtC6Lsejr0Xru+1DNmDCdTqnwy7lhk= github.com/CortexFoundation/torrentfs v1.0.20-0.20200810031954-d36d26f82fcc/go.mod h1:N5BsicP5ynjXIi/Npl/SRzlJ630n1PJV2sRj0Z0t2HA= -github.com/CortexFoundation/torrentfs v1.0.69-0.20241114140948-a53b7b20e4c1 h1:ifOm/MbmVgW+hpDeUxRESI5K4Z7p0T1/xYRXc3QZzTA= -github.com/CortexFoundation/torrentfs v1.0.69-0.20241114140948-a53b7b20e4c1/go.mod h1:6tlEYce8AYyovxa5UoXqhiVc51JUcWkrS1g7ksGBv6Q= +github.com/CortexFoundation/torrentfs v1.0.69-0.20241125143232-6e25c28c7a3c h1:j5CqNBOSp20kSgVKXx0URMksu8rH6GAQJfJss3t5ylw= +github.com/CortexFoundation/torrentfs v1.0.69-0.20241125143232-6e25c28c7a3c/go.mod h1:M1KTvvn8uQ3f6YXGt4w6Hf5pONqGX9tZOicJg5rtA5A= github.com/CortexFoundation/wormhole v0.0.2-0.20240624201423-33e289eb7662 h1:rmM5WDx5UX7V4LF1D8LtAOPDzcCKulpZ++NkP8/+Ook= github.com/CortexFoundation/wormhole v0.0.2-0.20240624201423-33e289eb7662/go.mod h1:ipzmPabDgzYKUbXkGVe2gTkBEp+MsDx6pXGiuYzmP6s= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= @@ -262,32 +262,32 @@ github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN github.com/aws/aws-sdk-go v1.30.24/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go v1.31.0/go.mod h1:5zCpMtNQVjRREroY7sYe8lOMRSxkhG6MZveU8YkpAk0= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/aws/aws-sdk-go-v2 v1.32.4 h1:S13INUiTxgrPueTmrm5DZ+MiAo99zYzHEFh1UNkOxNE= -github.com/aws/aws-sdk-go-v2 v1.32.4/go.mod h1:2SK5n0a2karNTv5tbP1SjsX0uhttou00v/HpXKM1ZUo= -github.com/aws/aws-sdk-go-v2/config v1.28.4 h1:qgD0MKmkIzZR2DrAjWJcI9UkndjR+8f6sjUQvXh0mb0= -github.com/aws/aws-sdk-go-v2/config v1.28.4/go.mod h1:LgnWnNzHZw4MLplSyEGia0WgJ/kCGD86zGCjvNpehJs= -github.com/aws/aws-sdk-go-v2/credentials v1.17.45 h1:DUgm5lFso57E7150RBgu1JpVQoF8fAPretiDStIuVjg= -github.com/aws/aws-sdk-go-v2/credentials v1.17.45/go.mod h1:dnBpENcPC1ekZrGpSWspX+ZRGzhkvqngT2Qp5xBR1dY= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.19 h1:woXadbf0c7enQ2UGCi8gW/WuKmE0xIzxBF/eD94jMKQ= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.19/go.mod h1:zminj5ucw7w0r65bP6nhyOd3xL6veAUMc3ElGMoLVb4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23 h1:A2w6m6Tmr+BNXjDsr7M90zkWjsu4JXHwrzPg235STs4= -github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23/go.mod h1:35EVp9wyeANdujZruvHiQUAo9E3vbhnIO1mTCAxMlY0= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23 h1:pgYW9FCabt2M25MoHYCfMrVY2ghiiBKYWUVXfwZs+sU= -github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23/go.mod h1:c48kLgzO19wAu3CPkDWC28JbaJ+hfQlsdl7I2+oqIbk= +github.com/aws/aws-sdk-go-v2 v1.32.5 h1:U8vdWJuY7ruAkzaOdD7guwJjD06YSKmnKCJs7s3IkIo= +github.com/aws/aws-sdk-go-v2 v1.32.5/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U= +github.com/aws/aws-sdk-go-v2/config v1.28.5 h1:Za41twdCXbuyyWv9LndXxZZv3QhTG1DinqlFsSuvtI0= +github.com/aws/aws-sdk-go-v2/config v1.28.5/go.mod h1:4VsPbHP8JdcdUDmbTVgNL/8w9SqOkM5jyY8ljIxLO3o= +github.com/aws/aws-sdk-go-v2/credentials v1.17.46 h1:AU7RcriIo2lXjUfHFnFKYsLCwgbz1E7Mm95ieIRDNUg= +github.com/aws/aws-sdk-go-v2/credentials v1.17.46/go.mod h1:1FmYyLGL08KQXQ6mcTlifyFXfJVCNJTVGuQP4m0d/UA= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20 h1:sDSXIrlsFSFJtWKLQS4PUWRvrT580rrnuLydJrCQ/yA= +github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20/go.mod h1:WZ/c+w0ofps+/OUqMwWgnfrgzZH1DZO1RIkktICsqnY= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.24 h1:4usbeaes3yJnCFC7kfeyhkdkPtoRYPa/hTmCqMpKpLI= +github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.24/go.mod h1:5CI1JemjVwde8m2WG3cz23qHKPOxbpkq0HaoreEgLIY= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.24 h1:N1zsICrQglfzaBnrfM0Ys00860C+QFwu6u/5+LomP+o= +github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.24/go.mod h1:dCn9HbJ8+K31i8IQ8EWmWj0EiIk0+vKiHNMxTTYveAg= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 h1:VaRN3TlFdd6KxX1x3ILT5ynH6HvKgqdiXoTxAF4HQcQ= github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1/go.mod h1:FbtygfRFze9usAadmnGJNc8KsP346kEe+y2/oyhGAGc= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 h1:TToQNkvGguu209puTojY/ozlqy2d/SFNcoLIqTFi42g= -github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0/go.mod h1:0jp+ltwkf+SwG2fm/PKo8t4y8pJSgOCO4D8Lz3k0aHQ= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.4 h1:tHxQi/XHPK0ctd/wdOw0t7Xrc2OxcRCnVzv8lwWPu0c= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.4/go.mod h1:4GQbF1vJzG60poZqWatZlhP31y8PGCCVTvIGPdaaYJ0= -github.com/aws/aws-sdk-go-v2/service/route53 v1.46.1 h1:T6rRCg/YW4MMSZhMvLM/l0gDqlfOZu7AHDfRg3o47k0= -github.com/aws/aws-sdk-go-v2/service/route53 v1.46.1/go.mod h1:RGuFM2MNdAErqWm15RJh9g99GNYllh7g2WV7LaBXSKM= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.5 h1:HJwZwRt2Z2Tdec+m+fPjvdmkq2s9Ra+VR0hjF7V2o40= -github.com/aws/aws-sdk-go-v2/service/sso v1.24.5/go.mod h1:wrMCEwjFPms+V86TCQQeOxQF/If4vT44FGIOFiMC2ck= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4 h1:zcx9LiGWZ6i6pjdcoE9oXAB6mUdeyC36Ia/QEiIvYdg= -github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4/go.mod h1:Tp/ly1cTjRLGBBmNccFumbZ8oqpZlpdhFf80SrRh4is= -github.com/aws/aws-sdk-go-v2/service/sts v1.33.0 h1:s7LRgBqhwLaxcocnAniBJp7gaAB+4I4vHzqUqjH18yc= -github.com/aws/aws-sdk-go-v2/service/sts v1.33.0/go.mod h1:9XEUty5v5UAsMiFOBJrNibZgwCeOma73jgGwwhgffa8= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 h1:iXtILhvDxB6kPvEXgsDhGaZCSC6LQET5ZHSdJozeI0Y= +github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1/go.mod h1:9nu0fVANtYiAePIBh2/pFUSwtJ402hLnp854CNoDOeE= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.5 h1:wtpJ4zcwrSbwhECWQoI/g6WM9zqCcSpHDJIWSbMLOu4= +github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.5/go.mod h1:qu/W9HXQbbQ4+1+JcZp0ZNPV31ym537ZJN+fiS7Ti8E= +github.com/aws/aws-sdk-go-v2/service/route53 v1.46.2 h1:wmt05tPp/CaRZpPV5B4SaJ5TwkHKom07/BzHoLdkY1o= +github.com/aws/aws-sdk-go-v2/service/route53 v1.46.2/go.mod h1:d+K9HESMpGb1EU9/UmmpInbGIUcAkwmcY6ZO/A3zZsw= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.6 h1:3zu537oLmsPfDMyjnUS2g+F2vITgy5pB74tHI+JBNoM= +github.com/aws/aws-sdk-go-v2/service/sso v1.24.6/go.mod h1:WJSZH2ZvepM6t6jwu4w/Z45Eoi75lPN7DcydSRtJg6Y= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.5 h1:K0OQAsDywb0ltlFrZm0JHPY3yZp/S9OaoLU33S7vPS8= +github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.5/go.mod h1:ORITg+fyuMoeiQFiVGoqB3OydVTLkClw/ljbblMq6Cc= +github.com/aws/aws-sdk-go-v2/service/sts v1.33.1 h1:6SZUVRQNvExYlMLbHdlKB48x0fLbc2iVROyaNEwBHbU= +github.com/aws/aws-sdk-go-v2/service/sts v1.33.1/go.mod h1:GqWyYCwLXnlUB1lOAXQyNSPqPLQJvmo8J0DWBzp9mtg= github.com/aws/smithy-go v1.22.1 h1:/HPHZQ0g7f4eUeK6HKglFz8uwVfZKgoI25rb/J+dnro= github.com/aws/smithy-go v1.22.1/go.mod h1:irrKGvNn1InZwb2d7fkIRNucdfwR8R+Ts3wxYa/cJHg= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= @@ -304,8 +304,8 @@ github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6r github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bitly/go-simplejson v0.5.1-0.20200416141419-39a59b1b2866/go.mod h1:bXegrmTNBg3jTbSwV0BSBcSSfHHctupCgavZr/gX5fo= github.com/bits-and-blooms/bitset v1.12.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= -github.com/bits-and-blooms/bitset v1.15.0 h1:DiCRMscZsGyYePE9AR3sVhKqUXCt5IZvkX5AfAc5xLQ= -github.com/bits-and-blooms/bitset v1.15.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= +github.com/bits-and-blooms/bitset v1.16.0 h1:G3lirLlhFTcW/7ym/SLtYYLHQS0hBOcC8fPNJxbTYm4= +github.com/bits-and-blooms/bitset v1.16.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/bmatcuk/doublestar v1.1.1/go.mod h1:UD6OnuiIn0yFxxA2le/rnRU1G4RaI4UvFv1sNto9p6w= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= @@ -337,12 +337,12 @@ github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/charmbracelet/bubbletea v1.2.2 h1:EMz//Ky/aFS2uLcKqpCst5UOE6z5CFDGRsUpyXz0chs= -github.com/charmbracelet/bubbletea v1.2.2/go.mod h1:Qr6fVQw+wX7JkWWkVyXYk/ZUQ92a6XNekLXa3rR18MM= +github.com/charmbracelet/bubbletea v1.2.3 h1:d9MdMsANIYZB5pE1KkRqaUV6GfsiWm+/9z4fTuGVm9I= +github.com/charmbracelet/bubbletea v1.2.3/go.mod h1:Qr6fVQw+wX7JkWWkVyXYk/ZUQ92a6XNekLXa3rR18MM= github.com/charmbracelet/lipgloss v1.0.0 h1:O7VkGDvqEdGi93X+DeqsQ7PKHDgtQfF8j8/O2qFMQNg= github.com/charmbracelet/lipgloss v1.0.0/go.mod h1:U5fy9Z+C38obMs+T+tJqst9VGzlOYGj4ri9reL3qUlo= -github.com/charmbracelet/x/ansi v0.4.5 h1:LqK4vwBNaXw2AyGIICa5/29Sbdq58GbGdFngSexTdRM= -github.com/charmbracelet/x/ansi v0.4.5/go.mod h1:dk73KoMTT5AX5BsX0KrqhsTqAnhZZoCBjs7dGWp4Ktw= +github.com/charmbracelet/x/ansi v0.5.2 h1:dEa1x2qdOZXD/6439s+wF7xjV+kZLu/iN00GuXXrU9E= +github.com/charmbracelet/x/ansi v0.5.2/go.mod h1:KBUFw1la39nl0dLl10l5ORDAqGXaeurTQmwyyVKse/Q= github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ= github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg= github.com/cheekybits/genny v1.0.0/go.mod h1:+tQajlRqAUrPI7DOSpB0XAqZYtQakVtB7wXkRAgjxjQ= @@ -355,8 +355,8 @@ github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMn github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cloudflare/cloudflare-go v0.11.7/go.mod h1:GyEn0B58Zvn/XOrkE/R31DrKqjTsBQ9E5ICzRlE09hk= -github.com/cloudflare/cloudflare-go v0.109.0 h1:Wjp+RfJD1lidIFUlrTBqUQnCBrUnmVsLxgzWYiURueg= -github.com/cloudflare/cloudflare-go v0.109.0/go.mod h1:m492eNahT/9MsN7Ppnoge8AaI7QhVFtEgVm3I9HJFeU= +github.com/cloudflare/cloudflare-go v0.110.0 h1:aBKKUXwRWqErd4rITsnCLESOacxxset/BcpdXn23900= +github.com/cloudflare/cloudflare-go v0.110.0/go.mod h1:2ZZ+EkmThmd6pkZ56UKGXWpz2wsjeqoTg93P4+VSmMg= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= @@ -529,8 +529,8 @@ github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZs github.com/go-resty/resty/v2 v2.3.0-rc.1/go.mod h1:nYW/8rxqQCmI3bPz9Fsmjbr2FBjGuR2Mzt6kDh3zZ7w= github.com/go-resty/resty/v2 v2.3.1-0.20200619075926-b87f65ce5ed5/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU= github.com/go-resty/resty/v2 v2.3.1-0.20200717071130-ca7661ad51fe/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU= -github.com/go-resty/resty/v2 v2.16.0 h1:qpKalHWI2bpp9BIKlyT8TYWEJXOk1NuKbfiT3RRnzWc= -github.com/go-resty/resty/v2 v2.16.0/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU= +github.com/go-resty/resty/v2 v2.16.2 h1:CpRqTjIzq/rweXUt9+GxzzQdlkqMdt8Lm/fuK/CAbAg= +github.com/go-resty/resty/v2 v2.16.2/go.mod h1:0fHAoK7JoBy/Ch36N8VFeMsK7xQOHhvWaC3iOktwmIU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sourcemap/sourcemap v2.1.4+incompatible h1:a+iTbH5auLKxaNwQFg0B+TCYl6lbukKPc7b5x0n1s6Q= github.com/go-sourcemap/sourcemap v2.1.4+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= @@ -622,8 +622,8 @@ github.com/google/pprof v0.0.0-20190515194954-54271f7e092f/go.mod h1:zfwlbNMJ+OI github.com/google/pprof v0.0.0-20191218002539-d4f498aebedc/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20221118152302-e6195bd50e26/go.mod h1:dDKJzRmX4S37WGHujM7tX//fmj1uioxKzKxz3lo4HJo= -github.com/google/pprof v0.0.0-20241101162523-b92577c0c142 h1:sAGdeJj0bnMgUNVeUpp6AYlVdCt3/GdI3pGRqsNSQLs= -github.com/google/pprof v0.0.0-20241101162523-b92577c0c142/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/pprof v0.0.0-20241122213907-cbe949e5a41b h1:SXO0REt4iu865upYCk8aKBBJQ4BqoE0ReP23ClMu60s= +github.com/google/pprof v0.0.0-20241122213907-cbe949e5a41b/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -732,8 +732,8 @@ github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1: github.com/jackpal/go-nat-pmp v1.0.2 h1:KzKSgb7qkJvOUTqYl9/Hg/me3pWgBmERKrTGD7BdWus= github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= github.com/jcmturner/gofork v1.0.0/go.mod h1:MK8+TM0La+2rjBD4jE12Kj1pCCxK7d2LK/UM3ncEo0o= -github.com/jedib0t/go-pretty/v6 v6.6.1 h1:iJ65Xjb680rHcikRj6DSIbzCex2huitmc7bDtxYVWyc= -github.com/jedib0t/go-pretty/v6 v6.6.1/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= +github.com/jedib0t/go-pretty/v6 v6.6.2 h1:27bLj3nRODzaiA7tPIxy9UVWHoPspFfME9XxgwiiNsM= +github.com/jedib0t/go-pretty/v6 v6.6.2/go.mod h1:zbn98qrYlh95FIhwwsbIip0LYpwSG8SUOScs+v9/t0E= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267 h1:TMtDYDHKYY15rFihtRfck/bfFqNfvcabqvXAFQfAUpY= github.com/jedisct1/go-minisign v0.0.0-20230811132847-661be99b8267/go.mod h1:h1nSAbGFqGVzn6Jyl1R/iCcBUHN4g+gW1u9CoBTrb9E= github.com/jellevandenhooff/dkim v0.0.0-20150330215556-f50fe3d243e1/go.mod h1:E0B/fFc00Y+Rasa88328GlI/XbtyysCtTHZS8h7IrBU= @@ -1004,8 +1004,8 @@ github.com/pion/rtp v1.4.0/go.mod h1:/l4cvcKd0D3u9JLs2xSVI95YkfXW87a3br3nqmVtSlE github.com/pion/rtp v1.8.9 h1:E2HX740TZKaqdcPmf4pw6ZZuG8u5RlMMt+l3dxeu6Wk= github.com/pion/rtp v1.8.9/go.mod h1:pBGHaFt/yW7bf1jjWAoUjpSNoDnw98KTMg+jWWvziqU= github.com/pion/sctp v1.7.6/go.mod h1:ichkYQ5tlgCQwEwvgfdcAolqx1nHbYCxo4D7zK/K0X8= -github.com/pion/sctp v1.8.33 h1:dSE4wX6uTJBcNm8+YlMg7lw1wqyKHggsP5uKbdj+NZw= -github.com/pion/sctp v1.8.33/go.mod h1:beTnqSzewI53KWoG3nqB282oDMGrhNxBdb+JZnkCwRM= +github.com/pion/sctp v1.8.34 h1:rCuD3m53i0oGxCSp7FLQKvqVx0Nf5AUAHhMRXTTQjBc= +github.com/pion/sctp v1.8.34/go.mod h1:yWkCClkXlzVW7BXfI2PjrUGBwUI0CjXJBkhLt+sdo4U= github.com/pion/sdp/v2 v2.3.7/go.mod h1:+ZZf35r1+zbaWYiZLfPutWfx58DAWcGb2QsS3D/s9M8= github.com/pion/sdp/v3 v3.0.9 h1:pX++dCHoHUwq43kuwf3PyJfHlwIj4hXA7Vrifiq0IJY= github.com/pion/sdp/v3 v3.0.9/go.mod h1:B5xmvENq5IXJimIO4zfp6LAe1fD9N+kFv+V/1lOdz8M= @@ -1780,8 +1780,8 @@ modernc.org/libc v1.19.0/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0= modernc.org/libc v1.20.3/go.mod h1:ZRfIaEkgrYgZDl6pa4W39HgN5G/yDW+NRmNKZBDFrk0= modernc.org/libc v1.21.4/go.mod h1:przBsL5RDOZajTVslkugzLBj1evTue36jEomFQOoYuI= modernc.org/libc v1.21.5/go.mod h1:przBsL5RDOZajTVslkugzLBj1evTue36jEomFQOoYuI= -modernc.org/libc v1.61.1 h1:F8JngdWfVzqfNpff2apn7JpBkjq1ss8Ue4KuUdLDM7Q= -modernc.org/libc v1.61.1/go.mod h1:4QGjNyX3h+rn7V5oHpJY2yH0QN6frt1X+5BkXzwLPCo= +modernc.org/libc v1.61.2 h1:dkO4DlowfClcJYsvf/RiK6fUwvzCQTmB34bJLt0CAGQ= +modernc.org/libc v1.61.2/go.mod h1:4QGjNyX3h+rn7V5oHpJY2yH0QN6frt1X+5BkXzwLPCo= modernc.org/mathutil v1.5.0/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E= modernc.org/mathutil v1.6.0 h1:fRe9+AmYlaej+64JsEEhoWuAYBkOtQiMEU7n/XgfYi4= modernc.org/mathutil v1.6.0/go.mod h1:Ui5Q9q1TR2gFm0AQRqQUaBWFLAhQpCwNcuhBOSedWPo= diff --git a/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go index 1d54fc7ad0..f965a510e6 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/aws/go_module_metadata.go @@ -3,4 +3,4 @@ package aws // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.32.4" +const goModuleVersion = "1.32.5" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md index 91c59f49cb..72889241d2 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/config/CHANGELOG.md @@ -1,3 +1,8 @@ +# v1.28.5 (2024-11-18) + +* **Dependency Update**: Update to smithy-go v1.22.1. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.28.4 (2024-11-14) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go index 75a7fe1e82..65c440763b 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/config/go_module_metadata.go @@ -3,4 +3,4 @@ package config // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.28.4" +const goModuleVersion = "1.28.5" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md index ee33231003..3730bc7b47 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/CHANGELOG.md @@ -1,3 +1,8 @@ +# v1.17.46 (2024-11-18) + +* **Dependency Update**: Update to smithy-go v1.22.1. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.17.45 (2024-11-14) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go index b6bb1432fb..adc697b5bc 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/credentials/go_module_metadata.go @@ -3,4 +3,4 @@ package credentials // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.17.45" +const goModuleVersion = "1.17.46" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md index 66beafc714..d214419110 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/CHANGELOG.md @@ -1,3 +1,8 @@ +# v1.16.20 (2024-11-18) + +* **Dependency Update**: Update to smithy-go v1.22.1. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.16.19 (2024-11-06) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go index 79b1d7c955..93e4280dae 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/feature/ec2/imds/go_module_metadata.go @@ -3,4 +3,4 @@ package imds // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.16.19" +const goModuleVersion = "1.16.20" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md index 669d69af81..6396f51099 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/CHANGELOG.md @@ -1,3 +1,8 @@ +# v1.3.24 (2024-11-18) + +* **Dependency Update**: Update to smithy-go v1.22.1. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.3.23 (2024-11-06) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go index 6a89827e92..56bea7d638 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/configsources/go_module_metadata.go @@ -3,4 +3,4 @@ package configsources // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.3.23" +const goModuleVersion = "1.3.24" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md index ac71e1c7a9..7c870b66f0 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/CHANGELOG.md @@ -1,3 +1,8 @@ +# v2.6.24 (2024-11-18) + +* **Dependency Update**: Update to smithy-go v1.22.1. +* **Dependency Update**: Updated to the latest SDK module versions + # v2.6.23 (2024-11-06) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go index 460fef7291..7f46f58042 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/internal/endpoints/v2/go_module_metadata.go @@ -3,4 +3,4 @@ package endpoints // goModuleVersion is the tagged release for this module -const goModuleVersion = "2.6.23" +const goModuleVersion = "2.6.24" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md index 297618fcce..8ab28d3a98 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/CHANGELOG.md @@ -1,3 +1,7 @@ +# v1.12.1 (2024-11-18) + +* **Dependency Update**: Update to smithy-go v1.22.1. + # v1.12.0 (2024-10-04) * **Feature**: Add support for HTTP client metrics. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go index 4e50b2578e..1514acbe34 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding/go_module_metadata.go @@ -3,4 +3,4 @@ package acceptencoding // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.12.0" +const goModuleVersion = "1.12.1" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md index f239d1a7d6..8b667bc004 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/CHANGELOG.md @@ -1,3 +1,8 @@ +# v1.12.5 (2024-11-18) + +* **Dependency Update**: Update to smithy-go v1.22.1. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.12.4 (2024-11-06) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go index c5d9e1e951..20e16af75a 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/internal/presigned-url/go_module_metadata.go @@ -3,4 +3,4 @@ package presignedurl // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.12.4" +const goModuleVersion = "1.12.5" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/route53/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/route53/CHANGELOG.md index 52241b7258..a1b538f3bb 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/route53/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/route53/CHANGELOG.md @@ -1,3 +1,8 @@ +# v1.46.2 (2024-11-18) + +* **Dependency Update**: Update to smithy-go v1.22.1. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.46.1 (2024-11-06) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/route53/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/route53/go_module_metadata.go index 6c919adf70..19585f1afd 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/route53/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/route53/go_module_metadata.go @@ -3,4 +3,4 @@ package route53 // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.46.1" +const goModuleVersion = "1.46.2" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md index a62058e501..02837af8bc 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/CHANGELOG.md @@ -1,3 +1,8 @@ +# v1.24.6 (2024-11-18) + +* **Dependency Update**: Update to smithy-go v1.22.1. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.24.5 (2024-11-07) * **Bug Fix**: Adds case-insensitive handling of error message fields in service responses diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go index 7c1604ea27..dd77f04dcb 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sso/go_module_metadata.go @@ -3,4 +3,4 @@ package sso // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.24.5" +const goModuleVersion = "1.24.6" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md index b76255235e..db46aa0c37 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/CHANGELOG.md @@ -1,3 +1,8 @@ +# v1.28.5 (2024-11-18) + +* **Dependency Update**: Update to smithy-go v1.22.1. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.28.4 (2024-11-06) * **Dependency Update**: Updated to the latest SDK module versions diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go index a0db85a3e2..3859b0ad2c 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/ssooidc/go_module_metadata.go @@ -3,4 +3,4 @@ package ssooidc // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.28.4" +const goModuleVersion = "1.28.5" diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md index 9763fcb9bb..85396ddb6e 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/CHANGELOG.md @@ -1,3 +1,8 @@ +# v1.33.1 (2024-11-18) + +* **Dependency Update**: Update to smithy-go v1.22.1. +* **Dependency Update**: Updated to the latest SDK module versions + # v1.33.0 (2024-11-14) * **Feature**: This release introduces the new API 'AssumeRoot', which returns short-term credentials that you can use to perform privileged tasks. diff --git a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go index e1c926c8df..5213e0a128 100644 --- a/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go +++ b/vendor/github.com/aws/aws-sdk-go-v2/service/sts/go_module_metadata.go @@ -3,4 +3,4 @@ package sts // goModuleVersion is the tagged release for this module -const goModuleVersion = "1.33.0" +const goModuleVersion = "1.33.1" diff --git a/vendor/github.com/bits-and-blooms/bitset/bitset.go b/vendor/github.com/bits-and-blooms/bitset/bitset.go index cdf91c3746..5ad1745d4f 100644 --- a/vendor/github.com/bits-and-blooms/bitset/bitset.go +++ b/vendor/github.com/bits-and-blooms/bitset/bitset.go @@ -164,6 +164,19 @@ func New(length uint) (bset *BitSet) { return bset } +// MustNew creates a new BitSet with the given length bits. +// It panics if length exceeds the possible capacity or by a lack of memory. +func MustNew(length uint) (bset *BitSet) { + if length >= Cap() { + panic("You are exceeding the capacity") + } + + return &BitSet{ + length, + make([]uint64, wordsNeeded(length)), // may panic on lack of memory + } +} + // Cap returns the total possible capacity, or number of bits // that can be stored in the BitSet theoretically. Under 32-bit system, // it is 4294967295 and under 64-bit system, it is 18446744073709551615. diff --git a/vendor/github.com/charmbracelet/bubbletea/.gitignore b/vendor/github.com/charmbracelet/bubbletea/.gitignore index 9cc52352eb..abd7c0612b 100644 --- a/vendor/github.com/charmbracelet/bubbletea/.gitignore +++ b/vendor/github.com/charmbracelet/bubbletea/.gitignore @@ -20,3 +20,4 @@ tutorials/basics/basics tutorials/commands/commands .idea coverage.txt +dist/ diff --git a/vendor/github.com/charmbracelet/bubbletea/.goreleaser.yml b/vendor/github.com/charmbracelet/bubbletea/.goreleaser.yml index 40d9f298db..3353d02029 100644 --- a/vendor/github.com/charmbracelet/bubbletea/.goreleaser.yml +++ b/vendor/github.com/charmbracelet/bubbletea/.goreleaser.yml @@ -1,6 +1,5 @@ +# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json +version: 2 includes: - from_url: url: charmbracelet/meta/main/goreleaser-lib.yaml - -# yaml-language-server: $schema=https://goreleaser.com/static/schema-pro.json - diff --git a/vendor/github.com/charmbracelet/bubbletea/standard_renderer.go b/vendor/github.com/charmbracelet/bubbletea/standard_renderer.go index f30fc3592e..aa8524b840 100644 --- a/vendor/github.com/charmbracelet/bubbletea/standard_renderer.go +++ b/vendor/github.com/charmbracelet/bubbletea/standard_renderer.go @@ -57,6 +57,9 @@ type standardRenderer struct { // lines explicitly set not to render ignoreLines map[int]struct{} + + // lines rendered before entering alt screen mode + linesRenderedBeforeAltScreen int } // newRenderer creates a new renderer. Normally you'll want to initialize it @@ -334,6 +337,10 @@ func (r *standardRenderer) enterAltScreen() { r.altScreenActive = true r.execute(ansi.EnableAltScreenBuffer) + // Save the current line count before entering the alternate screen mode. + // This allows us to compare and adjust the cursor position when exiting the alternate screen. + r.linesRenderedBeforeAltScreen = r.linesRendered + // Ensure that the terminal is cleared, even when it doesn't support // alt screen (or alt screen support is disabled, like GNU screen by // default). @@ -366,6 +373,18 @@ func (r *standardRenderer) exitAltScreen() { r.altScreenActive = false r.execute(ansi.DisableAltScreenBuffer) + // Adjust cursor and screen + if r.linesRendered < r.linesRenderedBeforeAltScreen { + // If fewer lines were rendered in the alternate screen, move the cursor up + // to align with the previous normal screen position and clear any remaining lines. + r.execute(ansi.CursorUp(r.linesRenderedBeforeAltScreen - r.linesRendered)) + r.execute(ansi.EraseScreenBelow) + } else if r.linesRendered > r.linesRenderedBeforeAltScreen && r.linesRenderedBeforeAltScreen > 0 { + // If more lines were rendered in the alternate screen, move the cursor down + // to align with the new position. + r.execute(ansi.CursorDown(r.linesRendered - r.linesRenderedBeforeAltScreen)) + } + // cmd.exe and other terminals keep separate cursor states for the AltScreen // and the main buffer. We have to explicitly reset the cursor visibility // whenever we exit AltScreen. diff --git a/vendor/github.com/charmbracelet/x/ansi/background.go b/vendor/github.com/charmbracelet/x/ansi/background.go index 6c66e629f7..2383cf09f6 100644 --- a/vendor/github.com/charmbracelet/x/ansi/background.go +++ b/vendor/github.com/charmbracelet/x/ansi/background.go @@ -1,9 +1,73 @@ package ansi import ( + "fmt" "image/color" ) +// Colorizer is a [color.Color] interface that can be formatted as a string. +type Colorizer interface { + color.Color + fmt.Stringer +} + +// HexColorizer is a [color.Color] that can be formatted as a hex string. +type HexColorizer struct{ color.Color } + +var _ Colorizer = HexColorizer{} + +// String returns the color as a hex string. If the color is nil, an empty +// string is returned. +func (h HexColorizer) String() string { + if h.Color == nil { + return "" + } + r, g, b, _ := h.RGBA() + // Get the lower 8 bits + r &= 0xff + g &= 0xff + b &= 0xff + return fmt.Sprintf("#%02x%02x%02x", uint8(r), uint8(g), uint8(b)) //nolint:gosec +} + +// XRGBColorizer is a [color.Color] that can be formatted as an XParseColor +// rgb: string. +// +// See: https://linux.die.net/man/3/xparsecolor +type XRGBColorizer struct{ color.Color } + +var _ Colorizer = XRGBColorizer{} + +// String returns the color as an XParseColor rgb: string. If the color is nil, +// an empty string is returned. +func (x XRGBColorizer) String() string { + if x.Color == nil { + return "" + } + r, g, b, _ := x.RGBA() + // Get the lower 8 bits + return fmt.Sprintf("rgb:%04x/%04x/%04x", r, g, b) +} + +// XRGBAColorizer is a [color.Color] that can be formatted as an XParseColor +// rgba: string. +// +// See: https://linux.die.net/man/3/xparsecolor +type XRGBAColorizer struct{ color.Color } + +var _ Colorizer = XRGBAColorizer{} + +// String returns the color as an XParseColor rgba: string. If the color is nil, +// an empty string is returned. +func (x XRGBAColorizer) String() string { + if x.Color == nil { + return "" + } + r, g, b, a := x.RGBA() + // Get the lower 8 bits + return fmt.Sprintf("rgba:%04x/%04x/%04x/%04x", r, g, b, a) +} + // SetForegroundColor returns a sequence that sets the default terminal // foreground color. // @@ -14,7 +78,16 @@ import ( // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands func SetForegroundColor(c color.Color) string { - return "\x1b]10;" + colorToHexString(c) + "\x07" + var s string + switch c := c.(type) { + case Colorizer: + s = c.String() + case fmt.Stringer: + s = c.String() + default: + s = HexColorizer{c}.String() + } + return "\x1b]10;" + s + "\x07" } // RequestForegroundColor is a sequence that requests the current default @@ -39,7 +112,16 @@ const ResetForegroundColor = "\x1b]110\x07" // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands func SetBackgroundColor(c color.Color) string { - return "\x1b]11;" + colorToHexString(c) + "\x07" + var s string + switch c := c.(type) { + case Colorizer: + s = c.String() + case fmt.Stringer: + s = c.String() + default: + s = HexColorizer{c}.String() + } + return "\x1b]11;" + s + "\x07" } // RequestBackgroundColor is a sequence that requests the current default @@ -63,7 +145,16 @@ const ResetBackgroundColor = "\x1b]111\x07" // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands func SetCursorColor(c color.Color) string { - return "\x1b]12;" + colorToHexString(c) + "\x07" + var s string + switch c := c.(type) { + case Colorizer: + s = c.String() + case fmt.Stringer: + s = c.String() + default: + s = HexColorizer{c}.String() + } + return "\x1b]12;" + s + "\x07" } // RequestCursorColor is a sequence that requests the current terminal cursor diff --git a/vendor/github.com/charmbracelet/x/ansi/c0.go b/vendor/github.com/charmbracelet/x/ansi/c0.go index 13e3c6c310..28ff7c2a3a 100644 --- a/vendor/github.com/charmbracelet/x/ansi/c0.go +++ b/vendor/github.com/charmbracelet/x/ansi/c0.go @@ -69,4 +69,11 @@ const ( RS = 0x1E // US is the unit separator character (Caret: ^_). US = 0x1F + + // LS0 is the locking shift 0 character. + // This is an alias for [SI]. + LS0 = SI + // LS1 is the locking shift 1 character. + // This is an alias for [SO]. + LS1 = SO ) diff --git a/vendor/github.com/charmbracelet/x/ansi/charset.go b/vendor/github.com/charmbracelet/x/ansi/charset.go new file mode 100644 index 0000000000..50fff51fcd --- /dev/null +++ b/vendor/github.com/charmbracelet/x/ansi/charset.go @@ -0,0 +1,55 @@ +package ansi + +// SelectCharacterSet sets the G-set character designator to the specified +// character set. +// +// ESC Ps Pd +// +// Where Ps is the G-set character designator, and Pd is the identifier. +// For 94-character sets, the designator can be one of: +// - ( G0 +// - ) G1 +// - * G2 +// - + G3 +// +// For 96-character sets, the designator can be one of: +// - - G1 +// - . G2 +// - / G3 +// +// Some common 94-character sets are: +// - 0 DEC Special Drawing Set +// - A United Kingdom (UK) +// - B United States (USASCII) +// +// Examples: +// +// ESC ( B Select character set G0 = United States (USASCII) +// ESC ( 0 Select character set G0 = Special Character and Line Drawing Set +// ESC ) 0 Select character set G1 = Special Character and Line Drawing Set +// ESC * A Select character set G2 = United Kingdom (UK) +// +// See: https://vt100.net/docs/vt510-rm/SCS.html +func SelectCharacterSet(gset byte, charset byte) string { + return "\x1b" + string(gset) + string(charset) +} + +// SCS is an alias for SelectCharacterSet. +func SCS(gset byte, charset byte) string { + return SelectCharacterSet(gset, charset) +} + +// Locking Shift 1 Right (LS1R) shifts G1 into GR character set. +const LS1R = "\x1b~" + +// Locking Shift 2 (LS2) shifts G2 into GL character set. +const LS2 = "\x1bn" + +// Locking Shift 2 Right (LS2R) shifts G2 into GR character set. +const LS2R = "\x1b}" + +// Locking Shift 3 (LS3) shifts G3 into GL character set. +const LS3 = "\x1bo" + +// Locking Shift 3 Right (LS3R) shifts G3 into GR character set. +const LS3R = "\x1b|" diff --git a/vendor/github.com/charmbracelet/x/ansi/csi.go b/vendor/github.com/charmbracelet/x/ansi/csi.go index b7e5bd2dac..db7f7f9e23 100644 --- a/vendor/github.com/charmbracelet/x/ansi/csi.go +++ b/vendor/github.com/charmbracelet/x/ansi/csi.go @@ -3,8 +3,6 @@ package ansi import ( "bytes" "strconv" - - "github.com/charmbracelet/x/ansi/parser" ) // CsiSequence represents a control sequence introducer (CSI) sequence. @@ -23,7 +21,7 @@ type CsiSequence struct { // This is a slice of integers, where each integer is a 32-bit integer // containing the parameter value in the lower 31 bits and a flag in the // most significant bit indicating whether there are more sub-parameters. - Params []int + Params []Parameter // Cmd contains the raw command of the sequence. // The command is a 32-bit integer containing the CSI command byte in the @@ -35,17 +33,25 @@ type CsiSequence struct { // Is represented as: // // 'u' | '?' << 8 - Cmd int + Cmd Command } var _ Sequence = CsiSequence{} +// Clone returns a deep copy of the CSI sequence. +func (s CsiSequence) Clone() Sequence { + return CsiSequence{ + Params: append([]Parameter(nil), s.Params...), + Cmd: s.Cmd, + } +} + // Marker returns the marker byte of the CSI sequence. // This is always gonna be one of the following '<' '=' '>' '?' and in the // range of 0x3C-0x3F. // Zero is returned if the sequence does not have a marker. func (s CsiSequence) Marker() int { - return parser.Marker(s.Cmd) + return s.Cmd.Marker() } // Intermediate returns the intermediate byte of the CSI sequence. @@ -54,51 +60,22 @@ func (s CsiSequence) Marker() int { // ',', '-', '.', '/'. // Zero is returned if the sequence does not have an intermediate byte. func (s CsiSequence) Intermediate() int { - return parser.Intermediate(s.Cmd) + return s.Cmd.Intermediate() } // Command returns the command byte of the CSI sequence. func (s CsiSequence) Command() int { - return parser.Command(s.Cmd) -} - -// Param returns the parameter at the given index. -// It returns -1 if the parameter does not exist. -func (s CsiSequence) Param(i int) int { - return parser.Param(s.Params, i) -} - -// HasMore returns true if the parameter has more sub-parameters. -func (s CsiSequence) HasMore(i int) bool { - return parser.HasMore(s.Params, i) + return s.Cmd.Command() } -// Subparams returns the sub-parameters of the given parameter. -// It returns nil if the parameter does not exist. -func (s CsiSequence) Subparams(i int) []int { - return parser.Subparams(s.Params, i) -} - -// Len returns the number of parameters in the sequence. -// This will return the number of parameters in the sequence, excluding any -// sub-parameters. -func (s CsiSequence) Len() int { - return parser.Len(s.Params) -} - -// Range iterates over the parameters of the sequence and calls the given -// function for each parameter. -// The function should return false to stop the iteration. -func (s CsiSequence) Range(fn func(i int, param int, hasMore bool) bool) { - parser.Range(s.Params, fn) -} - -// Clone returns a copy of the CSI sequence. -func (s CsiSequence) Clone() Sequence { - return CsiSequence{ - Params: append([]int(nil), s.Params...), - Cmd: s.Cmd, +// Param is a helper that returns the parameter at the given index and falls +// back to the default value if the parameter is missing. If the index is out +// of bounds, it returns the default value and false. +func (s CsiSequence) Param(i, def int) (int, bool) { + if i < 0 || i >= len(s.Params) { + return def, false } + return s.Params[i].Param(def), true } // String returns a string representation of the sequence. @@ -114,23 +91,25 @@ func (s CsiSequence) buffer() *bytes.Buffer { if m := s.Marker(); m != 0 { b.WriteByte(byte(m)) } - s.Range(func(i, param int, hasMore bool) bool { + for i, p := range s.Params { + param := p.Param(-1) if param >= 0 { b.WriteString(strconv.Itoa(param)) } if i < len(s.Params)-1 { - if hasMore { + if p.HasMore() { b.WriteByte(':') } else { b.WriteByte(';') } } - return true - }) + } if i := s.Intermediate(); i != 0 { b.WriteByte(byte(i)) } - b.WriteByte(byte(s.Command())) + if cmd := s.Command(); cmd != 0 { + b.WriteByte(byte(cmd)) + } return &b } diff --git a/vendor/github.com/charmbracelet/x/ansi/ctrl.go b/vendor/github.com/charmbracelet/x/ansi/ctrl.go index 21beb9cd13..e91f11d25e 100644 --- a/vendor/github.com/charmbracelet/x/ansi/ctrl.go +++ b/vendor/github.com/charmbracelet/x/ansi/ctrl.go @@ -1,12 +1,61 @@ package ansi +import ( + "strconv" + "strings" +) + +// RequestNameVersion (XTVERSION) is a control sequence that requests the +// terminal's name and version. It responds with a DSR sequence identifying the +// terminal. +// +// CSI > 0 q +// DCS > | text ST +// +// See https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-PC-Style-Function-Keys +const ( + RequestNameVersion = "\x1b[>0q" + XTVERSION = RequestNameVersion +) + // RequestXTVersion is a control sequence that requests the terminal's XTVERSION. It responds with a DSR sequence identifying the version. // // CSI > Ps q // DCS > | text ST // // See https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-PC-Style-Function-Keys -const RequestXTVersion = "\x1b[>0q" +// Deprecated: use [RequestNameVersion] instead. +const RequestXTVersion = RequestNameVersion + +// PrimaryDeviceAttributes (DA1) is a control sequence that reports the +// terminal's primary device attributes. +// +// CSI c +// CSI 0 c +// CSI ? Ps ; ... c +// +// If no attributes are given, or if the attribute is 0, this function returns +// the request sequence. Otherwise, it returns the response sequence. +// +// See https://vt100.net/docs/vt510-rm/DA1.html +func PrimaryDeviceAttributes(attrs ...int) string { + if len(attrs) == 0 { + return "\x1b[c" + } else if len(attrs) == 1 && attrs[0] == 0 { + return "\x1b[0c" + } + + as := make([]string, len(attrs)) + for i, a := range attrs { + as[i] = strconv.Itoa(a) + } + return "\x1b[?" + strings.Join(as, ";") + "c" +} + +// DA1 is an alias for [PrimaryDeviceAttributes]. +func DA1(attrs ...int) string { + return PrimaryDeviceAttributes(attrs...) +} // RequestPrimaryDeviceAttributes is a control sequence that requests the // terminal's primary device attributes (DA1). @@ -15,3 +64,57 @@ const RequestXTVersion = "\x1b[>0q" // // See https://vt100.net/docs/vt510-rm/DA1.html const RequestPrimaryDeviceAttributes = "\x1b[c" + +// SecondaryDeviceAttributes (DA2) is a control sequence that reports the +// terminal's secondary device attributes. +// +// CSI > c +// CSI > 0 c +// CSI > Ps ; ... c +// +// See https://vt100.net/docs/vt510-rm/DA2.html +func SecondaryDeviceAttributes(attrs ...int) string { + if len(attrs) == 0 { + return "\x1b[>c" + } + + as := make([]string, len(attrs)) + for i, a := range attrs { + as[i] = strconv.Itoa(a) + } + return "\x1b[>" + strings.Join(as, ";") + "c" +} + +// DA2 is an alias for [SecondaryDeviceAttributes]. +func DA2(attrs ...int) string { + return SecondaryDeviceAttributes(attrs...) +} + +// TertiaryDeviceAttributes (DA3) is a control sequence that reports the +// terminal's tertiary device attributes. +// +// CSI = c +// CSI = 0 c +// DCS ! | Text ST +// +// Where Text is the unit ID for the terminal. +// +// If no unit ID is given, or if the unit ID is 0, this function returns the +// request sequence. Otherwise, it returns the response sequence. +// +// See https://vt100.net/docs/vt510-rm/DA3.html +func TertiaryDeviceAttributes(unitID string) string { + switch unitID { + case "": + return "\x1b[=c" + case "0": + return "\x1b[=0c" + } + + return "\x1bP!|" + unitID + "\x1b\\" +} + +// DA3 is an alias for [TertiaryDeviceAttributes]. +func DA3(unitID string) string { + return TertiaryDeviceAttributes(unitID) +} diff --git a/vendor/github.com/charmbracelet/x/ansi/cursor.go b/vendor/github.com/charmbracelet/x/ansi/cursor.go index da144b9269..321ee750a5 100644 --- a/vendor/github.com/charmbracelet/x/ansi/cursor.go +++ b/vendor/github.com/charmbracelet/x/ansi/cursor.go @@ -8,7 +8,10 @@ import "strconv" // ESC 7 // // See: https://vt100.net/docs/vt510-rm/DECSC.html -const SaveCursor = "\x1b7" +const ( + SaveCursor = "\x1b7" + DECSC = SaveCursor +) // RestoreCursor (DECRC) is an escape sequence that restores the cursor // position. @@ -16,10 +19,13 @@ const SaveCursor = "\x1b7" // ESC 8 // // See: https://vt100.net/docs/vt510-rm/DECRC.html -const RestoreCursor = "\x1b8" +const ( + RestoreCursor = "\x1b8" + DECRC = RestoreCursor +) -// RequestCursorPosition (CPR) is an escape sequence that requests the current -// cursor position. +// RequestCursorPosition is an escape sequence that requests the current cursor +// position. // // CSI 6 n // @@ -60,9 +66,18 @@ func CursorUp(n int) string { return "\x1b[" + s + "A" } +// CUU is an alias for [CursorUp]. +func CUU(n int) string { + return CursorUp(n) +} + +// CUU1 is a sequence for moving the cursor up one cell. +const CUU1 = "\x1b[A" + // CursorUp1 is a sequence for moving the cursor up one cell. // // This is equivalent to CursorUp(1). +// Deprecated: use [CUU1] instead. const CursorUp1 = "\x1b[A" // CursorDown (CUD) returns a sequence for moving the cursor down n cells. @@ -78,17 +93,26 @@ func CursorDown(n int) string { return "\x1b[" + s + "B" } +// CUD is an alias for [CursorDown]. +func CUD(n int) string { + return CursorDown(n) +} + +// CUD1 is a sequence for moving the cursor down one cell. +const CUD1 = "\x1b[B" + // CursorDown1 is a sequence for moving the cursor down one cell. // // This is equivalent to CursorDown(1). +// Deprecated: use [CUD1] instead. const CursorDown1 = "\x1b[B" -// CursorRight (CUF) returns a sequence for moving the cursor right n cells. +// CursorForward (CUF) returns a sequence for moving the cursor right n cells. // -// CSI n C +// # CSI n C // // See: https://vt100.net/docs/vt510-rm/CUF.html -func CursorRight(n int) string { +func CursorForward(n int) string { var s string if n > 1 { s = strconv.Itoa(n) @@ -96,17 +120,36 @@ func CursorRight(n int) string { return "\x1b[" + s + "C" } +// CUF is an alias for [CursorForward]. +func CUF(n int) string { + return CursorForward(n) +} + +// CUF1 is a sequence for moving the cursor right one cell. +const CUF1 = "\x1b[C" + +// CursorRight (CUF) returns a sequence for moving the cursor right n cells. +// +// CSI n C +// +// See: https://vt100.net/docs/vt510-rm/CUF.html +// Deprecated: use [CursorForward] instead. +func CursorRight(n int) string { + return CursorForward(n) +} + // CursorRight1 is a sequence for moving the cursor right one cell. // // This is equivalent to CursorRight(1). -const CursorRight1 = "\x1b[C" +// Deprecated: use [CUF1] instead. +const CursorRight1 = CUF1 -// CursorLeft (CUB) returns a sequence for moving the cursor left n cells. +// CursorBackward (CUB) returns a sequence for moving the cursor left n cells. // -// CSI n D +// # CSI n D // // See: https://vt100.net/docs/vt510-rm/CUB.html -func CursorLeft(n int) string { +func CursorBackward(n int) string { var s string if n > 1 { s = strconv.Itoa(n) @@ -114,10 +157,29 @@ func CursorLeft(n int) string { return "\x1b[" + s + "D" } +// CUB is an alias for [CursorBackward]. +func CUB(n int) string { + return CursorBackward(n) +} + +// CUB1 is a sequence for moving the cursor left one cell. +const CUB1 = "\x1b[D" + +// CursorLeft (CUB) returns a sequence for moving the cursor left n cells. +// +// CSI n D +// +// See: https://vt100.net/docs/vt510-rm/CUB.html +// Deprecated: use [CursorBackward] instead. +func CursorLeft(n int) string { + return CursorBackward(n) +} + // CursorLeft1 is a sequence for moving the cursor left one cell. // // This is equivalent to CursorLeft(1). -const CursorLeft1 = "\x1b[D" +// Deprecated: use [CUB1] instead. +const CursorLeft1 = CUB1 // CursorNextLine (CNL) returns a sequence for moving the cursor to the // beginning of the next line n times. @@ -133,6 +195,11 @@ func CursorNextLine(n int) string { return "\x1b[" + s + "E" } +// CNL is an alias for [CursorNextLine]. +func CNL(n int) string { + return CursorNextLine(n) +} + // CursorPreviousLine (CPL) returns a sequence for moving the cursor to the // beginning of the previous line n times. // @@ -147,25 +214,90 @@ func CursorPreviousLine(n int) string { return "\x1b[" + s + "F" } +// CPL is an alias for [CursorPreviousLine]. +func CPL(n int) string { + return CursorPreviousLine(n) +} + +// CursorHorizontalAbsolute (CHA) returns a sequence for moving the cursor to +// the given column. +// +// Default is 1. +// +// CSI n G +// +// See: https://vt100.net/docs/vt510-rm/CHA.html +func CursorHorizontalAbsolute(col int) string { + var s string + if col > 0 { + s = strconv.Itoa(col) + } + return "\x1b[" + s + "G" +} + +// CHA is an alias for [CursorHorizontalAbsolute]. +func CHA(col int) string { + return CursorHorizontalAbsolute(col) +} + +// CursorPosition (CUP) returns a sequence for setting the cursor to the +// given row and column. +// +// Default is 1,1. +// +// CSI n ; m H +// +// See: https://vt100.net/docs/vt510-rm/CUP.html +func CursorPosition(col, row int) string { + if row <= 0 && col <= 0 { + return HomeCursorPosition + } + + var r, c string + if row > 0 { + r = strconv.Itoa(row) + } + if col > 0 { + c = strconv.Itoa(col) + } + return "\x1b[" + r + ";" + c + "H" +} + +// CUP is an alias for [CursorPosition]. +func CUP(col, row int) string { + return CursorPosition(col, row) +} + +// CursorHomePosition is a sequence for moving the cursor to the upper left +// corner of the scrolling region. This is equivalent to `CursorPosition(1, 1)`. +const CursorHomePosition = "\x1b[H" + // SetCursorPosition (CUP) returns a sequence for setting the cursor to the // given row and column. // // CSI n ; m H // // See: https://vt100.net/docs/vt510-rm/CUP.html +// Deprecated: use [CursorPosition] instead. func SetCursorPosition(col, row int) string { - if row < 0 { - row = 0 + if row <= 0 && col <= 0 { + return HomeCursorPosition } - if col < 0 { - col = 0 + + var r, c string + if row > 0 { + r = strconv.Itoa(row) + } + if col > 0 { + c = strconv.Itoa(col) } - return "\x1b[" + strconv.Itoa(row) + ";" + strconv.Itoa(col) + "H" + return "\x1b[" + r + ";" + c + "H" } // HomeCursorPosition is a sequence for moving the cursor to the upper left // corner of the scrolling region. This is equivalent to `SetCursorPosition(1, 1)`. -const HomeCursorPosition = "\x1b[H" +// Deprecated: use [CursorHomePosition] instead. +const HomeCursorPosition = CursorHomePosition // MoveCursor (CUP) returns a sequence for setting the cursor to the // given row and column. @@ -174,7 +306,7 @@ const HomeCursorPosition = "\x1b[H" // // See: https://vt100.net/docs/vt510-rm/CUP.html // -// Deprecated: use SetCursorPosition instead. +// Deprecated: use [CursorPosition] instead. func MoveCursor(col, row int) string { return SetCursorPosition(col, row) } @@ -182,15 +314,165 @@ func MoveCursor(col, row int) string { // CursorOrigin is a sequence for moving the cursor to the upper left corner of // the display. This is equivalent to `SetCursorPosition(1, 1)`. // -// Deprecated: use [HomeCursorPosition] instead. +// Deprecated: use [CursorHomePosition] instead. const CursorOrigin = "\x1b[1;1H" // MoveCursorOrigin is a sequence for moving the cursor to the upper left // corner of the display. This is equivalent to `SetCursorPosition(1, 1)`. // -// Deprecated: use CursorOrigin instead. +// Deprecated: use [CursorHomePosition] instead. const MoveCursorOrigin = CursorOrigin +// CursorHorizontalForwardTab (CHT) returns a sequence for moving the cursor to +// the next tab stop n times. +// +// Default is 1. +// +// CSI n I +// +// See: https://vt100.net/docs/vt510-rm/CHT.html +func CursorHorizontalForwardTab(n int) string { + var s string + if n > 1 { + s = strconv.Itoa(n) + } + return "\x1b[" + s + "I" +} + +// CHT is an alias for [CursorHorizontalForwardTab]. +func CHT(n int) string { + return CursorHorizontalForwardTab(n) +} + +// EraseCharacter (ECH) returns a sequence for erasing n characters and moving +// the cursor to the right. This doesn't affect other cell attributes. +// +// Default is 1. +// +// CSI n X +// +// See: https://vt100.net/docs/vt510-rm/ECH.html +func EraseCharacter(n int) string { + var s string + if n > 1 { + s = strconv.Itoa(n) + } + return "\x1b[" + s + "X" +} + +// ECH is an alias for [EraseCharacter]. +func ECH(n int) string { + return EraseCharacter(n) +} + +// CursorBackwardTab (CBT) returns a sequence for moving the cursor to the +// previous tab stop n times. +// +// Default is 1. +// +// CSI n Z +// +// See: https://vt100.net/docs/vt510-rm/CBT.html +func CursorBackwardTab(n int) string { + var s string + if n > 1 { + s = strconv.Itoa(n) + } + return "\x1b[" + s + "Z" +} + +// CBT is an alias for [CursorBackwardTab]. +func CBT(n int) string { + return CursorBackwardTab(n) +} + +// VerticalPositionAbsolute (VPA) returns a sequence for moving the cursor to +// the given row. +// +// Default is 1. +// +// CSI n d +// +// See: https://vt100.net/docs/vt510-rm/VPA.html +func VerticalPositionAbsolute(row int) string { + var s string + if row > 0 { + s = strconv.Itoa(row) + } + return "\x1b[" + s + "d" +} + +// VPA is an alias for [VerticalPositionAbsolute]. +func VPA(row int) string { + return VerticalPositionAbsolute(row) +} + +// VerticalPositionRelative (VPR) returns a sequence for moving the cursor down +// n rows relative to the current position. +// +// Default is 1. +// +// CSI n e +// +// See: https://vt100.net/docs/vt510-rm/VPR.html +func VerticalPositionRelative(n int) string { + var s string + if n > 1 { + s = strconv.Itoa(n) + } + return "\x1b[" + s + "e" +} + +// VPR is an alias for [VerticalPositionRelative]. +func VPR(n int) string { + return VerticalPositionRelative(n) +} + +// HorizontalVerticalPosition (HVP) returns a sequence for moving the cursor to +// the given row and column. +// +// Default is 1,1. +// +// CSI n ; m f +// +// This has the same effect as [CursorPosition]. +// +// See: https://vt100.net/docs/vt510-rm/HVP.html +func HorizontalVerticalPosition(col, row int) string { + var r, c string + if row > 0 { + r = strconv.Itoa(row) + } + if col > 0 { + c = strconv.Itoa(col) + } + return "\x1b[" + r + ";" + c + "f" +} + +// HVP is an alias for [HorizontalVerticalPosition]. +func HVP(col, row int) string { + return HorizontalVerticalPosition(col, row) +} + +// HorizontalVerticalHomePosition is a sequence for moving the cursor to the +// upper left corner of the scrolling region. This is equivalent to +// `HorizontalVerticalPosition(1, 1)`. +const HorizontalVerticalHomePosition = "\x1b[f" + +// SaveCurrentCursorPosition (SCOSC) is a sequence for saving the current cursor +// position for SCO console mode. +// +// CSI s +// +// This acts like [DECSC], except the page number where the cursor is located +// is not saved. +// +// See: https://vt100.net/docs/vt510-rm/SCOSC.html +const ( + SaveCurrentCursorPosition = "\x1b[s" + SCOSC = SaveCurrentCursorPosition +) + // SaveCursorPosition (SCP or SCOSC) is a sequence for saving the cursor // position. // @@ -200,8 +482,23 @@ const MoveCursorOrigin = CursorOrigin // not saved. // // See: https://vt100.net/docs/vt510-rm/SCOSC.html +// Deprecated: use [SaveCurrentCursorPosition] instead. const SaveCursorPosition = "\x1b[s" +// RestoreCurrentCursorPosition (SCORC) is a sequence for restoring the current +// cursor position for SCO console mode. +// +// CSI u +// +// This acts like [DECRC], except the page number where the cursor was saved is +// not restored. +// +// See: https://vt100.net/docs/vt510-rm/SCORC.html +const ( + RestoreCurrentCursorPosition = "\x1b[u" + SCORC = RestoreCurrentCursorPosition +) + // RestoreCursorPosition (RCP or SCORC) is a sequence for restoring the cursor // position. // @@ -211,10 +508,13 @@ const SaveCursorPosition = "\x1b[s" // cursor was saved. // // See: https://vt100.net/docs/vt510-rm/SCORC.html +// Deprecated: use [RestoreCurrentCursorPosition] instead. const RestoreCursorPosition = "\x1b[u" // SetCursorStyle (DECSCUSR) returns a sequence for changing the cursor style. // +// Default is 1. +// // CSI Ps SP q // // Where Ps is the cursor style: @@ -236,6 +536,11 @@ func SetCursorStyle(style int) string { return "\x1b[" + strconv.Itoa(style) + " q" } +// DECSCUSR is an alias for [SetCursorStyle]. +func DECSCUSR(style int) string { + return SetCursorStyle(style) +} + // SetPointerShape returns a sequence for changing the mouse pointer cursor // shape. Use "default" for the default pointer shape. // @@ -257,3 +562,58 @@ func SetCursorStyle(style int) string { func SetPointerShape(shape string) string { return "\x1b]22;" + shape + "\x07" } + +// ReverseIndex (RI) is an escape sequence for moving the cursor up one line in +// the same column. If the cursor is at the top margin, the screen scrolls +// down. +// +// This has the same effect as [RI]. +const ReverseIndex = "\x1bM" + +// HorizontalPositionAbsolute (HPA) returns a sequence for moving the cursor to +// the given column. This has the same effect as [CUP]. +// +// Default is 1. +// +// CSI n ` +// +// See: https://vt100.net/docs/vt510-rm/HPA.html +func HorizontalPositionAbsolute(col int) string { + var s string + if col > 0 { + s = strconv.Itoa(col) + } + return "\x1b[" + s + "`" +} + +// HPA is an alias for [HorizontalPositionAbsolute]. +func HPA(col int) string { + return HorizontalPositionAbsolute(col) +} + +// HorizontalPositionRelative (HPR) returns a sequence for moving the cursor +// right n columns relative to the current position. This has the same effect +// as [CUP]. +// +// Default is 1. +// +// CSI n a +// +// See: https://vt100.net/docs/vt510-rm/HPR.html +func HorizontalPositionRelative(n int) string { + var s string + if n > 0 { + s = strconv.Itoa(n) + } + return "\x1b[" + s + "a" +} + +// HPR is an alias for [HorizontalPositionRelative]. +func HPR(n int) string { + return HorizontalPositionRelative(n) +} + +// Index (IND) is an escape sequence for moving the cursor down one line in the +// same column. If the cursor is at the bottom margin, the screen scrolls up. +// This has the same effect as [IND]. +const Index = "\x1bD" diff --git a/vendor/github.com/charmbracelet/x/ansi/cwd.go b/vendor/github.com/charmbracelet/x/ansi/cwd.go new file mode 100644 index 0000000000..b03ac1bb99 --- /dev/null +++ b/vendor/github.com/charmbracelet/x/ansi/cwd.go @@ -0,0 +1,26 @@ +package ansi + +import ( + "net/url" + "path" +) + +// NotifyWorkingDirectory returns a sequence that notifies the terminal +// of the current working directory. +// +// OSC 7 ; Pt BEL +// +// Where Pt is a URL in the format "file://[host]/[path]". +// Set host to "localhost" if this is a path on the local computer. +// +// See: https://wezfurlong.org/wezterm/shell-integration.html#osc-7-escape-sequence-to-set-the-working-directory +// See: https://iterm2.com/documentation-escape-codes.html#:~:text=RemoteHost%20and%20CurrentDir%3A-,OSC%207,-%3B%20%5BPs%5D%20ST +func NotifyWorkingDirectory(host string, paths ...string) string { + path := path.Join(paths...) + u := &url.URL{ + Scheme: "file", + Host: host, + Path: path, + } + return "\x1b]7;" + u.String() + "\x07" +} diff --git a/vendor/github.com/charmbracelet/x/ansi/dcs.go b/vendor/github.com/charmbracelet/x/ansi/dcs.go index 185f0b52bc..03d5ebfce6 100644 --- a/vendor/github.com/charmbracelet/x/ansi/dcs.go +++ b/vendor/github.com/charmbracelet/x/ansi/dcs.go @@ -3,8 +3,7 @@ package ansi import ( "bytes" "strconv" - - "github.com/charmbracelet/x/ansi/parser" + "strings" ) // DcsSequence represents a Device Control String (DCS) escape sequence. @@ -22,7 +21,7 @@ type DcsSequence struct { // This is a slice of integers, where each integer is a 32-bit integer // containing the parameter value in the lower 31 bits and a flag in the // most significant bit indicating whether there are more sub-parameters. - Params []int + Params []Parameter // Data contains the string raw data of the sequence. // This is the data between the final byte and the escape sequence terminator. @@ -38,17 +37,31 @@ type DcsSequence struct { // Is represented as: // // 'r' | '>' << 8 | '$' << 16 - Cmd int + Cmd Command } var _ Sequence = DcsSequence{} +// Clone returns a deep copy of the DCS sequence. +func (s DcsSequence) Clone() Sequence { + return DcsSequence{ + Params: append([]Parameter(nil), s.Params...), + Data: append([]byte(nil), s.Data...), + Cmd: s.Cmd, + } +} + +// Split returns a slice of data split by the semicolon. +func (s DcsSequence) Split() []string { + return strings.Split(string(s.Data), ";") +} + // Marker returns the marker byte of the DCS sequence. // This is always gonna be one of the following '<' '=' '>' '?' and in the // range of 0x3C-0x3F. // Zero is returned if the sequence does not have a marker. func (s DcsSequence) Marker() int { - return parser.Marker(s.Cmd) + return s.Cmd.Marker() } // Intermediate returns the intermediate byte of the DCS sequence. @@ -57,52 +70,22 @@ func (s DcsSequence) Marker() int { // ',', '-', '.', '/'. // Zero is returned if the sequence does not have an intermediate byte. func (s DcsSequence) Intermediate() int { - return parser.Intermediate(s.Cmd) + return s.Cmd.Intermediate() } // Command returns the command byte of the CSI sequence. func (s DcsSequence) Command() int { - return parser.Command(s.Cmd) -} - -// Param returns the parameter at the given index. -// It returns -1 if the parameter does not exist. -func (s DcsSequence) Param(i int) int { - return parser.Param(s.Params, i) -} - -// HasMore returns true if the parameter has more sub-parameters. -func (s DcsSequence) HasMore(i int) bool { - return parser.HasMore(s.Params, i) -} - -// Subparams returns the sub-parameters of the given parameter. -// It returns nil if the parameter does not exist. -func (s DcsSequence) Subparams(i int) []int { - return parser.Subparams(s.Params, i) -} - -// Len returns the number of parameters in the sequence. -// This will return the number of parameters in the sequence, excluding any -// sub-parameters. -func (s DcsSequence) Len() int { - return parser.Len(s.Params) -} - -// Range iterates over the parameters of the sequence and calls the given -// function for each parameter. -// The function should return false to stop the iteration. -func (s DcsSequence) Range(fn func(i int, param int, hasMore bool) bool) { - parser.Range(s.Params, fn) + return s.Cmd.Command() } -// Clone returns a copy of the DCS sequence. -func (s DcsSequence) Clone() Sequence { - return DcsSequence{ - Params: append([]int(nil), s.Params...), - Data: append([]byte(nil), s.Data...), - Cmd: s.Cmd, +// Param is a helper that returns the parameter at the given index and falls +// back to the default value if the parameter is missing. If the index is out +// of bounds, it returns the default value and false. +func (s DcsSequence) Param(i, def int) (int, bool) { + if i < 0 || i >= len(s.Params) { + return def, false } + return s.Params[i].Param(def), true } // String returns a string representation of the sequence. @@ -118,23 +101,25 @@ func (s DcsSequence) buffer() *bytes.Buffer { if m := s.Marker(); m != 0 { b.WriteByte(byte(m)) } - s.Range(func(i, param int, hasMore bool) bool { - if param >= -1 { + for i, p := range s.Params { + param := p.Param(-1) + if param >= 0 { b.WriteString(strconv.Itoa(param)) } if i < len(s.Params)-1 { - if hasMore { + if p.HasMore() { b.WriteByte(':') } else { b.WriteByte(';') } } - return true - }) + } if i := s.Intermediate(); i != 0 { b.WriteByte(byte(i)) } - b.WriteByte(byte(s.Command())) + if cmd := s.Command(); cmd != 0 { + b.WriteByte(byte(cmd)) + } b.Write(s.Data) b.WriteByte(ESC) b.WriteByte('\\') diff --git a/vendor/github.com/charmbracelet/x/ansi/focus.go b/vendor/github.com/charmbracelet/x/ansi/focus.go new file mode 100644 index 0000000000..4e0207cebb --- /dev/null +++ b/vendor/github.com/charmbracelet/x/ansi/focus.go @@ -0,0 +1,9 @@ +package ansi + +// Focus is an escape sequence to notify the terminal that it has focus. +// This is used with [FocusEventMode]. +const Focus = "\x1b[I" + +// Blur is an escape sequence to notify the terminal that it has lost focus. +// This is used with [FocusEventMode]. +const Blur = "\x1b[O" diff --git a/vendor/github.com/charmbracelet/x/ansi/keypad.go b/vendor/github.com/charmbracelet/x/ansi/keypad.go new file mode 100644 index 0000000000..9183c6a7ec --- /dev/null +++ b/vendor/github.com/charmbracelet/x/ansi/keypad.go @@ -0,0 +1,28 @@ +package ansi + +// Keypad Application Mode (DECKPAM) is a mode that determines whether the +// keypad sends application sequences or ANSI sequences. +// +// This works like enabling [DECNKM]. +// Use [NumericKeypadMode] to set the numeric keypad mode. +// +// ESC = +// +// See: https://vt100.net/docs/vt510-rm/DECKPAM.html +const ( + KeypadApplicationMode = "\x1b=" + DECKPAM = KeypadApplicationMode +) + +// Keypad Numeric Mode (DECKPNM) is a mode that determines whether the keypad +// sends application sequences or ANSI sequences. +// +// This works the same as disabling [DECNKM]. +// +// ESC > +// +// See: https://vt100.net/docs/vt510-rm/DECKPNM.html +const ( + KeypadNumericMode = "\x1b>" + DECKPNM = KeypadNumericMode +) diff --git a/vendor/github.com/charmbracelet/x/ansi/mode.go b/vendor/github.com/charmbracelet/x/ansi/mode.go index 10dfcf5af8..2e77c73838 100644 --- a/vendor/github.com/charmbracelet/x/ansi/mode.go +++ b/vendor/github.com/charmbracelet/x/ansi/mode.go @@ -1,144 +1,671 @@ package ansi -import "strconv" +import ( + "strconv" + "strings" +) + +// ModeSetting represents a mode setting. +type ModeSetting byte + +// ModeSetting constants. +const ( + ModeNotRecognized ModeSetting = iota + ModeSet + ModeReset + ModePermanentlySet + ModePermanentlyReset +) + +// IsNotRecognized returns true if the mode is not recognized. +func (m ModeSetting) IsNotRecognized() bool { + return m == ModeNotRecognized +} + +// IsSet returns true if the mode is set or permanently set. +func (m ModeSetting) IsSet() bool { + return m == ModeSet || m == ModePermanentlySet +} + +// IsReset returns true if the mode is reset or permanently reset. +func (m ModeSetting) IsReset() bool { + return m == ModeReset || m == ModePermanentlyReset +} + +// IsPermanentlySet returns true if the mode is permanently set. +func (m ModeSetting) IsPermanentlySet() bool { + return m == ModePermanentlySet +} + +// IsPermanentlyReset returns true if the mode is permanently reset. +func (m ModeSetting) IsPermanentlyReset() bool { + return m == ModePermanentlyReset +} -// This file define uses multiple sequences to set (SM), reset (RM), and request -// (DECRQM) different ANSI and DEC modes. +// Mode represents an interface for terminal modes. +// Modes can be set, reset, and requested. +type Mode interface { + Mode() int +} + +// SetMode (SM) returns a sequence to set a mode. +// The mode arguments are a list of modes to set. +// +// If one of the modes is a [DECMode], the sequence will use the DEC format. +// +// ANSI format: +// +// CSI Pd ; ... ; Pd h +// +// DEC format: +// +// CSI ? Pd ; ... ; Pd h // // See: https://vt100.net/docs/vt510-rm/SM.html +func SetMode(modes ...Mode) string { + return setMode(false, modes...) +} + +// SM is an alias for [SetMode]. +func SM(modes ...Mode) string { + return SetMode(modes...) +} + +// ResetMode (RM) returns a sequence to reset a mode. +// The mode arguments are a list of modes to reset. +// +// If one of the modes is a [DECMode], the sequence will use the DEC format. +// +// ANSI format: +// +// CSI Pd ; ... ; Pd l +// +// DEC format: +// +// CSI ? Pd ; ... ; Pd l +// // See: https://vt100.net/docs/vt510-rm/RM.html -// See: https://vt100.net/docs/vt510-rm/DECRQM.html +func ResetMode(modes ...Mode) string { + return setMode(true, modes...) +} + +// RM is an alias for [ResetMode]. +func RM(modes ...Mode) string { + return ResetMode(modes...) +} + +func setMode(reset bool, modes ...Mode) string { + if len(modes) == 0 { + return "" + } + + cmd := "h" + if reset { + cmd = "l" + } + + seq := "\x1b[" + if len(modes) == 1 { + switch modes[0].(type) { + case DECMode: + seq += "?" + } + return seq + strconv.Itoa(modes[0].Mode()) + cmd + } + + var dec bool + list := make([]string, len(modes)) + for i, m := range modes { + list[i] = strconv.Itoa(m.Mode()) + switch m.(type) { + case DECMode: + dec = true + } + } + + if dec { + seq += "?" + } + + return seq + strings.Join(list, ";") + cmd +} + +// RequestMode (DECRQM) returns a sequence to request a mode from the terminal. +// The terminal responds with a report mode function [DECRPM]. // -// The terminal then responds to the request with a Report Mode function -// (DECRPM) in the format: +// ANSI format: +// +// CSI Pa $ p +// +// DEC format: +// +// CSI ? Pa $ p +// +// See: https://vt100.net/docs/vt510-rm/DECRQM.html +func RequestMode(m Mode) string { + seq := "\x1b[" + switch m.(type) { + case DECMode: + seq += "?" + } + return seq + strconv.Itoa(m.Mode()) + "$p" +} + +// DECRQM is an alias for [RequestMode]. +func DECRQM(m Mode) string { + return RequestMode(m) +} + +// ReportMode (DECRPM) returns a sequence that the terminal sends to the host +// in response to a mode request [DECRQM]. // // ANSI format: // -// CSI Pa ; Ps ; $ y +// CSI Pa ; Ps ; $ y // // DEC format: // -// CSI ? Pa ; Ps $ y +// CSI ? Pa ; Ps $ y // // Where Pa is the mode number, and Ps is the mode value. +// +// 0: Not recognized +// 1: Set +// 2: Reset +// 3: Permanent set +// 4: Permanent reset +// // See: https://vt100.net/docs/vt510-rm/DECRPM.html +func ReportMode(mode Mode, value ModeSetting) string { + if value > 4 { + value = 0 + } + switch mode.(type) { + case DECMode: + return "\x1b[?" + strconv.Itoa(mode.Mode()) + ";" + strconv.Itoa(int(value)) + "$y" + } + return "\x1b[" + strconv.Itoa(mode.Mode()) + ";" + strconv.Itoa(int(value)) + "$y" +} -// Mode represents an ANSI terminal mode. -type Mode int +// DECRPM is an alias for [ReportMode]. +func DECRPM(mode Mode, value ModeSetting) string { + return ReportMode(mode, value) +} + +// ANSIMode represents an ANSI terminal mode. +type ANSIMode int //nolint:revive -// String returns the mode as a string. -func (m Mode) String() string { - return strconv.Itoa(int(m)) +// Mode returns the ANSI mode as an integer. +func (m ANSIMode) Mode() int { + return int(m) } -// PrivateMode represents a private DEC terminal mode. -type PrivateMode int +// DECMode represents a private DEC terminal mode. +type DECMode int -// String returns the private mode as a string. -func (m PrivateMode) String() string { - return "?" + strconv.Itoa(int(m)) +// Mode returns the DEC mode as an integer. +func (m DECMode) Mode() int { + return int(m) } -// Application Cursor Keys (DECCKM) is a mode that determines whether the -// cursor keys send ANSI cursor sequences or application sequences. +// Keyboard Action Mode (KAM) is a mode that controls locking of the keyboard. +// When the keyboard is locked, it cannot send data to the terminal. +// +// See: https://vt100.net/docs/vt510-rm/KAM.html +const ( + KeyboardActionMode = ANSIMode(2) + KAM = KeyboardActionMode + + SetKeyboardActionMode = "\x1b[2h" + ResetKeyboardActionMode = "\x1b[2l" + RequestKeyboardActionMode = "\x1b[2$p" +) + +// Insert/Replace Mode (IRM) is a mode that determines whether characters are +// inserted or replaced when typed. +// +// When enabled, characters are inserted at the cursor position pushing the +// characters to the right. When disabled, characters replace the character at +// the cursor position. +// +// See: https://vt100.net/docs/vt510-rm/IRM.html +const ( + InsertReplaceMode = ANSIMode(4) + IRM = InsertReplaceMode + + SetInsertReplaceMode = "\x1b[4h" + ResetInsertReplaceMode = "\x1b[4l" + RequestInsertReplaceMode = "\x1b[4$p" +) + +// Send Receive Mode (SRM) or Local Echo Mode is a mode that determines whether +// the terminal echoes characters back to the host. When enabled, the terminal +// sends characters to the host as they are typed. +// +// See: https://vt100.net/docs/vt510-rm/SRM.html +const ( + SendReceiveMode = ANSIMode(12) + LocalEchoMode = SendReceiveMode + SRM = SendReceiveMode + + SetSendReceiveMode = "\x1b[12h" + ResetSendReceiveMode = "\x1b[12l" + RequestSendReceiveMode = "\x1b[12$p" + + SetLocalEchoMode = "\x1b[12h" + ResetLocalEchoMode = "\x1b[12l" + RequestLocalEchoMode = "\x1b[12$p" +) + +// Line Feed/New Line Mode (LNM) is a mode that determines whether the terminal +// interprets the line feed character as a new line. +// +// When enabled, the terminal interprets the line feed character as a new line. +// When disabled, the terminal interprets the line feed character as a line feed. +// +// A new line moves the cursor to the first position of the next line. +// A line feed moves the cursor down one line without changing the column +// scrolling the screen if necessary. +// +// See: https://vt100.net/docs/vt510-rm/LNM.html +const ( + LineFeedNewLineMode = ANSIMode(20) + LNM = LineFeedNewLineMode + + SetLineFeedNewLineMode = "\x1b[20h" + ResetLineFeedNewLineMode = "\x1b[20l" + RequestLineFeedNewLineMode = "\x1b[20$p" +) + +// Cursor Keys Mode (DECCKM) is a mode that determines whether the cursor keys +// send ANSI cursor sequences or application sequences. // // See: https://vt100.net/docs/vt510-rm/DECCKM.html const ( - CursorKeysMode = PrivateMode(1) + CursorKeysMode = DECMode(1) + DECCKM = CursorKeysMode + + SetCursorKeysMode = "\x1b[?1h" + ResetCursorKeysMode = "\x1b[?1l" + RequestCursorKeysMode = "\x1b[?1$p" +) +// Deprecated: use [SetCursorKeysMode] and [ResetCursorKeysMode] instead. +const ( EnableCursorKeys = "\x1b[?1h" DisableCursorKeys = "\x1b[?1l" - RequestCursorKeys = "\x1b[?1$p" +) + +// Origin Mode (DECOM) is a mode that determines whether the cursor moves to the +// home position or the margin position. +// +// See: https://vt100.net/docs/vt510-rm/DECOM.html +const ( + OriginMode = DECMode(6) + DECOM = OriginMode + + SetOriginMode = "\x1b[?6h" + ResetOriginMode = "\x1b[?6l" + RequestOriginMode = "\x1b[?6$p" +) + +// Auto Wrap Mode (DECAWM) is a mode that determines whether the cursor wraps +// to the next line when it reaches the right margin. +// +// See: https://vt100.net/docs/vt510-rm/DECAWM.html +const ( + AutoWrapMode = DECMode(7) + DECAWM = AutoWrapMode + + SetAutoWrapMode = "\x1b[?7h" + ResetAutoWrapMode = "\x1b[?7l" + RequestAutoWrapMode = "\x1b[?7$p" +) + +// X10 Mouse Mode is a mode that determines whether the mouse reports on button +// presses. +// +// The terminal responds with the following encoding: +// +// CSI M CbCxCy +// +// Where Cb is the button-1, where it can be 1, 2, or 3. +// Cx and Cy are the x and y coordinates of the mouse event. +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking +const ( + X10MouseMode = DECMode(9) + + SetX10MouseMode = "\x1b[?9h" + ResetX10MouseMode = "\x1b[?9l" + RequestX10MouseMode = "\x1b[?9$p" ) // Text Cursor Enable Mode (DECTCEM) is a mode that shows/hides the cursor. // // See: https://vt100.net/docs/vt510-rm/DECTCEM.html const ( - CursorEnableMode = PrivateMode(25) + TextCursorEnableMode = DECMode(25) + DECTCEM = TextCursorEnableMode + + SetTextCursorEnableMode = "\x1b[?25h" + ResetTextCursorEnableMode = "\x1b[?25l" + RequestTextCursorEnableMode = "\x1b[?25$p" +) + +// These are aliases for [SetTextCursorEnableMode] and [ResetTextCursorEnableMode]. +const ( + ShowCursor = SetTextCursorEnableMode + HideCursor = ResetTextCursorEnableMode +) - ShowCursor = "\x1b[?25h" - HideCursor = "\x1b[?25l" +// Text Cursor Enable Mode (DECTCEM) is a mode that shows/hides the cursor. +// +// See: https://vt100.net/docs/vt510-rm/DECTCEM.html +// +// Deprecated: use [SetTextCursorEnableMode] and [ResetTextCursorEnableMode] instead. +const ( + CursorEnableMode = DECMode(25) RequestCursorVisibility = "\x1b[?25$p" ) +// Numeric Keypad Mode (DECNKM) is a mode that determines whether the keypad +// sends application sequences or numeric sequences. +// +// This works like [DECKPAM] and [DECKPNM], but uses different sequences. +// +// See: https://vt100.net/docs/vt510-rm/DECNKM.html +const ( + NumericKeypadMode = DECMode(66) + DECNKM = NumericKeypadMode + + SetNumericKeypadMode = "\x1b[?66h" + ResetNumericKeypadMode = "\x1b[?66l" + RequestNumericKeypadMode = "\x1b[?66$p" +) + +// Backarrow Key Mode (DECBKM) is a mode that determines whether the backspace +// key sends a backspace or delete character. Disabled by default. +// +// See: https://vt100.net/docs/vt510-rm/DECBKM.html +const ( + BackarrowKeyMode = DECMode(67) + DECBKM = BackarrowKeyMode + + SetBackarrowKeyMode = "\x1b[?67h" + ResetBackarrowKeyMode = "\x1b[?67l" + RequestBackarrowKeyMode = "\x1b[?67$p" +) + +// Left Right Margin Mode (DECLRMM) is a mode that determines whether the left +// and right margins can be set with [DECSLRM]. +// +// See: https://vt100.net/docs/vt510-rm/DECLRMM.html +const ( + LeftRightMarginMode = DECMode(69) + DECLRMM = LeftRightMarginMode + + SetLeftRightMarginMode = "\x1b[?69h" + ResetLeftRightMarginMode = "\x1b[?69l" + RequestLeftRightMarginMode = "\x1b[?69$p" +) + +// Normal Mouse Mode is a mode that determines whether the mouse reports on +// button presses and releases. It will also report modifier keys, wheel +// events, and extra buttons. +// +// It uses the same encoding as [X10MouseMode] with a few differences: +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking +const ( + NormalMouseMode = DECMode(1000) + + SetNormalMouseMode = "\x1b[?1000h" + ResetNormalMouseMode = "\x1b[?1000l" + RequestNormalMouseMode = "\x1b[?1000$p" +) + // VT Mouse Tracking is a mode that determines whether the mouse reports on // button press and release. // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking +// +// Deprecated: use [NormalMouseMode] instead. const ( - MouseMode = PrivateMode(1000) + MouseMode = DECMode(1000) EnableMouse = "\x1b[?1000h" DisableMouse = "\x1b[?1000l" RequestMouse = "\x1b[?1000$p" ) +// Highlight Mouse Tracking is a mode that determines whether the mouse reports +// on button presses, releases, and highlighted cells. +// +// It uses the same encoding as [NormalMouseMode] with a few differences: +// +// On highlight events, the terminal responds with the following encoding: +// +// CSI t CxCy +// CSI T CxCyCxCyCxCy +// +// Where the parameters are startx, starty, endx, endy, mousex, and mousey. +const ( + HighlightMouseMode = DECMode(1001) + + SetHighlightMouseMode = "\x1b[?1001h" + ResetHighlightMouseMode = "\x1b[?1001l" + RequestHighlightMouseMode = "\x1b[?1001$p" +) + // VT Hilite Mouse Tracking is a mode that determines whether the mouse reports on // button presses, releases, and highlighted cells. // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking +// +// Deprecated: use [HighlightMouseMode] instead. const ( - MouseHiliteMode = PrivateMode(1001) + MouseHiliteMode = DECMode(1001) EnableMouseHilite = "\x1b[?1001h" DisableMouseHilite = "\x1b[?1001l" RequestMouseHilite = "\x1b[?1001$p" ) +// Button Event Mouse Tracking is essentially the same as [NormalMouseMode], +// but it also reports button-motion events when a button is pressed. +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking +const ( + ButtonEventMouseMode = DECMode(1002) + + SetButtonEventMouseMode = "\x1b[?1002h" + ResetButtonEventMouseMode = "\x1b[?1002l" + RequestButtonEventMouseMode = "\x1b[?1002$p" +) + // Cell Motion Mouse Tracking is a mode that determines whether the mouse // reports on button press, release, and motion events. // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking +// +// Deprecated: use [ButtonEventMouseMode] instead. const ( - MouseCellMotionMode = PrivateMode(1002) + MouseCellMotionMode = DECMode(1002) EnableMouseCellMotion = "\x1b[?1002h" DisableMouseCellMotion = "\x1b[?1002l" RequestMouseCellMotion = "\x1b[?1002$p" ) +// Any Event Mouse Tracking is the same as [ButtonEventMouseMode], except that +// all motion events are reported even if no mouse buttons are pressed. +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking +const ( + AnyEventMouseMode = DECMode(1003) + + SetAnyEventMouseMode = "\x1b[?1003h" + ResetAnyEventMouseMode = "\x1b[?1003l" + RequestAnyEventMouseMode = "\x1b[?1003$p" +) + // All Mouse Tracking is a mode that determines whether the mouse reports on // button press, release, motion, and highlight events. // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking +// +// Deprecated: use [AnyEventMouseMode] instead. const ( - MouseAllMotionMode = PrivateMode(1003) + MouseAllMotionMode = DECMode(1003) EnableMouseAllMotion = "\x1b[?1003h" DisableMouseAllMotion = "\x1b[?1003l" RequestMouseAllMotion = "\x1b[?1003$p" ) -// Report Focus is a mode that makes the terminal report focus-in and focus-out events. +// Focus Event Mode is a mode that determines whether the terminal reports focus +// and blur events. +// +// The terminal sends the following encoding: // -// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-FocusIn_FocusOut +// CSI I // Focus In +// CSI O // Focus Out +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Focus-Tracking const ( - ReportFocusMode = PrivateMode(1004) + FocusEventMode = DECMode(1004) + + SetFocusEventMode = "\x1b[?1004h" + ResetFocusEventMode = "\x1b[?1004l" + RequestFocusEventMode = "\x1b[?1004$p" +) + +// Deprecated: use [SetFocusEventMode], [ResetFocusEventMode], and +// [RequestFocusEventMode] instead. +const ( + ReportFocusMode = DECMode(1004) EnableReportFocus = "\x1b[?1004h" DisableReportFocus = "\x1b[?1004l" RequestReportFocus = "\x1b[?1004$p" ) -// SGR Mouse Extension is a mode that determines whether the mouse reports events -// formatted with SGR parameters. +// SGR Extended Mouse Mode is a mode that changes the mouse tracking encoding +// to use SGR parameters. +// +// The terminal responds with the following encoding: +// +// CSI < Cb ; Cx ; Cy M +// +// Where Cb is the same as [NormalMouseMode], and Cx and Cy are the x and y. // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking const ( - MouseSgrExtMode = PrivateMode(1006) + SgrExtMouseMode = DECMode(1006) + + SetSgrExtMouseMode = "\x1b[?1006h" + ResetSgrExtMouseMode = "\x1b[?1006l" + RequestSgrExtMouseMode = "\x1b[?1006$p" +) +// Deprecated: use [SgrExtMouseMode] [SetSgrExtMouseMode], +// [ResetSgrExtMouseMode], and [RequestSgrExtMouseMode] instead. +const ( + MouseSgrExtMode = DECMode(1006) EnableMouseSgrExt = "\x1b[?1006h" DisableMouseSgrExt = "\x1b[?1006l" RequestMouseSgrExt = "\x1b[?1006$p" ) +// UTF-8 Extended Mouse Mode is a mode that changes the mouse tracking encoding +// to use UTF-8 parameters. +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking +const ( + Utf8ExtMouseMode = DECMode(1005) + + SetUtf8ExtMouseMode = "\x1b[?1005h" + ResetUtf8ExtMouseMode = "\x1b[?1005l" + RequestUtf8ExtMouseMode = "\x1b[?1005$p" +) + +// URXVT Extended Mouse Mode is a mode that changes the mouse tracking encoding +// to use an alternate encoding. +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking +const ( + UrxvtExtMouseMode = DECMode(1015) + + SetUrxvtExtMouseMode = "\x1b[?1015h" + ResetUrxvtExtMouseMode = "\x1b[?1015l" + RequestUrxvtExtMouseMode = "\x1b[?1015$p" +) + +// SGR Pixel Extended Mouse Mode is a mode that changes the mouse tracking +// encoding to use SGR parameters with pixel coordinates. +// +// This is similar to [SgrExtMouseMode], but also reports pixel coordinates. +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Mouse-Tracking +const ( + SgrPixelExtMouseMode = DECMode(1016) + + SetSgrPixelExtMouseMode = "\x1b[?1016h" + ResetSgrPixelExtMouseMode = "\x1b[?1016l" + RequestSgrPixelExtMouseMode = "\x1b[?1016$p" +) + +// Alternate Screen Mode is a mode that determines whether the alternate screen +// buffer is active. When this mode is enabled, the alternate screen buffer is +// cleared. +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer +const ( + AltScreenMode = DECMode(1047) + + SetAltScreenMode = "\x1b[?1047h" + ResetAltScreenMode = "\x1b[?1047l" + RequestAltScreenMode = "\x1b[?1047$p" +) + +// Save Cursor Mode is a mode that saves the cursor position. +// This is equivalent to [SaveCursor] and [RestoreCursor]. +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer +const ( + SaveCursorMode = DECMode(1048) + + SetSaveCursorMode = "\x1b[?1048h" + ResetSaveCursorMode = "\x1b[?1048l" + RequestSaveCursorMode = "\x1b[?1048$p" +) + +// Alternate Screen Save Cursor Mode is a mode that saves the cursor position as in +// [SaveCursorMode], switches to the alternate screen buffer as in [AltScreenMode], +// and clears the screen on switch. +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer +const ( + AltScreenSaveCursorMode = DECMode(1049) + + SetAltScreenSaveCursorMode = "\x1b[?1049h" + ResetAltScreenSaveCursorMode = "\x1b[?1049l" + RequestAltScreenSaveCursorMode = "\x1b[?1049$p" +) + // Alternate Screen Buffer is a mode that determines whether the alternate screen // buffer is active. // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-The-Alternate-Screen-Buffer +// +// Deprecated: use [AltScreenSaveCursorMode] instead. const ( - AltScreenBufferMode = PrivateMode(1049) + AltScreenBufferMode = DECMode(1049) + + SetAltScreenBufferMode = "\x1b[?1049h" + ResetAltScreenBufferMode = "\x1b[?1049l" + RequestAltScreenBufferMode = "\x1b[?1049$p" EnableAltScreenBuffer = "\x1b[?1049h" DisableAltScreenBuffer = "\x1b[?1049l" @@ -151,8 +678,16 @@ const ( // See: https://cirw.in/blog/bracketed-paste // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h2-Bracketed-Paste-Mode const ( - BracketedPasteMode = PrivateMode(2004) + BracketedPasteMode = DECMode(2004) + + SetBracketedPasteMode = "\x1b[?2004h" + ResetBracketedPasteMode = "\x1b[?2004l" + RequestBracketedPasteMode = "\x1b[?2004$p" +) +// Deprecated: use [SetBracketedPasteMode], [ResetBracketedPasteMode], and +// [RequestBracketedPasteMode] instead. +const ( EnableBracketedPaste = "\x1b[?2004h" DisableBracketedPaste = "\x1b[?2004l" RequestBracketedPaste = "\x1b[?2004$p" @@ -163,7 +698,17 @@ const ( // // See: https://gist.github.com/christianparpart/d8a62cc1ab659194337d73e399004036 const ( - SyncdOutputMode = PrivateMode(2026) + SynchronizedOutputMode = DECMode(2026) + + SetSynchronizedOutputMode = "\x1b[?2026h" + ResetSynchronizedOutputMode = "\x1b[?2026l" + RequestSynchronizedOutputMode = "\x1b[?2026$p" +) + +// Deprecated: use [SynchronizedOutputMode], [SetSynchronizedOutputMode], and +// [ResetSynchronizedOutputMode], and [RequestSynchronizedOutputMode] instead. +const ( + SyncdOutputMode = DECMode(2026) EnableSyncdOutput = "\x1b[?2026h" DisableSyncdOutput = "\x1b[?2026l" @@ -177,8 +722,16 @@ const ( // // See: https://github.com/contour-terminal/terminal-unicode-core const ( - GraphemeClusteringMode = PrivateMode(2027) + GraphemeClusteringMode = DECMode(2027) + + SetGraphemeClusteringMode = "\x1b[?2027h" + ResetGraphemeClusteringMode = "\x1b[?2027l" + RequestGraphemeClusteringMode = "\x1b[?2027$p" +) +// Deprecated: use [SetGraphemeClusteringMode], [ResetGraphemeClusteringMode], and +// [RequestGraphemeClusteringMode] instead. +const ( EnableGraphemeClustering = "\x1b[?2027h" DisableGraphemeClustering = "\x1b[?2027l" RequestGraphemeClustering = "\x1b[?2027$p" @@ -189,8 +742,16 @@ const ( // // See: https://github.com/microsoft/terminal/blob/main/doc/specs/%234999%20-%20Improved%20keyboard%20handling%20in%20Conpty.md const ( - Win32InputMode = PrivateMode(9001) + Win32InputMode = DECMode(9001) + SetWin32InputMode = "\x1b[?9001h" + ResetWin32InputMode = "\x1b[?9001l" + RequestWin32InputMode = "\x1b[?9001$p" +) + +// Deprecated: use [SetWin32InputMode], [ResetWin32InputMode], and +// [RequestWin32InputMode] instead. +const ( EnableWin32Input = "\x1b[?9001h" DisableWin32Input = "\x1b[?9001l" RequestWin32Input = "\x1b[?9001$p" diff --git a/vendor/github.com/charmbracelet/x/ansi/mouse.go b/vendor/github.com/charmbracelet/x/ansi/mouse.go new file mode 100644 index 0000000000..bae52b7167 --- /dev/null +++ b/vendor/github.com/charmbracelet/x/ansi/mouse.go @@ -0,0 +1,36 @@ +package ansi + +import ( + "fmt" +) + +// MouseX10 returns an escape sequence representing a mouse event in X10 mode. +// Note that this requires the terminal support X10 mouse modes. +// +// CSI M Cb Cx Cy +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Mouse%20Tracking +func MouseX10(b byte, x, y int) string { + const x10Offset = 32 + return "\x1b[M" + string(b+x10Offset) + string(byte(x)+x10Offset+1) + string(byte(y)+x10Offset+1) +} + +// MouseSgr returns an escape sequence representing a mouse event in SGR mode. +// +// CSI < Cb ; Cx ; Cy M +// CSI < Cb ; Cx ; Cy m (release) +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#Mouse%20Tracking +func MouseSgr(b byte, x, y int, release bool) string { + s := "M" + if release { + s = "m" + } + if x < 0 { + x = -x + } + if y < 0 { + y = -y + } + return fmt.Sprintf("\x1b[<%d;%d;%d%s", b, x+1, y+1, s) +} diff --git a/vendor/github.com/charmbracelet/x/ansi/osc.go b/vendor/github.com/charmbracelet/x/ansi/osc.go index 40b543c294..25adff10b8 100644 --- a/vendor/github.com/charmbracelet/x/ansi/osc.go +++ b/vendor/github.com/charmbracelet/x/ansi/osc.go @@ -27,23 +27,24 @@ type OscSequence struct { var _ Sequence = OscSequence{} -// Command returns the command of the OSC sequence. -func (s OscSequence) Command() int { - return s.Cmd +// Clone returns a deep copy of the OSC sequence. +func (o OscSequence) Clone() Sequence { + return OscSequence{ + Data: append([]byte(nil), o.Data...), + Cmd: o.Cmd, + } } -// Params returns the parameters of the OSC sequence split by ';'. -// The first element is the identifier command. -func (s OscSequence) Params() []string { - return strings.Split(string(s.Data), ";") +// Split returns a slice of data split by the semicolon with the first element +// being the identifier command. +func (o OscSequence) Split() []string { + return strings.Split(string(o.Data), ";") } -// Clone returns a copy of the OSC sequence. -func (s OscSequence) Clone() Sequence { - return OscSequence{ - Data: append([]byte(nil), s.Data...), - Cmd: s.Cmd, - } +// Command returns the OSC command. This is always gonna be a positive integer +// that identifies the OSC sequence. +func (o OscSequence) Command() int { + return o.Cmd } // String returns the string representation of the OSC sequence. diff --git a/vendor/github.com/charmbracelet/x/ansi/parser.go b/vendor/github.com/charmbracelet/x/ansi/parser.go index e1a09df70f..618900cc79 100644 --- a/vendor/github.com/charmbracelet/x/ansi/parser.go +++ b/vendor/github.com/charmbracelet/x/ansi/parser.go @@ -20,130 +20,200 @@ type ParserDispatcher func(Sequence) // //go:generate go run ./gen.go type Parser struct { - // Params contains the raw parameters of the sequence. + // the dispatch function to call when a sequence is complete + dispatcher ParserDispatcher + + // params contains the raw parameters of the sequence. // These parameters used when constructing CSI and DCS sequences. - Params []int + params []int - // Data contains the raw data of the sequence. + // data contains the raw data of the sequence. // These data used when constructing OSC, DCS, SOS, PM, and APC sequences. - Data []byte + data []byte - // DataLen keeps track of the length of the data buffer. - // If DataLen is -1, the data buffer is unlimited and will grow as needed. - // Otherwise, DataLen is limited by the size of the Data buffer. - DataLen int + // dataLen keeps track of the length of the data buffer. + // If dataLen is -1, the data buffer is unlimited and will grow as needed. + // Otherwise, dataLen is limited by the size of the data buffer. + dataLen int - // ParamsLen keeps track of the number of parameters. - // This is limited by the size of the Params buffer. + // paramsLen keeps track of the number of parameters. + // This is limited by the size of the params buffer. // // This is also used when collecting UTF-8 runes to keep track of the // number of rune bytes collected. - ParamsLen int + paramsLen int - // Cmd contains the raw command along with the private marker and + // cmd contains the raw command along with the private marker and // intermediate bytes of the sequence. // The first lower byte contains the command byte, the next byte contains // the private marker, and the next byte contains the intermediate byte. // // This is also used when collecting UTF-8 runes treating it as a slice of // 4 bytes. - Cmd int + cmd int + + // state is the current state of the parser. + state byte +} + +// NewParser returns a new parser with an optional [ParserDispatcher]. +// The [Parser] uses a default size of 32 for the parameters and 64KB for the +// data buffer. Use [Parser.SetParamsSize] and [Parser.SetDataSize] to set the +// size of the parameters and data buffer respectively. +func NewParser(d ParserDispatcher) *Parser { + p := new(Parser) + p.SetDispatcher(d) + p.SetParamsSize(parser.MaxParamsSize) + p.SetDataSize(1024 * 64) // 64KB data buffer + return p +} - // State is the current state of the parser. - State byte +// SetDispatcher sets the dispatcher function to call when a sequence is +// complete. +func (p *Parser) SetDispatcher(d ParserDispatcher) { + p.dispatcher = d } -// NewParser returns a new parser with the given sizes allocated. -// If dataSize is zero, the underlying data buffer will be unlimited and will +// SetParamsSize sets the size of the parameters buffer. +// This is used when constructing CSI and DCS sequences. +func (p *Parser) SetParamsSize(size int) { + p.params = make([]int, size) +} + +// SetDataSize sets the size of the data buffer. +// This is used when constructing OSC, DCS, SOS, PM, and APC sequences. +// If size is less than or equal to 0, the data buffer is unlimited and will // grow as needed. -func NewParser(paramsSize, dataSize int) *Parser { - s := new(Parser) - if dataSize <= 0 { - dataSize = 0 - s.DataLen = -1 +func (p *Parser) SetDataSize(size int) { + if size <= 0 { + size = 0 + p.dataLen = -1 } - s.Params = make([]int, paramsSize) - s.Data = make([]byte, dataSize) - return s + p.data = make([]byte, size) +} + +// Params returns the list of parsed packed parameters. +func (p *Parser) Params() []Parameter { + return unsafe.Slice((*Parameter)(unsafe.Pointer(&p.params[0])), p.paramsLen) +} + +// Param returns the parameter at the given index and falls back to the default +// value if the parameter is missing. If the index is out of bounds, it returns +// the default value and false. +func (p *Parser) Param(i, def int) (int, bool) { + if i < 0 || i >= p.paramsLen { + return def, false + } + return Parameter(p.params[i]).Param(def), true +} + +// Cmd returns the packed command of the last dispatched sequence. +func (p *Parser) Cmd() Command { + return Command(p.cmd) +} + +// Rune returns the last dispatched sequence as a rune. +func (p *Parser) Rune() rune { + rw := utf8ByteLen(byte(p.cmd & 0xff)) + if rw == -1 { + return utf8.RuneError + } + r, _ := utf8.DecodeRune((*[utf8.UTFMax]byte)(unsafe.Pointer(&p.cmd))[:rw]) + return r +} + +// Data returns the raw data of the last dispatched sequence. +func (p *Parser) Data() []byte { + return p.data[:p.dataLen] } // Reset resets the parser to its initial state. func (p *Parser) Reset() { p.clear() - p.State = parser.GroundState + p.state = parser.GroundState } // clear clears the parser parameters and command. func (p *Parser) clear() { - if len(p.Params) > 0 { - p.Params[0] = parser.MissingParam + if len(p.params) > 0 { + p.params[0] = parser.MissingParam } - p.ParamsLen = 0 - p.Cmd = 0 + p.paramsLen = 0 + p.cmd = 0 +} + +// State returns the current state of the parser. +func (p *Parser) State() parser.State { + return p.state } // StateName returns the name of the current state. func (p *Parser) StateName() string { - return parser.StateNames[p.State] + return parser.StateNames[p.state] } // Parse parses the given dispatcher and byte buffer. -func (p *Parser) Parse(dispatcher ParserDispatcher, b []byte) { +// Deprecated: Loop over the buffer and call [Parser.Advance] instead. +func (p *Parser) Parse(b []byte) { for i := 0; i < len(b); i++ { - p.Advance(dispatcher, b[i], i < len(b)-1) + p.Advance(b[i]) } } -// Advance advances the parser with the given dispatcher and byte. -func (p *Parser) Advance(dispatcher ParserDispatcher, b byte, more bool) parser.Action { - switch p.State { +// Advance advances the parser using the given byte. It returns the action +// performed by the parser. +func (p *Parser) Advance(b byte) parser.Action { + switch p.state { case parser.Utf8State: // We handle UTF-8 here. - return p.advanceUtf8(dispatcher, b) + return p.advanceUtf8(b) default: - return p.advance(dispatcher, b, more) + return p.advance(b) } } func (p *Parser) collectRune(b byte) { - if p.ParamsLen >= utf8.UTFMax { + if p.paramsLen >= utf8.UTFMax { return } - shift := p.ParamsLen * 8 - p.Cmd &^= 0xff << shift - p.Cmd |= int(b) << shift - p.ParamsLen++ + shift := p.paramsLen * 8 + p.cmd &^= 0xff << shift + p.cmd |= int(b) << shift + p.paramsLen++ +} + +func (p *Parser) dispatch(s Sequence) { + if p.dispatcher != nil { + p.dispatcher(s) + } } -func (p *Parser) advanceUtf8(dispatcher ParserDispatcher, b byte) parser.Action { +func (p *Parser) advanceUtf8(b byte) parser.Action { // Collect UTF-8 rune bytes. p.collectRune(b) - rw := utf8ByteLen(byte(p.Cmd & 0xff)) + rw := utf8ByteLen(byte(p.cmd & 0xff)) if rw == -1 { // We panic here because the first byte comes from the state machine, // if this panics, it means there is a bug in the state machine! panic("invalid rune") // unreachable } - if p.ParamsLen < rw { + if p.paramsLen < rw { return parser.CollectAction } // We have enough bytes to decode the rune using unsafe - r, _ := utf8.DecodeRune((*[utf8.UTFMax]byte)(unsafe.Pointer(&p.Cmd))[:rw]) - if dispatcher != nil { - dispatcher(Rune(r)) - } + p.dispatch(Rune(p.Rune())) - p.State = parser.GroundState - p.ParamsLen = 0 + p.state = parser.GroundState + p.paramsLen = 0 return parser.PrintAction } -func (p *Parser) advance(d ParserDispatcher, b byte, more bool) parser.Action { - state, action := parser.Table.Transition(p.State, b) +func (p *Parser) advance(b byte) parser.Action { + state, action := parser.Table.Transition(p.state, b) // We need to clear the parser state if the state changes from EscapeState. // This is because when we enter the EscapeState, we don't get a chance to @@ -151,59 +221,53 @@ func (p *Parser) advance(d ParserDispatcher, b byte, more bool) parser.Action { // ST (\x1b\\ or \x9c), we dispatch the current sequence and transition to // EscapeState. However, the parser state is not cleared in this case and // we need to clear it here before dispatching the esc sequence. - if p.State != state { - if p.State == parser.EscapeState { - p.performAction(d, parser.ClearAction, state, b) + if p.state != state { + if p.state == parser.EscapeState { + p.performAction(parser.ClearAction, state, b) } if action == parser.PutAction && - p.State == parser.DcsEntryState && state == parser.DcsStringState { + p.state == parser.DcsEntryState && state == parser.DcsStringState { // XXX: This is a special case where we need to start collecting // non-string parameterized data i.e. doesn't follow the ECMA-48 § // 5.4.1 string parameters format. - p.performAction(d, parser.StartAction, state, 0) + p.performAction(parser.StartAction, state, 0) } } // Handle special cases switch { - case b == ESC && p.State == parser.EscapeState: + case b == ESC && p.state == parser.EscapeState: // Two ESCs in a row - p.performAction(d, parser.ExecuteAction, state, b) - if !more { - // Two ESCs at the end of the buffer - p.performAction(d, parser.ExecuteAction, state, b) - } - case b == ESC && !more: - // Last byte is an ESC - p.performAction(d, parser.ExecuteAction, state, b) - case p.State == parser.EscapeState && b == 'P' && !more: - // ESC P (DCS) at the end of the buffer - p.performAction(d, parser.DispatchAction, state, b) - case p.State == parser.EscapeState && b == 'X' && !more: - // ESC X (SOS) at the end of the buffer - p.performAction(d, parser.DispatchAction, state, b) - case p.State == parser.EscapeState && b == '[' && !more: - // ESC [ (CSI) at the end of the buffer - p.performAction(d, parser.DispatchAction, state, b) - case p.State == parser.EscapeState && b == ']' && !more: - // ESC ] (OSC) at the end of the buffer - p.performAction(d, parser.DispatchAction, state, b) - case p.State == parser.EscapeState && b == '^' && !more: - // ESC ^ (PM) at the end of the buffer - p.performAction(d, parser.DispatchAction, state, b) - case p.State == parser.EscapeState && b == '_' && !more: - // ESC _ (APC) at the end of the buffer - p.performAction(d, parser.DispatchAction, state, b) + p.performAction(parser.ExecuteAction, state, b) default: - p.performAction(d, action, state, b) + p.performAction(action, state, b) } - p.State = state + p.state = state return action } -func (p *Parser) performAction(dispatcher ParserDispatcher, action parser.Action, state parser.State, b byte) { +func (p *Parser) parseStringCmd() { + // Try to parse the command + datalen := len(p.data) + if p.dataLen >= 0 { + datalen = p.dataLen + } + for i := 0; i < datalen; i++ { + d := p.data[i] + if d < '0' || d > '9' { + break + } + if p.cmd == parser.MissingCommand { + p.cmd = 0 + } + p.cmd *= 10 + p.cmd += int(d - '0') + } +} + +func (p *Parser) performAction(action parser.Action, state parser.State, b byte) { switch action { case parser.IgnoreAction: break @@ -212,131 +276,117 @@ func (p *Parser) performAction(dispatcher ParserDispatcher, action parser.Action p.clear() case parser.PrintAction: - if dispatcher != nil { - dispatcher(Rune(b)) - } + p.dispatch(Rune(b)) case parser.ExecuteAction: - if dispatcher != nil { - dispatcher(ControlCode(b)) - } + p.dispatch(ControlCode(b)) case parser.MarkerAction: // Collect private marker // we only store the last marker - p.Cmd &^= 0xff << parser.MarkerShift - p.Cmd |= int(b) << parser.MarkerShift + p.cmd &^= 0xff << parser.MarkerShift + p.cmd |= int(b) << parser.MarkerShift case parser.CollectAction: if state == parser.Utf8State { // Reset the UTF-8 counter - p.ParamsLen = 0 + p.paramsLen = 0 p.collectRune(b) } else { // Collect intermediate bytes // we only store the last intermediate byte - p.Cmd &^= 0xff << parser.IntermedShift - p.Cmd |= int(b) << parser.IntermedShift + p.cmd &^= 0xff << parser.IntermedShift + p.cmd |= int(b) << parser.IntermedShift } case parser.ParamAction: // Collect parameters - if p.ParamsLen >= len(p.Params) { + if p.paramsLen >= len(p.params) { break } if b >= '0' && b <= '9' { - if p.Params[p.ParamsLen] == parser.MissingParam { - p.Params[p.ParamsLen] = 0 + if p.params[p.paramsLen] == parser.MissingParam { + p.params[p.paramsLen] = 0 } - p.Params[p.ParamsLen] *= 10 - p.Params[p.ParamsLen] += int(b - '0') + p.params[p.paramsLen] *= 10 + p.params[p.paramsLen] += int(b - '0') } if b == ':' { - p.Params[p.ParamsLen] |= parser.HasMoreFlag + p.params[p.paramsLen] |= parser.HasMoreFlag } if b == ';' || b == ':' { - p.ParamsLen++ - if p.ParamsLen < len(p.Params) { - p.Params[p.ParamsLen] = parser.MissingParam + p.paramsLen++ + if p.paramsLen < len(p.params) { + p.params[p.paramsLen] = parser.MissingParam } } case parser.StartAction: - if p.DataLen < 0 && p.Data != nil { - p.Data = p.Data[:0] + if p.dataLen < 0 && p.data != nil { + p.data = p.data[:0] } else { - p.DataLen = 0 + p.dataLen = 0 } - if p.State >= parser.DcsEntryState && p.State <= parser.DcsStringState { + if p.state >= parser.DcsEntryState && p.state <= parser.DcsStringState { // Collect the command byte for DCS - p.Cmd |= int(b) + p.cmd |= int(b) } else { - p.Cmd = parser.MissingCommand + p.cmd = parser.MissingCommand } case parser.PutAction: - switch p.State { + switch p.state { case parser.OscStringState: - if b == ';' && p.Cmd == parser.MissingCommand { - // Try to parse the command - datalen := len(p.Data) - if p.DataLen >= 0 { - datalen = p.DataLen - } - for i := 0; i < datalen; i++ { - d := p.Data[i] - if d < '0' || d > '9' { - break - } - if p.Cmd == parser.MissingCommand { - p.Cmd = 0 - } - p.Cmd *= 10 - p.Cmd += int(d - '0') - } + if b == ';' && p.cmd == parser.MissingCommand { + p.parseStringCmd() } } - if p.DataLen < 0 { - p.Data = append(p.Data, b) + if p.dataLen < 0 { + p.data = append(p.data, b) } else { - if p.DataLen < len(p.Data) { - p.Data[p.DataLen] = b - p.DataLen++ + if p.dataLen < len(p.data) { + p.data[p.dataLen] = b + p.dataLen++ } } case parser.DispatchAction: // Increment the last parameter - if p.ParamsLen > 0 && p.ParamsLen < len(p.Params)-1 || - p.ParamsLen == 0 && len(p.Params) > 0 && p.Params[0] != parser.MissingParam { - p.ParamsLen++ + if p.paramsLen > 0 && p.paramsLen < len(p.params)-1 || + p.paramsLen == 0 && len(p.params) > 0 && p.params[0] != parser.MissingParam { + p.paramsLen++ + } + + if p.state == parser.OscStringState && p.cmd == parser.MissingCommand { + // Ensure we have a command for OSC + p.parseStringCmd() } - if dispatcher == nil { + if p.dispatcher == nil { break } var seq Sequence - data := p.Data - if p.DataLen >= 0 { - data = data[:p.DataLen] + data := p.data + if p.dataLen >= 0 { + data = data[:p.dataLen] } - switch p.State { + switch p.state { case parser.CsiEntryState, parser.CsiParamState, parser.CsiIntermediateState: - p.Cmd |= int(b) - seq = CsiSequence{Cmd: p.Cmd, Params: p.Params[:p.ParamsLen]} + p.cmd |= int(b) + seq = CsiSequence{Cmd: Command(p.cmd), Params: p.Params()} case parser.EscapeState, parser.EscapeIntermediateState: - p.Cmd |= int(b) - seq = EscSequence(p.Cmd) + p.cmd |= int(b) + seq = EscSequence(p.cmd) case parser.DcsEntryState, parser.DcsParamState, parser.DcsIntermediateState, parser.DcsStringState: - seq = DcsSequence{Cmd: p.Cmd, Params: p.Params[:p.ParamsLen], Data: data} + seq = DcsSequence{Cmd: Command(p.cmd), Params: p.Params(), Data: data} case parser.OscStringState: - seq = OscSequence{Cmd: p.Cmd, Data: data} + seq = OscSequence{Cmd: p.cmd, Data: data} case parser.SosStringState: seq = SosSequence{Data: data} case parser.PmStringState: @@ -345,7 +395,7 @@ func (p *Parser) performAction(dispatcher ParserDispatcher, action parser.Action seq = ApcSequence{Data: data} } - dispatcher(seq) + p.dispatch(seq) } } diff --git a/vendor/github.com/charmbracelet/x/ansi/parser_decode.go b/vendor/github.com/charmbracelet/x/ansi/parser_decode.go index 0ed802cbcf..8bc2c2539a 100644 --- a/vendor/github.com/charmbracelet/x/ansi/parser_decode.go +++ b/vendor/github.com/charmbracelet/x/ansi/parser_decode.go @@ -1,8 +1,6 @@ package ansi import ( - "bytes" - "strings" "unicode/utf8" "github.com/charmbracelet/x/ansi/parser" @@ -37,23 +35,23 @@ const ( // collect sequence parameters, data, and commands. The parser cmd will have // the packed command value that contains intermediate and marker characters. // In the case of a OSC sequence, the cmd will be the OSC command number. Use -// [Cmd] and [Param] types to unpack command intermediates and markers as well +// [Command] and [Parameter] types to unpack command intermediates and markers as well // as parameters. // -// Zero [Cmd] means the CSI, DCS, or ESC sequence is invalid. Moreover, checking the +// Zero [Command] means the CSI, DCS, or ESC sequence is invalid. Moreover, checking the // validity of other data sequences, OSC, DCS, etc, will require checking for // the returned sequence terminator bytes such as ST (ESC \\) and BEL). // -// We store the command byte in [Cmd] in the most significant byte, the +// We store the command byte in [Command] in the most significant byte, the // marker byte in the next byte, and the intermediate byte in the least // significant byte. This is done to avoid using a struct to store the command // and its intermediates and markers. The command byte is always the least -// significant byte i.e. [Cmd & 0xff]. Use the [Cmd] type to unpack the +// significant byte i.e. [Cmd & 0xff]. Use the [Command] type to unpack the // command, intermediate, and marker bytes. Note that we only collect the last // marker character and intermediate byte. // // The [p.Params] slice will contain the parameters of the sequence. Any -// sub-parameter will have the [parser.HasMoreFlag] set. Use the [Param] type +// sub-parameter will have the [parser.HasMoreFlag] set. Use the [Parameter] type // to unpack the parameters. // // Example: @@ -76,39 +74,39 @@ func DecodeSequence[T string | []byte](b T, state byte, p *Parser) (seq T, width switch c { case ESC: if p != nil { - if len(p.Params) > 0 { - p.Params[0] = parser.MissingParam + if len(p.params) > 0 { + p.params[0] = parser.MissingParam } - p.Cmd = 0 - p.ParamsLen = 0 - p.DataLen = 0 + p.cmd = 0 + p.paramsLen = 0 + p.dataLen = 0 } state = EscapeState continue case CSI, DCS: if p != nil { - if len(p.Params) > 0 { - p.Params[0] = parser.MissingParam + if len(p.params) > 0 { + p.params[0] = parser.MissingParam } - p.Cmd = 0 - p.ParamsLen = 0 - p.DataLen = 0 + p.cmd = 0 + p.paramsLen = 0 + p.dataLen = 0 } state = MarkerState continue case OSC, APC, SOS, PM: if p != nil { - p.Cmd = parser.MissingCommand - p.DataLen = 0 + p.cmd = parser.MissingCommand + p.dataLen = 0 } state = StringState continue } if p != nil { - p.DataLen = 0 - p.ParamsLen = 0 - p.Cmd = 0 + p.dataLen = 0 + p.paramsLen = 0 + p.cmd = 0 } if c > US && c < DEL { // ASCII printable characters @@ -132,8 +130,8 @@ func DecodeSequence[T string | []byte](b T, state byte, p *Parser) (seq T, width if c >= '<' && c <= '?' { if p != nil { // We only collect the last marker character. - p.Cmd &^= 0xff << parser.MarkerShift - p.Cmd |= int(c) << parser.MarkerShift + p.cmd &^= 0xff << parser.MarkerShift + p.cmd |= int(c) << parser.MarkerShift } break } @@ -143,27 +141,27 @@ func DecodeSequence[T string | []byte](b T, state byte, p *Parser) (seq T, width case ParamsState: if c >= '0' && c <= '9' { if p != nil { - if p.Params[p.ParamsLen] == parser.MissingParam { - p.Params[p.ParamsLen] = 0 + if p.params[p.paramsLen] == parser.MissingParam { + p.params[p.paramsLen] = 0 } - p.Params[p.ParamsLen] *= 10 - p.Params[p.ParamsLen] += int(c - '0') + p.params[p.paramsLen] *= 10 + p.params[p.paramsLen] += int(c - '0') } break } if c == ':' { if p != nil { - p.Params[p.ParamsLen] |= parser.HasMoreFlag + p.params[p.paramsLen] |= parser.HasMoreFlag } } if c == ';' || c == ':' { if p != nil { - p.ParamsLen++ - if p.ParamsLen < len(p.Params) { - p.Params[p.ParamsLen] = parser.MissingParam + p.paramsLen++ + if p.paramsLen < len(p.params) { + p.params[p.paramsLen] = parser.MissingParam } } break @@ -174,35 +172,36 @@ func DecodeSequence[T string | []byte](b T, state byte, p *Parser) (seq T, width case IntermedState: if c >= ' ' && c <= '/' { if p != nil { - p.Cmd &^= 0xff << parser.IntermedShift - p.Cmd |= int(c) << parser.IntermedShift + p.cmd &^= 0xff << parser.IntermedShift + p.cmd |= int(c) << parser.IntermedShift } break } - state = NormalState + if p != nil { + // Increment the last parameter + if p.paramsLen > 0 && p.paramsLen < len(p.params)-1 || + p.paramsLen == 0 && len(p.params) > 0 && p.params[0] != parser.MissingParam { + p.paramsLen++ + } + } + if c >= '@' && c <= '~' { if p != nil { - // Increment the last parameter - if p.ParamsLen > 0 && p.ParamsLen < len(p.Params)-1 || - p.ParamsLen == 0 && len(p.Params) > 0 && p.Params[0] != parser.MissingParam { - p.ParamsLen++ - } - - p.Cmd &^= 0xff - p.Cmd |= int(c) + p.cmd &^= 0xff + p.cmd |= int(c) } if HasDcsPrefix(b) { // Continue to collect DCS data if p != nil { - p.DataLen = 0 + p.dataLen = 0 } state = StringState continue } - return b[:i+1], 0, i + 1, state + return b[:i+1], 0, i + 1, NormalState } // Invalid CSI/DCS sequence @@ -211,18 +210,18 @@ func DecodeSequence[T string | []byte](b T, state byte, p *Parser) (seq T, width switch c { case '[', 'P': if p != nil { - if len(p.Params) > 0 { - p.Params[0] = parser.MissingParam + if len(p.params) > 0 { + p.params[0] = parser.MissingParam } - p.ParamsLen = 0 - p.Cmd = 0 + p.paramsLen = 0 + p.cmd = 0 } state = MarkerState continue case ']', 'X', '^', '_': if p != nil { - p.Cmd = parser.MissingCommand - p.DataLen = 0 + p.cmd = parser.MissingCommand + p.dataLen = 0 } state = StringState continue @@ -230,14 +229,14 @@ func DecodeSequence[T string | []byte](b T, state byte, p *Parser) (seq T, width if c >= ' ' && c <= '/' { if p != nil { - p.Cmd &^= 0xff << parser.IntermedShift - p.Cmd |= int(c) << parser.IntermedShift + p.cmd &^= 0xff << parser.IntermedShift + p.cmd |= int(c) << parser.IntermedShift } continue } else if c >= '0' && c <= '~' { if p != nil { - p.Cmd &^= 0xff - p.Cmd |= int(c) + p.cmd &^= 0xff + p.cmd |= int(c) } return b[:i+1], 0, i + 1, NormalState } @@ -281,9 +280,9 @@ func DecodeSequence[T string | []byte](b T, state byte, p *Parser) (seq T, width return b[:i], 0, i, NormalState } - if p != nil && p.DataLen < len(p.Data) { - p.Data[p.DataLen] = c - p.DataLen++ + if p != nil && p.dataLen < len(p.data) { + p.data[p.dataLen] = c + p.dataLen++ // Parse the OSC command number if c == ';' && HasOscPrefix(b) { @@ -297,34 +296,22 @@ func DecodeSequence[T string | []byte](b T, state byte, p *Parser) (seq T, width } func parseOscCmd(p *Parser) { - if p == nil || p.Cmd != parser.MissingCommand { + if p == nil || p.cmd != parser.MissingCommand { return } - for j := 0; j < p.DataLen; j++ { - d := p.Data[j] + for j := 0; j < p.dataLen; j++ { + d := p.data[j] if d < '0' || d > '9' { break } - if p.Cmd == parser.MissingCommand { - p.Cmd = 0 + if p.cmd == parser.MissingCommand { + p.cmd = 0 } - p.Cmd *= 10 - p.Cmd += int(d - '0') + p.cmd *= 10 + p.cmd += int(d - '0') } } -// Index returns the index of the first occurrence of the given byte slice in -// the data. It returns -1 if the byte slice is not found. -func Index[T string | []byte](data, b T) int { - switch data := any(data).(type) { - case string: - return strings.Index(data, string(b)) - case []byte: - return bytes.Index(data, []byte(b)) - } - panic("unreachable") -} - // Equal returns true if the given byte slices are equal. func Equal[T string | []byte](a, b T) bool { return string(a) == string(b) @@ -402,49 +389,73 @@ func FirstGraphemeCluster[T string | []byte](b T, state int) (T, T, int, int) { panic("unreachable") } -// Cmd represents a sequence command. This is used to pack/unpack a sequence +// Command represents a sequence command. This is used to pack/unpack a sequence // command with its intermediate and marker characters. Those are commonly // found in CSI and DCS sequences. -type Cmd int +type Command int -// Marker returns the marker byte of the CSI sequence. +// Marker returns the unpacked marker byte of the CSI sequence. // This is always gonna be one of the following '<' '=' '>' '?' and in the // range of 0x3C-0x3F. // Zero is returned if the sequence does not have a marker. -func (c Cmd) Marker() int { +func (c Command) Marker() int { return parser.Marker(int(c)) } -// Intermediate returns the intermediate byte of the CSI sequence. +// Intermediate returns the unpacked intermediate byte of the CSI sequence. // An intermediate byte is in the range of 0x20-0x2F. This includes these // characters from ' ', '!', '"', '#', '$', '%', '&', ”', '(', ')', '*', '+', // ',', '-', '.', '/'. // Zero is returned if the sequence does not have an intermediate byte. -func (c Cmd) Intermediate() int { +func (c Command) Intermediate() int { return parser.Intermediate(int(c)) } -// Command returns the command byte of the CSI sequence. -func (c Cmd) Command() int { +// Command returns the unpacked command byte of the CSI sequence. +func (c Command) Command() int { return parser.Command(int(c)) } -// Param represents a sequence parameter. Sequence parameters with +// Cmd returns a packed [Command] with the given command, marker, and +// intermediate. +// The first byte is the command, the next shift is the marker, and the next +// shift is the intermediate. +// +// Even though this function takes integers, it only uses the lower 8 bits of +// each integer. +func Cmd(marker, inter, cmd int) (c Command) { + c = Command(cmd & parser.CommandMask) + c |= Command(marker&parser.CommandMask) << parser.MarkerShift + c |= Command(inter&parser.CommandMask) << parser.IntermedShift + return +} + +// Parameter represents a sequence parameter. Sequence parameters with // sub-parameters are packed with the HasMoreFlag set. This is used to unpack // the parameters from a CSI and DCS sequences. -type Param int +type Parameter int -// Param returns the parameter at the given index. -// It returns -1 if the parameter does not exist. -func (s Param) Param() int { +// Param returns the unpacked parameter at the given index. +// It returns the default value if the parameter is missing. +func (s Parameter) Param(def int) int { p := int(s) & parser.ParamMask if p == parser.MissingParam { - return -1 + return def } return p } -// HasMore returns true if the parameter has more sub-parameters. -func (s Param) HasMore() bool { - return int(s)&parser.HasMoreFlag != 0 +// HasMore unpacks the HasMoreFlag from the parameter. +func (s Parameter) HasMore() bool { + return s&parser.HasMoreFlag != 0 +} + +// Param returns a packed [Parameter] with the given parameter and whether this +// parameter has following sub-parameters. +func Param(p int, hasMore bool) (s Parameter) { + s = Parameter(p & parser.ParamMask) + if hasMore { + s |= Parameter(parser.HasMoreFlag) + } + return } diff --git a/vendor/github.com/charmbracelet/x/ansi/parser_sync.go b/vendor/github.com/charmbracelet/x/ansi/parser_sync.go index c6f24d3554..5768a97983 100644 --- a/vendor/github.com/charmbracelet/x/ansi/parser_sync.go +++ b/vendor/github.com/charmbracelet/x/ansi/parser_sync.go @@ -8,7 +8,10 @@ import ( var parserPool = sync.Pool{ New: func() any { - return NewParser(parser.MaxParamsSize, 1024*1024*4) // 4MB of data buffer + p := NewParser(nil) + p.SetParamsSize(parser.MaxParamsSize) + p.SetDataSize(1024 * 1024 * 4) // 4MB of data buffer + return p }, } @@ -21,6 +24,6 @@ func GetParser() *Parser { // automatically. func PutParser(p *Parser) { p.Reset() - p.DataLen = 0 + p.dataLen = 0 parserPool.Put(p) } diff --git a/vendor/github.com/charmbracelet/x/ansi/paste.go b/vendor/github.com/charmbracelet/x/ansi/paste.go new file mode 100644 index 0000000000..2f9ea6f79e --- /dev/null +++ b/vendor/github.com/charmbracelet/x/ansi/paste.go @@ -0,0 +1,7 @@ +package ansi + +// BracketedPasteStart is the control sequence to enable bracketed paste mode. +const BracketedPasteStart = "\x1b[200~" + +// BracketedPasteEnd is the control sequence to disable bracketed paste mode. +const BracketedPasteEnd = "\x1b[201~" diff --git a/vendor/github.com/charmbracelet/x/ansi/reset.go b/vendor/github.com/charmbracelet/x/ansi/reset.go new file mode 100644 index 0000000000..c1b89ea493 --- /dev/null +++ b/vendor/github.com/charmbracelet/x/ansi/reset.go @@ -0,0 +1,11 @@ +package ansi + +// ResetInitialState (RIS) resets the terminal to its initial state. +// +// ESC c +// +// See: https://vt100.net/docs/vt510-rm/RIS.html +const ( + ResetInitialState = "\x1bc" + RIS = ResetInitialState +) diff --git a/vendor/github.com/charmbracelet/x/ansi/screen.go b/vendor/github.com/charmbracelet/x/ansi/screen.go index a37eed7a3f..ab726efe6e 100644 --- a/vendor/github.com/charmbracelet/x/ansi/screen.go +++ b/vendor/github.com/charmbracelet/x/ansi/screen.go @@ -1,11 +1,16 @@ package ansi -import "strconv" +import ( + "strconv" + "strings" +) // EraseDisplay (ED) clears the display or parts of the display. A screen is // the shown part of the terminal display excluding the scrollback buffer. // Possible values: // +// Default is 0. +// // 0: Clear from cursor to end of screen. // 1: Clear from cursor to beginning of the screen. // 2: Clear entire screen (and moves cursor to upper left on DOS). @@ -15,16 +20,22 @@ import "strconv" // // See: https://vt100.net/docs/vt510-rm/ED.html func EraseDisplay(n int) string { - if n < 0 { - n = 0 + var s string + if n > 0 { + s = strconv.Itoa(n) } - return "\x1b[" + strconv.Itoa(n) + "J" + return "\x1b[" + s + "J" +} + +// ED is an alias for [EraseDisplay]. +func ED(n int) string { + return EraseDisplay(n) } // EraseDisplay constants. // These are the possible values for the EraseDisplay function. const ( - EraseScreenBelow = "\x1b[0J" + EraseScreenBelow = "\x1b[J" EraseScreenAbove = "\x1b[1J" EraseEntireScreen = "\x1b[2J" EraseEntireDisplay = "\x1b[3J" @@ -42,16 +53,22 @@ const ( // // See: https://vt100.net/docs/vt510-rm/EL.html func EraseLine(n int) string { - if n < 0 { - n = 0 + var s string + if n > 0 { + s = strconv.Itoa(n) } - return "\x1b[" + strconv.Itoa(n) + "K" + return "\x1b[" + s + "K" +} + +// EL is an alias for [EraseLine]. +func EL(n int) string { + return EraseLine(n) } // EraseLine constants. // These are the possible values for the EraseLine function. const ( - EraseLineRight = "\x1b[0K" + EraseLineRight = "\x1b[K" EraseLineLeft = "\x1b[1K" EraseEntireLine = "\x1b[2K" ) @@ -59,7 +76,7 @@ const ( // ScrollUp (SU) scrolls the screen up n lines. New lines are added at the // bottom of the screen. // -// CSI S +// CSI Pn S // // See: https://vt100.net/docs/vt510-rm/SU.html func ScrollUp(n int) string { @@ -70,10 +87,20 @@ func ScrollUp(n int) string { return "\x1b[" + s + "S" } +// PanDown is an alias for [ScrollUp]. +func PanDown(n int) string { + return ScrollUp(n) +} + +// SU is an alias for [ScrollUp]. +func SU(n int) string { + return ScrollUp(n) +} + // ScrollDown (SD) scrolls the screen down n lines. New lines are added at the // top of the screen. // -// CSI T +// CSI Pn T // // See: https://vt100.net/docs/vt510-rm/SD.html func ScrollDown(n int) string { @@ -84,10 +111,20 @@ func ScrollDown(n int) string { return "\x1b[" + s + "T" } +// PanUp is an alias for [ScrollDown]. +func PanUp(n int) string { + return ScrollDown(n) +} + +// SD is an alias for [ScrollDown]. +func SD(n int) string { + return ScrollDown(n) +} + // InsertLine (IL) inserts n blank lines at the current cursor position. // Existing lines are moved down. // -// CSI L +// CSI Pn L // // See: https://vt100.net/docs/vt510-rm/IL.html func InsertLine(n int) string { @@ -98,10 +135,15 @@ func InsertLine(n int) string { return "\x1b[" + s + "L" } +// IL is an alias for [InsertLine]. +func IL(n int) string { + return InsertLine(n) +} + // DeleteLine (DL) deletes n lines at the current cursor position. Existing // lines are moved up. // -// CSI M +// CSI Pn M // // See: https://vt100.net/docs/vt510-rm/DL.html func DeleteLine(n int) string { @@ -112,12 +154,66 @@ func DeleteLine(n int) string { return "\x1b[" + s + "M" } +// DL is an alias for [DeleteLine]. +func DL(n int) string { + return DeleteLine(n) +} + +// SetTopBottomMargins (DECSTBM) sets the top and bottom margins for the scrolling +// region. The default is the entire screen. +// +// Default is 1 and the bottom of the screen. +// +// CSI Pt ; Pb r +// +// See: https://vt100.net/docs/vt510-rm/DECSTBM.html +func SetTopBottomMargins(top, bot int) string { + var t, b string + if top > 0 { + t = strconv.Itoa(top) + } + if bot > 0 { + b = strconv.Itoa(bot) + } + return "\x1b[" + t + ";" + b + "r" +} + +// DECSTBM is an alias for [SetTopBottomMargins]. +func DECSTBM(top, bot int) string { + return SetTopBottomMargins(top, bot) +} + +// SetLeftRightMargins (DECSLRM) sets the left and right margins for the scrolling +// region. +// +// Default is 1 and the right of the screen. +// +// CSI Pl ; Pr s +// +// See: https://vt100.net/docs/vt510-rm/DECSLRM.html +func SetLeftRightMargins(left, right int) string { + var l, r string + if left > 0 { + l = strconv.Itoa(left) + } + if right > 0 { + r = strconv.Itoa(right) + } + return "\x1b[" + l + ";" + r + "s" +} + +// DECSLRM is an alias for [SetLeftRightMargins]. +func DECSLRM(left, right int) string { + return SetLeftRightMargins(left, right) +} + // SetScrollingRegion (DECSTBM) sets the top and bottom margins for the scrolling // region. The default is the entire screen. // // CSI ; r // // See: https://vt100.net/docs/vt510-rm/DECSTBM.html +// Deprecated: use [SetTopBottomMargins] instead. func SetScrollingRegion(t, b int) string { if t < 0 { t = 0 @@ -127,3 +223,187 @@ func SetScrollingRegion(t, b int) string { } return "\x1b[" + strconv.Itoa(t) + ";" + strconv.Itoa(b) + "r" } + +// InsertCharacter (ICH) inserts n blank characters at the current cursor +// position. Existing characters move to the right. Characters moved past the +// right margin are lost. ICH has no effect outside the scrolling margins. +// +// Default is 1. +// +// CSI Pn @ +// +// See: https://vt100.net/docs/vt510-rm/ICH.html +func InsertCharacter(n int) string { + var s string + if n > 1 { + s = strconv.Itoa(n) + } + return "\x1b[" + s + "@" +} + +// ICH is an alias for [InsertCharacter]. +func ICH(n int) string { + return InsertCharacter(n) +} + +// DeleteCharacter (DCH) deletes n characters at the current cursor position. +// As the characters are deleted, the remaining characters move to the left and +// the cursor remains at the same position. +// +// Default is 1. +// +// CSI Pn P +// +// See: https://vt100.net/docs/vt510-rm/DCH.html +func DeleteCharacter(n int) string { + var s string + if n > 1 { + s = strconv.Itoa(n) + } + return "\x1b[" + s + "P" +} + +// DCH is an alias for [DeleteCharacter]. +func DCH(n int) string { + return DeleteCharacter(n) +} + +// SetTabEvery8Columns (DECST8C) sets the tab stops at every 8 columns. +// +// CSI ? 5 W +// +// See: https://vt100.net/docs/vt510-rm/DECST8C.html +const ( + SetTabEvery8Columns = "\x1b[?5W" + DECST8C = SetTabEvery8Columns +) + +// HorizontalTabSet (HTS) sets a horizontal tab stop at the current cursor +// column. +// +// This is equivalent to [HTS]. +// +// ESC H +// +// See: https://vt100.net/docs/vt510-rm/HTS.html +const HorizontalTabSet = "\x1bH" + +// TabClear (TBC) clears tab stops. +// +// Default is 0. +// +// Possible values: +// 0: Clear tab stop at the current column. (default) +// 3: Clear all tab stops. +// +// CSI Pn g +// +// See: https://vt100.net/docs/vt510-rm/TBC.html +func TabClear(n int) string { + var s string + if n > 0 { + s = strconv.Itoa(n) + } + return "\x1b[" + s + "g" +} + +// TBC is an alias for [TabClear]. +func TBC(n int) string { + return TabClear(n) +} + +// RequestPresentationStateReport (DECRQPSR) requests the terminal to send a +// report of the presentation state. This includes the cursor information [DECCIR], +// and tab stop [DECTABSR] reports. +// +// Default is 0. +// +// Possible values: +// 0: Error, request ignored. +// 1: Cursor information report [DECCIR]. +// 2: Tab stop report [DECTABSR]. +// +// CSI Ps $ w +// +// See: https://vt100.net/docs/vt510-rm/DECRQPSR.html +func RequestPresentationStateReport(n int) string { + var s string + if n > 0 { + s = strconv.Itoa(n) + } + return "\x1b[" + s + "$w" +} + +// DECRQPSR is an alias for [RequestPresentationStateReport]. +func DECRQPSR(n int) string { + return RequestPresentationStateReport(n) +} + +// TabStopReport (DECTABSR) is the response to a tab stop report request. +// It reports the tab stops set in the terminal. +// +// The response is a list of tab stops separated by a slash (/) character. +// +// DCS 2 $ u D ... D ST +// +// Where D is a decimal number representing a tab stop. +// +// See: https://vt100.net/docs/vt510-rm/DECTABSR.html +func TabStopReport(stops ...int) string { + var s []string + for _, v := range stops { + s = append(s, strconv.Itoa(v)) + } + return "\x1bP2$u" + strings.Join(s, "/") + "\x1b\\" +} + +// DECTABSR is an alias for [TabStopReport]. +func DECTABSR(stops ...int) string { + return TabStopReport(stops...) +} + +// CursorInformationReport (DECCIR) is the response to a cursor information +// report request. It reports the cursor position, visual attributes, and +// character protection attributes. It also reports the status of origin mode +// [DECOM] and the current active character set. +// +// The response is a list of values separated by a semicolon (;) character. +// +// DCS 1 $ u D ... D ST +// +// Where D is a decimal number representing a value. +// +// See: https://vt100.net/docs/vt510-rm/DECCIR.html +func CursorInformationReport(values ...int) string { + var s []string + for _, v := range values { + s = append(s, strconv.Itoa(v)) + } + return "\x1bP1$u" + strings.Join(s, ";") + "\x1b\\" +} + +// DECCIR is an alias for [CursorInformationReport]. +func DECCIR(values ...int) string { + return CursorInformationReport(values...) +} + +// RepeatPreviousCharacter (REP) repeats the previous character n times. +// This is identical to typing the same character n times. +// +// Default is 1. +// +// CSI Pn b +// +// See: ECMA-48 § 8.3.103 +func RepeatPreviousCharacter(n int) string { + var s string + if n > 1 { + s = strconv.Itoa(n) + } + return "\x1b[" + s + "b" +} + +// REP is an alias for [RepeatPreviousCharacter]. +func REP(n int) string { + return RepeatPreviousCharacter(n) +} diff --git a/vendor/github.com/charmbracelet/x/ansi/sequence.go b/vendor/github.com/charmbracelet/x/ansi/sequence.go index f294a229a3..4e974d1e69 100644 --- a/vendor/github.com/charmbracelet/x/ansi/sequence.go +++ b/vendor/github.com/charmbracelet/x/ansi/sequence.go @@ -8,12 +8,19 @@ import ( // Sequence represents an ANSI sequence. This can be a control sequence, escape // sequence, a printable character, etc. +// A Sequence can be one of the following types: +// - [Rune] +// - [ControlCode] +// - [Grapheme] +// - [EscSequence] +// - [CsiSequence] +// - [OscSequence] +// - [DcsSequence] +// - [SosSequence] +// - [PmSequence] +// - [ApcSequence] type Sequence interface { - // String returns the string representation of the sequence. - String() string - // Bytes returns the byte representation of the sequence. - Bytes() []byte - // Clone returns a copy of the sequence. + // Clone returns a deep copy of the sequence. Clone() Sequence } @@ -22,19 +29,22 @@ type Rune rune var _ Sequence = Rune(0) -// Bytes implements Sequence. -func (r Rune) Bytes() []byte { - return []byte(string(r)) +// Clone returns a deep copy of the rune. +func (r Rune) Clone() Sequence { + return r } -// String implements Sequence. -func (r Rune) String() string { - return string(r) +// Grapheme represents a grapheme cluster. +type Grapheme struct { + Cluster string + Width int } -// Clone implements Sequence. -func (r Rune) Clone() Sequence { - return r +var _ Sequence = Grapheme{} + +// Clone returns a deep copy of the grapheme. +func (g Grapheme) Clone() Sequence { + return g } // ControlCode represents a control code character. This is a character that @@ -54,13 +64,13 @@ func (c ControlCode) String() string { return string(c) } -// Clone implements Sequence. +// Clone returns a deep copy of the control code. func (c ControlCode) Clone() Sequence { return c } // EscSequence represents an escape sequence. -type EscSequence int +type EscSequence Command var _ Sequence = EscSequence(0) @@ -71,7 +81,9 @@ func (e EscSequence) buffer() *bytes.Buffer { if i := parser.Intermediate(int(e)); i != 0 { b.WriteByte(byte(i)) } - b.WriteByte(byte(e.Command())) + if cmd := e.Command(); cmd != 0 { + b.WriteByte(byte(cmd)) + } return &b } @@ -85,19 +97,19 @@ func (e EscSequence) String() string { return e.buffer().String() } -// Clone implements Sequence. +// Clone returns a deep copy of the escape sequence. func (e EscSequence) Clone() Sequence { return e } // Command returns the command byte of the escape sequence. func (e EscSequence) Command() int { - return parser.Command(int(e)) + return Command(e).Command() } // Intermediate returns the intermediate byte of the escape sequence. func (e EscSequence) Intermediate() int { - return parser.Intermediate(int(e)) + return Command(e).Intermediate() } // SosSequence represents a SOS sequence. @@ -106,12 +118,7 @@ type SosSequence struct { Data []byte } -var _ Sequence = &SosSequence{} - -// Clone implements Sequence. -func (s SosSequence) Clone() Sequence { - return SosSequence{Data: append([]byte(nil), s.Data...)} -} +var _ Sequence = SosSequence{} // Bytes implements Sequence. func (s SosSequence) Bytes() []byte { @@ -132,18 +139,20 @@ func (s SosSequence) buffer() *bytes.Buffer { return &b } +// Clone returns a deep copy of the SOS sequence. +func (s SosSequence) Clone() Sequence { + return SosSequence{ + Data: append([]byte(nil), s.Data...), + } +} + // PmSequence represents a PM sequence. type PmSequence struct { // Data contains the raw data of the sequence. Data []byte } -var _ Sequence = &PmSequence{} - -// Clone implements Sequence. -func (s PmSequence) Clone() Sequence { - return PmSequence{Data: append([]byte(nil), s.Data...)} -} +var _ Sequence = PmSequence{} // Bytes implements Sequence. func (s PmSequence) Bytes() []byte { @@ -165,17 +174,26 @@ func (s PmSequence) buffer() *bytes.Buffer { return &b } +// Clone returns a deep copy of the PM sequence. +func (p PmSequence) Clone() Sequence { + return PmSequence{ + Data: append([]byte(nil), p.Data...), + } +} + // ApcSequence represents an APC sequence. type ApcSequence struct { // Data contains the raw data of the sequence. Data []byte } -var _ Sequence = &ApcSequence{} +var _ Sequence = ApcSequence{} -// Clone implements Sequence. -func (s ApcSequence) Clone() Sequence { - return ApcSequence{Data: append([]byte(nil), s.Data...)} +// Clone returns a deep copy of the APC sequence. +func (a ApcSequence) Clone() Sequence { + return ApcSequence{ + Data: append([]byte(nil), a.Data...), + } } // Bytes implements Sequence. diff --git a/vendor/github.com/charmbracelet/x/ansi/sgr.go b/vendor/github.com/charmbracelet/x/ansi/sgr.go new file mode 100644 index 0000000000..1a18c98ef4 --- /dev/null +++ b/vendor/github.com/charmbracelet/x/ansi/sgr.go @@ -0,0 +1,95 @@ +package ansi + +import "strconv" + +// Select Graphic Rendition (SGR) is a command that sets display attributes. +// +// Default is 0. +// +// CSI Ps ; Ps ... m +// +// See: https://vt100.net/docs/vt510-rm/SGR.html +func SelectGraphicRendition(ps ...Attr) string { + if len(ps) == 0 { + return ResetStyle + } + + var s Style + for _, p := range ps { + attr, ok := attrStrings[p] + if ok { + s = append(s, attr) + } else { + if p < 0 { + p = 0 + } + s = append(s, strconv.Itoa(p)) + } + } + + return s.String() +} + +// SGR is an alias for [SelectGraphicRendition]. +func SGR(ps ...Attr) string { + return SelectGraphicRendition(ps...) +} + +var attrStrings = map[int]string{ + ResetAttr: "0", + BoldAttr: "1", + FaintAttr: "2", + ItalicAttr: "3", + UnderlineAttr: "4", + SlowBlinkAttr: "5", + RapidBlinkAttr: "6", + ReverseAttr: "7", + ConcealAttr: "8", + StrikethroughAttr: "9", + NoBoldAttr: "21", + NormalIntensityAttr: "22", + NoItalicAttr: "23", + NoUnderlineAttr: "24", + NoBlinkAttr: "25", + NoReverseAttr: "27", + NoConcealAttr: "28", + NoStrikethroughAttr: "29", + BlackForegroundColorAttr: "30", + RedForegroundColorAttr: "31", + GreenForegroundColorAttr: "32", + YellowForegroundColorAttr: "33", + BlueForegroundColorAttr: "34", + MagentaForegroundColorAttr: "35", + CyanForegroundColorAttr: "36", + WhiteForegroundColorAttr: "37", + ExtendedForegroundColorAttr: "38", + DefaultForegroundColorAttr: "39", + BlackBackgroundColorAttr: "40", + RedBackgroundColorAttr: "41", + GreenBackgroundColorAttr: "42", + YellowBackgroundColorAttr: "43", + BlueBackgroundColorAttr: "44", + MagentaBackgroundColorAttr: "45", + CyanBackgroundColorAttr: "46", + WhiteBackgroundColorAttr: "47", + ExtendedBackgroundColorAttr: "48", + DefaultBackgroundColorAttr: "49", + ExtendedUnderlineColorAttr: "58", + DefaultUnderlineColorAttr: "59", + BrightBlackForegroundColorAttr: "90", + BrightRedForegroundColorAttr: "91", + BrightGreenForegroundColorAttr: "92", + BrightYellowForegroundColorAttr: "93", + BrightBlueForegroundColorAttr: "94", + BrightMagentaForegroundColorAttr: "95", + BrightCyanForegroundColorAttr: "96", + BrightWhiteForegroundColorAttr: "97", + BrightBlackBackgroundColorAttr: "100", + BrightRedBackgroundColorAttr: "101", + BrightGreenBackgroundColorAttr: "102", + BrightYellowBackgroundColorAttr: "103", + BrightBlueBackgroundColorAttr: "104", + BrightMagentaBackgroundColorAttr: "105", + BrightCyanBackgroundColorAttr: "106", + BrightWhiteBackgroundColorAttr: "107", +} diff --git a/vendor/github.com/charmbracelet/x/ansi/status.go b/vendor/github.com/charmbracelet/x/ansi/status.go new file mode 100644 index 0000000000..6366607af6 --- /dev/null +++ b/vendor/github.com/charmbracelet/x/ansi/status.go @@ -0,0 +1,115 @@ +package ansi + +import ( + "strconv" + "strings" +) + +// Status represents a terminal status report. +type Status interface { + // Status returns the status report identifier. + Status() int +} + +// ANSIStatus represents an ANSI terminal status report. +type ANSIStatus int //nolint:revive + +// Status returns the status report identifier. +func (s ANSIStatus) Status() int { + return int(s) +} + +// DECStatus represents a DEC terminal status report. +type DECStatus int + +// Status returns the status report identifier. +func (s DECStatus) Status() int { + return int(s) +} + +// DeviceStatusReport (DSR) is a control sequence that reports the terminal's +// status. +// The terminal responds with a DSR sequence. +// +// CSI Ps n +// CSI ? Ps n +// +// If one of the statuses is a [DECStatus], the sequence will use the DEC +// format. +// +// See also https://vt100.net/docs/vt510-rm/DSR.html +func DeviceStatusReport(statues ...Status) string { + var dec bool + list := make([]string, len(statues)) + seq := "\x1b[" + for i, status := range statues { + list[i] = strconv.Itoa(status.Status()) + switch status.(type) { + case DECStatus: + dec = true + } + } + if dec { + seq += "?" + } + return seq + strings.Join(list, ";") + "n" +} + +// DSR is an alias for [DeviceStatusReport]. +func DSR(status Status) string { + return DeviceStatusReport(status) +} + +// CursorPositionReport (CPR) is a control sequence that reports the cursor's +// position. +// +// CSI Pl ; Pc R +// +// Where Pl is the line number and Pc is the column number. +// +// See also https://vt100.net/docs/vt510-rm/CPR.html +func CursorPositionReport(line, column int) string { + if line < 1 { + line = 1 + } + if column < 1 { + column = 1 + } + return "\x1b[" + strconv.Itoa(line) + ";" + strconv.Itoa(column) + "R" +} + +// CPR is an alias for [CursorPositionReport]. +func CPR(line, column int) string { + return CursorPositionReport(line, column) +} + +// ExtendedCursorPositionReport (DECXCPR) is a control sequence that reports the +// cursor's position along with the page number (optional). +// +// CSI ? Pl ; Pc R +// CSI ? Pl ; Pc ; Pv R +// +// Where Pl is the line number, Pc is the column number, and Pv is the page +// number. +// +// If the page number is zero or negative, the returned sequence won't include +// the page number. +// +// See also https://vt100.net/docs/vt510-rm/DECXCPR.html +func ExtendedCursorPositionReport(line, column, page int) string { + if line < 1 { + line = 1 + } + if column < 1 { + column = 1 + } + if page < 1 { + return "\x1b[?" + strconv.Itoa(line) + ";" + strconv.Itoa(column) + "R" + } + return "\x1b[?" + strconv.Itoa(line) + ";" + strconv.Itoa(column) + ";" + strconv.Itoa(page) + "R" +} + +// DECXCPR is an alias for [ExtendedCursorPositionReport]. +func DECXCPR(line, column, page int) string { + return ExtendedCursorPositionReport(line, column, page) +} diff --git a/vendor/github.com/charmbracelet/x/ansi/style.go b/vendor/github.com/charmbracelet/x/ansi/style.go index 5ab3dd473f..7f391156b0 100644 --- a/vendor/github.com/charmbracelet/x/ansi/style.go +++ b/vendor/github.com/charmbracelet/x/ansi/style.go @@ -487,10 +487,3 @@ func underlineColorString(c Color) string { } return defaultUnderlineColorAttr } - -func shift(v uint32) uint32 { - if v > 0xff { - return v >> 8 - } - return v -} diff --git a/vendor/github.com/charmbracelet/x/ansi/termcap.go b/vendor/github.com/charmbracelet/x/ansi/termcap.go index 1dfc52a6e0..3c5c7da92f 100644 --- a/vendor/github.com/charmbracelet/x/ansi/termcap.go +++ b/vendor/github.com/charmbracelet/x/ansi/termcap.go @@ -14,7 +14,7 @@ import ( // // See: https://man7.org/linux/man-pages/man5/terminfo.5.html // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Operating-System-Commands -func RequestTermcap(caps ...string) string { +func XTGETTCAP(caps ...string) string { if len(caps) == 0 { return "" } @@ -29,3 +29,13 @@ func RequestTermcap(caps ...string) string { return s + "\x1b\\" } + +// RequestTermcap is an alias for [XTGETTCAP]. +func RequestTermcap(caps ...string) string { + return XTGETTCAP(caps...) +} + +// RequestTerminfo is an alias for [XTGETTCAP]. +func RequestTerminfo(caps ...string) string { + return XTGETTCAP(caps...) +} diff --git a/vendor/github.com/charmbracelet/x/ansi/util.go b/vendor/github.com/charmbracelet/x/ansi/util.go index 767093f921..49cf2730c5 100644 --- a/vendor/github.com/charmbracelet/x/ansi/util.go +++ b/vendor/github.com/charmbracelet/x/ansi/util.go @@ -3,6 +3,10 @@ package ansi import ( "fmt" "image/color" + "strconv" + "strings" + + "github.com/lucasb-eyer/go-colorful" ) // colorToHexString returns a hex string representation of a color. @@ -27,3 +31,62 @@ func colorToHexString(c color.Color) string { func rgbToHex(r, g, b uint32) uint32 { return r<<16 + g<<8 + b } + +type shiftable interface { + ~uint | ~uint16 | ~uint32 | ~uint64 +} + +func shift[T shiftable](x T) T { + if x > 0xff { + x >>= 8 + } + return x +} + +// XParseColor is a helper function that parses a string into a color.Color. It +// provides a similar interface to the XParseColor function in Xlib. It +// supports the following formats: +// +// - #RGB +// - #RRGGBB +// - rgb:RRRR/GGGG/BBBB +// - rgba:RRRR/GGGG/BBBB/AAAA +// +// If the string is not a valid color, nil is returned. +// +// See: https://linux.die.net/man/3/xparsecolor +func XParseColor(s string) color.Color { + switch { + case strings.HasPrefix(s, "#"): + c, err := colorful.Hex(s) + if err != nil { + return nil + } + + return c + case strings.HasPrefix(s, "rgb:"): + parts := strings.Split(s[4:], "/") + if len(parts) != 3 { + return nil + } + + r, _ := strconv.ParseUint(parts[0], 16, 32) + g, _ := strconv.ParseUint(parts[1], 16, 32) + b, _ := strconv.ParseUint(parts[2], 16, 32) + + return color.RGBA{uint8(shift(r)), uint8(shift(g)), uint8(shift(b)), 255} //nolint:gosec + case strings.HasPrefix(s, "rgba:"): + parts := strings.Split(s[5:], "/") + if len(parts) != 4 { + return nil + } + + r, _ := strconv.ParseUint(parts[0], 16, 32) + g, _ := strconv.ParseUint(parts[1], 16, 32) + b, _ := strconv.ParseUint(parts[2], 16, 32) + a, _ := strconv.ParseUint(parts[3], 16, 32) + + return color.RGBA{uint8(shift(r)), uint8(shift(g)), uint8(shift(b)), uint8(shift(a))} //nolint:gosec + } + return nil +} diff --git a/vendor/github.com/charmbracelet/x/ansi/xterm.go b/vendor/github.com/charmbracelet/x/ansi/xterm.go index f87712a64b..129bd5fe5f 100644 --- a/vendor/github.com/charmbracelet/x/ansi/xterm.go +++ b/vendor/github.com/charmbracelet/x/ansi/xterm.go @@ -2,6 +2,84 @@ package ansi import "strconv" +// KeyModifierOptions (XTMODKEYS) sets/resets xterm key modifier options. +// +// Default is 0. +// +// CSI > Pp m +// CSI > Pp ; Pv m +// +// If Pv is omitted, the resource is reset to its initial value. +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ +func KeyModifierOptions(p int, vs ...int) string { + var pp, pv string + if p > 0 { + pp = strconv.Itoa(p) + } + + if len(vs) == 0 { + return "\x1b[>" + strconv.Itoa(p) + "m" + } + + v := vs[0] + if v > 0 { + pv = strconv.Itoa(v) + return "\x1b[>" + pp + ";" + pv + "m" + } + + return "\x1b[>" + pp + "m" +} + +// XTMODKEYS is an alias for [KeyModifierOptions]. +func XTMODKEYS(p int, vs ...int) string { + return KeyModifierOptions(p, vs...) +} + +// SetKeyModifierOptions sets xterm key modifier options. +// This is an alias for [KeyModifierOptions]. +func SetKeyModifierOptions(pp int, pv int) string { + return KeyModifierOptions(pp, pv) +} + +// ResetKeyModifierOptions resets xterm key modifier options. +// This is an alias for [KeyModifierOptions]. +func ResetKeyModifierOptions(pp int) string { + return KeyModifierOptions(pp) +} + +// QueryKeyModifierOptions (XTQMODKEYS) requests xterm key modifier options. +// +// Default is 0. +// +// CSI ? Pp m +// +// See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ +func QueryKeyModifierOptions(pp int) string { + var p string + if pp > 0 { + p = strconv.Itoa(pp) + } + return "\x1b[?" + p + "m" +} + +// XTQMODKEYS is an alias for [QueryKeyModifierOptions]. +func XTQMODKEYS(pp int) string { + return QueryKeyModifierOptions(pp) +} + +// Modify Other Keys (modifyOtherKeys) is an xterm feature that allows the +// terminal to modify the behavior of certain keys to send different escape +// sequences when pressed. +// +// See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys +const ( + SetModifyOtherKeys1 = "\x1b[>4;1m" + SetModifyOtherKeys2 = "\x1b[>4;2m" + ResetModifyOtherKeys = "\x1b[>4m" + QueryModifyOtherKeys = "\x1b[?4m" +) + // ModifyOtherKeys returns a sequence that sets XTerm modifyOtherKeys mode. // The mode argument specifies the mode to set. // @@ -13,6 +91,7 @@ import "strconv" // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ // See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys +// Deprecated: use [SetModifyOtherKeys1] or [SetModifyOtherKeys2] instead. func ModifyOtherKeys(mode int) string { return "\x1b[>4;" + strconv.Itoa(mode) + "m" } @@ -23,6 +102,7 @@ func ModifyOtherKeys(mode int) string { // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ // See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys +// Deprecated: use [ResetModifyOtherKeys] instead. const DisableModifyOtherKeys = "\x1b[>4;0m" // EnableModifyOtherKeys1 enables the modifyOtherKeys mode 1. @@ -31,6 +111,7 @@ const DisableModifyOtherKeys = "\x1b[>4;0m" // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ // See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys +// Deprecated: use [SetModifyOtherKeys1] instead. const EnableModifyOtherKeys1 = "\x1b[>4;1m" // EnableModifyOtherKeys2 enables the modifyOtherKeys mode 2. @@ -39,6 +120,7 @@ const EnableModifyOtherKeys1 = "\x1b[>4;1m" // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ // See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys +// Deprecated: use [SetModifyOtherKeys2] instead. const EnableModifyOtherKeys2 = "\x1b[>4;2m" // RequestModifyOtherKeys requests the modifyOtherKeys mode. @@ -47,4 +129,5 @@ const EnableModifyOtherKeys2 = "\x1b[>4;2m" // // See: https://invisible-island.net/xterm/ctlseqs/ctlseqs.html#h3-Functions-using-CSI-_-ordered-by-the-final-character_s_ // See: https://invisible-island.net/xterm/manpage/xterm.html#VT100-Widget-Resources:modifyOtherKeys +// Deprecated: use [QueryModifyOtherKeys] instead. const RequestModifyOtherKeys = "\x1b[?4m" diff --git a/vendor/github.com/cloudflare/cloudflare-go/CHANGELOG.md b/vendor/github.com/cloudflare/cloudflare-go/CHANGELOG.md index 50a6d56165..84a55a165d 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/CHANGELOG.md +++ b/vendor/github.com/cloudflare/cloudflare-go/CHANGELOG.md @@ -1,4 +1,21 @@ -## 0.110.0 (Unreleased) +## 0.111.0 (Unreleased) + +## 0.110.0 (November 20th, 2024) + +ENHANCEMENTS: + +* access_identity_provider: Adds identity_update_behavior to SCIM config. ([#3618](https://github.com/cloudflare/cloudflare-go/issues/3618)) +* turnstile: fix UpdateTurnstileWidgetParams (support setting values to `false`) ([#3594](https://github.com/cloudflare/cloudflare-go/issues/3594)) + +BUG FIXES: + +* snippets: fix response type for `UpdateZoneSnippet` ([#3596](https://github.com/cloudflare/cloudflare-go/issues/3596)) + +DEPENDENCIES: + +* deps: bumps golang.org/x/net from 0.30.0 to 0.31.0 ([#3588](https://github.com/cloudflare/cloudflare-go/issues/3588)) +* deps: bumps golang.org/x/time from 0.7.0 to 0.8.0 ([#3584](https://github.com/cloudflare/cloudflare-go/issues/3584)) +* deps: bumps goreleaser/goreleaser-action from 6.0.0 to 6.1.0 ([#3578](https://github.com/cloudflare/cloudflare-go/issues/3578)) ## 0.109.0 (November 6th, 2024) diff --git a/vendor/github.com/cloudflare/cloudflare-go/access_identity_provider.go b/vendor/github.com/cloudflare/cloudflare-go/access_identity_provider.go index a1ffc8ced5..c53f4e05d9 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/access_identity_provider.go +++ b/vendor/github.com/cloudflare/cloudflare-go/access_identity_provider.go @@ -58,6 +58,7 @@ type AccessIdentityProviderScimConfiguration struct { UserDeprovision bool `json:"user_deprovision,omitempty"` SeatDeprovision bool `json:"seat_deprovision,omitempty"` GroupMemberDeprovision bool `json:"group_member_deprovision,omitempty"` + IdentityUpdateBehavior string `json:"identity_update_behavior,omitempty"` } // AccessIdentityProvidersListResponse is the API response for multiple diff --git a/vendor/github.com/cloudflare/cloudflare-go/snippets.go b/vendor/github.com/cloudflare/cloudflare-go/snippets.go index d21ea6885f..11957357f8 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/snippets.go +++ b/vendor/github.com/cloudflare/cloudflare-go/snippets.go @@ -134,7 +134,7 @@ func snippetMultipartBody(request SnippetRequest) (string, *bytes.Buffer, error) return mw.Boundary(), body, nil } -func (api *API) UpdateZoneSnippet(ctx context.Context, rc *ResourceContainer, params SnippetRequest) ([]Snippet, error) { +func (api *API) UpdateZoneSnippet(ctx context.Context, rc *ResourceContainer, params SnippetRequest) (*Snippet, error) { if rc.Identifier == "" { return nil, ErrMissingZoneID } @@ -153,7 +153,7 @@ func (api *API) UpdateZoneSnippet(ctx context.Context, rc *ResourceContainer, pa return nil, err } - result := SnippetsResponse{} + result := SnippetResponse{} if err := json.Unmarshal(res, &result); err != nil { return nil, fmt.Errorf("%s: %w", errUnmarshalError, err) } diff --git a/vendor/github.com/cloudflare/cloudflare-go/snippets_rules.go b/vendor/github.com/cloudflare/cloudflare-go/snippets_rules.go index 37a92d2126..0fda88485a 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/snippets_rules.go +++ b/vendor/github.com/cloudflare/cloudflare-go/snippets_rules.go @@ -26,7 +26,7 @@ func (api *API) ListZoneSnippetsRules(ctx context.Context, rc *ResourceContainer return nil, ErrMissingZoneID } - uri := buildURI(fmt.Sprintf("/zones/%s/snippets/rules", rc.Identifier), nil) + uri := buildURI(fmt.Sprintf("/zones/%s/snippets/snippet_rules", rc.Identifier), nil) res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil) if err != nil { return nil, err @@ -45,7 +45,7 @@ func (api *API) UpdateZoneSnippetsRules(ctx context.Context, rc *ResourceContain return nil, ErrMissingZoneID } - uri := fmt.Sprintf("/zones/%s/snippets/rules", rc.Identifier) + uri := fmt.Sprintf("/zones/%s/snippets/snippet_rules", rc.Identifier) payload, err := json.Marshal(params) if err != nil { diff --git a/vendor/github.com/cloudflare/cloudflare-go/teams_accounts.go b/vendor/github.com/cloudflare/cloudflare-go/teams_accounts.go index 91e1e6a6c9..0366055882 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/teams_accounts.go +++ b/vendor/github.com/cloudflare/cloudflare-go/teams_accounts.go @@ -132,7 +132,7 @@ type TeamsAccountLoggingConfiguration struct { type TeamsLoggingSettings struct { LoggingSettingsByRuleType map[TeamsRuleType]TeamsAccountLoggingConfiguration `json:"settings_by_rule_type"` - RedactPii bool `json:"redact_pii,omitempty"` + RedactPii *bool `json:"redact_pii,omitempty"` } type TeamsDeviceSettings struct { diff --git a/vendor/github.com/cloudflare/cloudflare-go/turnstile.go b/vendor/github.com/cloudflare/cloudflare-go/turnstile.go index 5bc9273cd9..be6f8dbc6a 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/turnstile.go +++ b/vendor/github.com/cloudflare/cloudflare-go/turnstile.go @@ -36,12 +36,11 @@ type CreateTurnstileWidgetParams struct { type UpdateTurnstileWidgetParams struct { SiteKey string `json:"-"` - Name string `json:"name,omitempty"` - Domains []string `json:"domains,omitempty"` - Mode string `json:"mode,omitempty"` - BotFightMode bool `json:"bot_fight_mode,omitempty"` - Region string `json:"region,omitempty"` - OffLabel bool `json:"offlabel,omitempty"` + Name *string `json:"name,omitempty"` + Domains *[]string `json:"domains,omitempty"` + Mode *string `json:"mode,omitempty"` + BotFightMode *bool `json:"bot_fight_mode,omitempty"` + OffLabel *bool `json:"offlabel,omitempty"` } type TurnstileWidgetResponse struct { diff --git a/vendor/github.com/go-resty/resty/v2/README.md b/vendor/github.com/go-resty/resty/v2/README.md index 2bc050894b..7592ca9563 100644 --- a/vendor/github.com/go-resty/resty/v2/README.md +++ b/vendor/github.com/go-resty/resty/v2/README.md @@ -4,12 +4,12 @@

Features section describes in detail about Resty capabilities

-

Build Status Code Coverage Go Report Card Release Version GoDoc License Mentioned in Awesome Go

+

Build Status Code Coverage Go Report Card Release Version GoDoc License Mentioned in Awesome Go

## News - * v2.16.0 [released](https://github.com/go-resty/resty/releases/tag/v2.16.0) and tagged on Nov 10, 2024. + * v2.16.2 [released](https://github.com/go-resty/resty/releases/tag/v2.16.2) and tagged on Nov 21, 2024. * v2.0.0 [released](https://github.com/go-resty/resty/releases/tag/v2.0.0) and tagged on Jul 16, 2019. * v1.12.0 [released](https://github.com/go-resty/resty/releases/tag/v1.12.0) and tagged on Feb 27, 2019. * v1.0 released and tagged on Sep 25, 2017. - Resty's first version was released on Sep 15, 2015 then it grew gradually as a very handy and helpful library. Its been a two years since first release. I'm very thankful to Resty users and its [contributors](https://github.com/go-resty/resty/graphs/contributors). @@ -105,7 +105,7 @@ Resty author also published following projects for Go Community. ```bash # Go Modules -require github.com/go-resty/resty/v2 v2.16.0 +require github.com/go-resty/resty/v2 v2.16.2 ``` ## Usage diff --git a/vendor/github.com/go-resty/resty/v2/client.go b/vendor/github.com/go-resty/resty/v2/client.go index 48c69f19f7..7ab33ae864 100644 --- a/vendor/github.com/go-resty/resty/v2/client.go +++ b/vendor/github.com/go-resty/resty/v2/client.go @@ -1236,7 +1236,6 @@ func (c *Client) executeBefore(req *Request) error { return wrapNoRetryErr(err) } - req.RawRequest.Body = newRequestBodyReleaser(req.RawRequest.Body, req.bodyBuf) return nil } diff --git a/vendor/github.com/go-resty/resty/v2/request.go b/vendor/github.com/go-resty/resty/v2/request.go index 9075ead5fe..6c6f9259e2 100644 --- a/vendor/github.com/go-resty/resty/v2/request.go +++ b/vendor/github.com/go-resty/resty/v2/request.go @@ -1030,6 +1030,7 @@ func (r *Request) Execute(method, url string) (*Response, error) { r.Attempt = 1 resp, err = r.client.execute(r) r.client.onErrorHooks(r, resp, unwrapNoRetryErr(err)) + backToBufPool(r.bodyBuf) return resp, unwrapNoRetryErr(err) } @@ -1059,6 +1060,7 @@ func (r *Request) Execute(method, url string) (*Response, error) { } r.client.onErrorHooks(r, resp, unwrapNoRetryErr(err)) + backToBufPool(r.bodyBuf) return resp, unwrapNoRetryErr(err) } diff --git a/vendor/github.com/go-resty/resty/v2/resty.go b/vendor/github.com/go-resty/resty/v2/resty.go index 19f95ada64..92ed4eb8b0 100644 --- a/vendor/github.com/go-resty/resty/v2/resty.go +++ b/vendor/github.com/go-resty/resty/v2/resty.go @@ -14,7 +14,7 @@ import ( ) // Version # of resty -const Version = "2.16.0" +const Version = "2.16.2" // New method creates a new Resty client. func New() *Client { diff --git a/vendor/github.com/go-resty/resty/v2/util.go b/vendor/github.com/go-resty/resty/v2/util.go index e1a66ffe44..0ac470e438 100644 --- a/vendor/github.com/go-resty/resty/v2/util.go +++ b/vendor/github.com/go-resty/resty/v2/util.go @@ -19,7 +19,6 @@ import ( "runtime" "sort" "strings" - "sync" ) //‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾‾ @@ -286,7 +285,13 @@ func functionName(i interface{}) string { } func acquireBuffer() *bytes.Buffer { - return bufPool.Get().(*bytes.Buffer) + buf := bufPool.Get().(*bytes.Buffer) + if buf.Len() == 0 { + buf.Reset() + return buf + } + bufPool.Put(buf) + return new(bytes.Buffer) } func releaseBuffer(buf *bytes.Buffer) { @@ -296,34 +301,12 @@ func releaseBuffer(buf *bytes.Buffer) { } } -// requestBodyReleaser wraps requests's body and implements custom Close for it. -// The Close method closes original body and releases request body back to sync.Pool. -type requestBodyReleaser struct { - releaseOnce sync.Once - reqBuf *bytes.Buffer - io.ReadCloser -} - -func newRequestBodyReleaser(respBody io.ReadCloser, reqBuf *bytes.Buffer) io.ReadCloser { - if reqBuf == nil { - return respBody - } - - return &requestBodyReleaser{ - reqBuf: reqBuf, - ReadCloser: respBody, +func backToBufPool(buf *bytes.Buffer) { + if buf != nil { + bufPool.Put(buf) } } -func (rr *requestBodyReleaser) Close() error { - err := rr.ReadCloser.Close() - rr.releaseOnce.Do(func() { - releaseBuffer(rr.reqBuf) - }) - - return err -} - func closeq(v interface{}) { if c, ok := v.(io.Closer); ok { silently(c.Close()) diff --git a/vendor/github.com/pion/sctp/.golangci.yml b/vendor/github.com/pion/sctp/.golangci.yml index e06de4d3c0..a3235bec28 100644 --- a/vendor/github.com/pion/sctp/.golangci.yml +++ b/vendor/github.com/pion/sctp/.golangci.yml @@ -1,6 +1,9 @@ # SPDX-FileCopyrightText: 2023 The Pion community # SPDX-License-Identifier: MIT +run: + timeout: 5m + linters-settings: govet: enable: @@ -48,7 +51,7 @@ linters: - goconst # Finds repeated strings that could be replaced by a constant - gocritic # The most opinionated Go source code linter - godox # Tool for detection of FIXME, TODO and other comment keywords - - goerr113 # Golang linter to check the errors handling expressions + - err113 # Golang linter to check the errors handling expressions - gofmt # Gofmt checks whether code was gofmt-ed. By default this tool runs with -s option to check for code simplification - gofumpt # Gofumpt checks whether code was gofumpt-ed. - goheader # Checks is file header matches to pattern @@ -83,17 +86,14 @@ linters: - depguard # Go linter that checks if package imports are in a list of acceptable packages - containedctx # containedctx is a linter that detects struct contained context.Context field - cyclop # checks function and package cyclomatic complexity - - exhaustivestruct # Checks if all struct's fields are initialized - funlen # Tool for detection of long functions - gocyclo # Computes and checks the cyclomatic complexity of functions - godot # Check if comments end in a period - gomnd # An analyzer to detect magic numbers. - - ifshort # Checks that your code uses short syntax for if-statements whenever possible - ireturn # Accept Interfaces, Return Concrete Types - lll # Reports long lines - maintidx # maintidx measures the maintainability index of each function. - makezero # Finds slice declarations with non-zero initial length - - maligned # Tool to detect Go structs that would take less memory if their fields were sorted - nakedret # Finds naked returns in functions greater than a specified function length - nestif # Reports deeply nested if statements - nlreturn # nlreturn checks for a new line before return and branch statements to increase code clarity diff --git a/vendor/github.com/pion/sctp/association.go b/vendor/github.com/pion/sctp/association.go index 29e9978c92..938362545a 100644 --- a/vendor/github.com/pion/sctp/association.go +++ b/vendor/github.com/pion/sctp/association.go @@ -212,6 +212,9 @@ type Association struct { partialBytesAcked uint32 inFastRecovery bool fastRecoverExitPoint uint32 + minCwnd uint32 // Minimum congestion window + fastRtxWnd uint32 // Send window for fast retransmit + cwndCAStep uint32 // Step of congestion window increase at Congestion Avoidance // RTX & Ack timer rtoMgr *rtoManager @@ -261,8 +264,16 @@ type Config struct { MaxMessageSize uint32 EnableZeroChecksum bool LoggerFactory logging.LoggerFactory + + // congestion control configuration // RTOMax is the maximum retransmission timeout in milliseconds RTOMax float64 + // Minimum congestion window + MinCwnd uint32 + // Send window for fast retransmit + FastRtxWnd uint32 + // Step of congestion window increase at Congestion Avoidance + CwndCAStep uint32 } // Server accepts a SCTP stream over a conn @@ -325,6 +336,9 @@ func createAssociation(config Config) *Association { netConn: config.NetConn, maxReceiveBufferSize: maxReceiveBufferSize, maxMessageSize: maxMessageSize, + minCwnd: config.MinCwnd, + fastRtxWnd: config.FastRtxWnd, + cwndCAStep: config.CwndCAStep, // These two max values have us not need to follow // 5.1.1 where this peer may be incapable of supporting @@ -512,7 +526,7 @@ func (a *Association) Close() error { a.log.Debugf("[%s] stats nPackets (out) : %d", a.name, a.stats.getNumPacketsSent()) a.log.Debugf("[%s] stats nDATAs (in) : %d", a.name, a.stats.getNumDATAs()) a.log.Debugf("[%s] stats nSACKs (in) : %d", a.name, a.stats.getNumSACKsReceived()) - a.log.Debugf("[%s] stats nSACKs (out) : %d\n", a.name, a.stats.getNumSACKsSent()) + a.log.Debugf("[%s] stats nSACKs (out) : %d", a.name, a.stats.getNumSACKsSent()) a.log.Debugf("[%s] stats nT3Timeouts : %d", a.name, a.stats.getNumT3Timeouts()) a.log.Debugf("[%s] stats nAckTimeouts: %d", a.name, a.stats.getNumAckTimeouts()) a.log.Debugf("[%s] stats nFastRetrans: %d", a.name, a.stats.getNumFastRetrans()) @@ -803,9 +817,13 @@ func (a *Association) gatherOutboundFastRetransmissionPackets(rawPackets [][]byt if a.willRetransmitFast { a.willRetransmitFast = false - toFastRetrans := []chunk{} + toFastRetrans := []*chunkPayloadData{} fastRetransSize := commonHeaderSize + fastRetransWnd := a.MTU() + if fastRetransWnd < a.fastRtxWnd { + fastRetransWnd = a.fastRtxWnd + } for i := 0; ; i++ { c, ok := a.inflightQueue.get(a.cumulativeTSNAckPoint + uint32(i) + 1) if !ok { @@ -831,7 +849,7 @@ func (a *Association) gatherOutboundFastRetransmissionPackets(rawPackets [][]byt // packet. dataChunkSize := dataChunkHeaderSize + uint32(len(c.userData)) - if a.MTU() < fastRetransSize+dataChunkSize { + if fastRetransWnd < fastRetransSize+dataChunkSize { break } @@ -845,10 +863,12 @@ func (a *Association) gatherOutboundFastRetransmissionPackets(rawPackets [][]byt } if len(toFastRetrans) > 0 { - raw, err := a.marshalPacket(a.createPacket(toFastRetrans)) - if err != nil { - a.log.Warnf("[%s] failed to serialize a DATA packet to be fast-retransmitted", a.name) - } else { + for _, p := range a.bundleDataChunksIntoPackets(toFastRetrans) { + raw, err := a.marshalPacket(p) + if err != nil { + a.log.Warnf("[%s] failed to serialize a DATA packet to be fast-retransmitted", a.name) + continue + } rawPackets = append(rawPackets, raw) } } @@ -1115,6 +1135,9 @@ func (a *Association) CWND() uint32 { } func (a *Association) setCWND(cwnd uint32) { + if cwnd < a.minCwnd { + cwnd = a.minCwnd + } atomic.StoreUint32(&a.cwnd, cwnd) } @@ -1720,7 +1743,11 @@ func (a *Association) onCumulativeTSNAckPointAdvanced(totalBytesAcked int) { // reset partial_bytes_acked to (partial_bytes_acked - cwnd). if a.partialBytesAcked >= a.CWND() && a.pendingQueue.size() > 0 { a.partialBytesAcked -= a.CWND() - a.setCWND(a.CWND() + a.MTU()) + step := a.MTU() + if step < a.cwndCAStep { + step = a.cwndCAStep + } + a.setCWND(a.CWND() + step) a.log.Tracef("[%s] updated cwnd=%d ssthresh=%d acked=%d (CA)", a.name, a.CWND(), a.ssthresh, totalBytesAcked) } @@ -1728,7 +1755,7 @@ func (a *Association) onCumulativeTSNAckPointAdvanced(totalBytesAcked int) { } // The caller should hold the lock. -func (a *Association) processFastRetransmission(cumTSNAckPoint, htna uint32, cumTSNAckPointAdvanced bool) error { +func (a *Association) processFastRetransmission(cumTSNAckPoint uint32, gapAckBlocks []gapAckBlock, htna uint32, cumTSNAckPointAdvanced bool) error { // HTNA algorithm - RFC 4960 Sec 7.2.4 // Increment missIndicator of each chunks that the SACK reported missing // when either of the following is met: @@ -1745,7 +1772,10 @@ func (a *Association) processFastRetransmission(cumTSNAckPoint, htna uint32, cum maxTSN = htna } else { // b) increment for all TSNs reported missing - maxTSN = cumTSNAckPoint + uint32(a.inflightQueue.size()) + 1 + maxTSN = cumTSNAckPoint + if len(gapAckBlocks) > 0 { + maxTSN += uint32(gapAckBlocks[len(gapAckBlocks)-1].end) + } } for tsn := cumTSNAckPoint + 1; sna32LT(tsn, maxTSN); tsn++ { @@ -1855,7 +1885,7 @@ func (a *Association) handleSack(d *chunkSelectiveAck) error { a.setRWND(d.advertisedReceiverWindowCredit - bytesOutstanding) } - err = a.processFastRetransmission(d.cumulativeTSNAck, htna, cumTSNAckPointAdvanced) + err = a.processFastRetransmission(d.cumulativeTSNAck, d.gapAckBlocks, htna, cumTSNAckPointAdvanced) if err != nil { return err } diff --git a/vendor/github.com/pion/sctp/queue.go b/vendor/github.com/pion/sctp/queue.go index a6945caf59..be8eebb1bb 100644 --- a/vendor/github.com/pion/sctp/queue.go +++ b/vendor/github.com/pion/sctp/queue.go @@ -47,6 +47,10 @@ func (q *queue[T]) Front() T { return q.buf[q.head] } +func (q *queue[T]) Back() T { + return q.buf[(q.tail-1+len(q.buf))%len(q.buf)] +} + func (q *queue[T]) At(i int) T { return q.buf[(q.head+i)%(len(q.buf))] } diff --git a/vendor/modernc.org/libc/ccgo_linux_arm.go b/vendor/modernc.org/libc/ccgo_linux_arm.go index 5b796fea54..ebd4e5cfe5 100644 --- a/vendor/modernc.org/libc/ccgo_linux_arm.go +++ b/vendor/modernc.org/libc/ccgo_linux_arm.go @@ -151514,14 +151514,6 @@ func Xfsync(tls *TLS, fd int32) (r int32) { return X__syscall_ret(tls, uint32(___syscall_cp(tls, int32(SYS_fsync), fd, 0, 0, 0, 0, 0))) } -func Xftruncate(tls *TLS, fd int32, length Toff_t) (r int32) { - if __ccgo_strace { - trc("tls=%v fd=%v length=%v, (%v:)", tls, fd, length, origin(2)) - defer func() { trc("-> %v", r) }() - } - return X__syscall_ret(tls, uint32(X__syscall2(tls, int32(SYS_ftruncate64), fd, int32(length)))) -} - func Xgetcwd(tls *TLS, buf uintptr, size Tsize_t) (r uintptr) { if __ccgo_strace { trc("tls=%v buf=%v size=%v, (%v:)", tls, buf, size, origin(2)) @@ -151880,14 +151872,6 @@ func Xpwritev(tls *TLS, fd int32, iov uintptr, count int32, ofs Toff_t) (r Tssiz return X__syscall_ret(tls, uint32(___syscall_cp(tls, int32(SYS_pwritev), fd, int32(iov), count, int32(ofs), int32(ofs>>Int32FromInt32(32)), 0))) } -func Xread(tls *TLS, fd int32, buf uintptr, count Tsize_t) (r Tssize_t) { - if __ccgo_strace { - trc("tls=%v fd=%v buf=%v count=%v, (%v:)", tls, fd, buf, count, origin(2)) - defer func() { trc("-> %v", r) }() - } - return X__syscall_ret(tls, uint32(___syscall_cp(tls, int32(SYS_read), fd, int32(buf), int32(count), 0, 0, 0))) -} - func Xreadlink(tls *TLS, path uintptr, buf uintptr, bufsize Tsize_t) (r1 Tssize_t) { if __ccgo_strace { trc("tls=%v path=%v buf=%v bufsize=%v, (%v:)", tls, path, buf, bufsize, origin(2)) @@ -152237,14 +152221,6 @@ func Xusleep(tls *TLS, useconds uint32) (r int32) { return Xnanosleep(tls, bp, bp) } -func Xwrite(tls *TLS, fd int32, buf uintptr, count Tsize_t) (r Tssize_t) { - if __ccgo_strace { - trc("tls=%v fd=%v buf=%v count=%v, (%v:)", tls, fd, buf, count, origin(2)) - defer func() { trc("-> %v", r) }() - } - return X__syscall_ret(tls, uint32(___syscall_cp(tls, int32(SYS_write), fd, int32(buf), int32(count), 0, 0, 0))) -} - func Xwritev(tls *TLS, fd int32, iov uintptr, count int32) (r Tssize_t) { if __ccgo_strace { trc("tls=%v fd=%v iov=%v count=%v, (%v:)", tls, fd, iov, count, origin(2)) diff --git a/vendor/modernc.org/libc/libc_linux_arm.go b/vendor/modernc.org/libc/libc_linux_arm.go index 5d6d089530..9ebc5bdc77 100644 --- a/vendor/modernc.org/libc/libc_linux_arm.go +++ b/vendor/modernc.org/libc/libc_linux_arm.go @@ -5,8 +5,9 @@ package libc // import "modernc.org/libc" import ( - "syscall" "unsafe" + + "golang.org/x/sys/unix" ) func Xpread(tls *TLS, fd int32, buf uintptr, size Tsize_t, ofs Toff_t) (r Tssize_t) { @@ -14,9 +15,9 @@ func Xpread(tls *TLS, fd int32, buf uintptr, size Tsize_t, ofs Toff_t) (r Tssize trc("tls=%v fd=%v buf=%v size=%v ofs=%v, (%v:)", tls, fd, buf, size, ofs, origin(2)) defer func() { trc("-> %v", r) }() } - n, err := syscall.Pread(int(fd), unsafe.Slice((*byte)(unsafe.Pointer(buf)), size), ofs) + n, err := unix.Pread(int(fd), unsafe.Slice((*byte)(unsafe.Pointer(buf)), size), ofs) if err != nil { - *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(err.(syscall.Errno)) + *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(err.(unix.Errno)) return -1 } @@ -28,9 +29,53 @@ func Xpwrite(tls *TLS, fd int32, buf uintptr, size Tsize_t, ofs Toff_t) (r Tssiz trc("tls=%v fd=%v buf=%v size=%v ofs=%v, (%v:)", tls, fd, buf, size, ofs, origin(2)) defer func() { trc("-> %v", r) }() } - n, err := syscall.Pwrite(int(fd), unsafe.Slice((*byte)(unsafe.Pointer(buf)), size), ofs) + n, err := unix.Pwrite(int(fd), unsafe.Slice((*byte)(unsafe.Pointer(buf)), size), ofs) + if err != nil { + *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(err.(unix.Errno)) + return -1 + } + + return Tssize_t(n) +} + +func Xftruncate(tls *TLS, fd int32, length Toff_t) (r int32) { + if __ccgo_strace { + trc("tls=%v fd=%v length=%v, (%v:)", tls, fd, length, origin(2)) + defer func() { trc("-> %v", r) }() + } + //return X__syscall_ret(tls, uint32(X__syscall2(tls, int32(SYS_ftruncate64), fd, int32(length)))) + if err := unix.Ftruncate(int(fd), int64(length)); err != nil { + *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(err.(unix.Errno)) + return -1 + } + + return 0 +} + +func Xread(tls *TLS, fd int32, buf uintptr, count Tsize_t) (r Tssize_t) { + if __ccgo_strace { + trc("tls=%v fd=%v buf=%v count=%v, (%v:)", tls, fd, buf, count, origin(2)) + defer func() { trc("-> %v", r) }() + } + // return X__syscall_ret(tls, uint32(___syscall_cp(tls, int32(SYS_read), fd, int32(buf), int32(count), 0, 0, 0))) + n, err := unix.Read(int(fd), unsafe.Slice((*byte)(unsafe.Pointer(buf)), count)) + if err != nil { + *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(err.(unix.Errno)) + return -1 + } + + return Tssize_t(n) +} + +func Xwrite(tls *TLS, fd int32, buf uintptr, count Tsize_t) (r Tssize_t) { + if __ccgo_strace { + trc("tls=%v fd=%v buf=%v count=%v, (%v:)", tls, fd, buf, count, origin(2)) + defer func() { trc("-> %v", r) }() + } + // return X__syscall_ret(tls, uint32(___syscall_cp(tls, int32(SYS_write), fd, int32(buf), int32(count), 0, 0, 0))) + n, err := unix.Write(int(fd), unsafe.Slice((*byte)(unsafe.Pointer(buf)), count)) if err != nil { - *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(err.(syscall.Errno)) + *(*int32)(unsafe.Pointer(X__errno_location(tls))) = int32(err.(unix.Errno)) return -1 } diff --git a/vendor/modules.txt b/vendor/modules.txt index 7f5f639b97..134635cd3e 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -61,7 +61,7 @@ github.com/CortexFoundation/robot/backend # github.com/CortexFoundation/statik v0.0.0-20210315012922-8bb8a7b5dc66 ## explicit; go 1.16 github.com/CortexFoundation/statik -# github.com/CortexFoundation/torrentfs v1.0.69-0.20241114140948-a53b7b20e4c1 +# github.com/CortexFoundation/torrentfs v1.0.69-0.20241125143232-6e25c28c7a3c ## explicit; go 1.23.0 github.com/CortexFoundation/torrentfs github.com/CortexFoundation/torrentfs/backend @@ -211,7 +211,7 @@ github.com/arsham/figurine/figurine # github.com/arsham/rainbow v1.2.1 ## explicit; go 1.18 github.com/arsham/rainbow/rainbow -# github.com/aws/aws-sdk-go-v2 v1.32.4 +# github.com/aws/aws-sdk-go-v2 v1.32.5 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/aws github.com/aws/aws-sdk-go-v2/aws/defaults @@ -237,10 +237,10 @@ github.com/aws/aws-sdk-go-v2/internal/shareddefaults github.com/aws/aws-sdk-go-v2/internal/strings github.com/aws/aws-sdk-go-v2/internal/sync/singleflight github.com/aws/aws-sdk-go-v2/internal/timeconv -# github.com/aws/aws-sdk-go-v2/config v1.28.4 +# github.com/aws/aws-sdk-go-v2/config v1.28.5 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/config -# github.com/aws/aws-sdk-go-v2/credentials v1.17.45 +# github.com/aws/aws-sdk-go-v2/credentials v1.17.46 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/credentials github.com/aws/aws-sdk-go-v2/credentials/ec2rolecreds @@ -249,42 +249,42 @@ github.com/aws/aws-sdk-go-v2/credentials/endpointcreds/internal/client github.com/aws/aws-sdk-go-v2/credentials/processcreds github.com/aws/aws-sdk-go-v2/credentials/ssocreds github.com/aws/aws-sdk-go-v2/credentials/stscreds -# github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.19 +# github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/feature/ec2/imds github.com/aws/aws-sdk-go-v2/feature/ec2/imds/internal/config -# github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.23 +# github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.24 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/internal/configsources -# github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.23 +# github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.24 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 # github.com/aws/aws-sdk-go-v2/internal/ini v1.8.1 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/internal/ini -# github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.0 +# github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding -# github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.4 +# github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.5 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/service/internal/presigned-url -# github.com/aws/aws-sdk-go-v2/service/route53 v1.46.1 +# github.com/aws/aws-sdk-go-v2/service/route53 v1.46.2 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/service/route53 github.com/aws/aws-sdk-go-v2/service/route53/internal/customizations github.com/aws/aws-sdk-go-v2/service/route53/internal/endpoints github.com/aws/aws-sdk-go-v2/service/route53/types -# github.com/aws/aws-sdk-go-v2/service/sso v1.24.5 +# github.com/aws/aws-sdk-go-v2/service/sso v1.24.6 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/service/sso github.com/aws/aws-sdk-go-v2/service/sso/internal/endpoints github.com/aws/aws-sdk-go-v2/service/sso/types -# github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.4 +# github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.5 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/service/ssooidc github.com/aws/aws-sdk-go-v2/service/ssooidc/internal/endpoints github.com/aws/aws-sdk-go-v2/service/ssooidc/types -# github.com/aws/aws-sdk-go-v2/service/sts v1.33.0 +# github.com/aws/aws-sdk-go-v2/service/sts v1.33.1 ## explicit; go 1.21 github.com/aws/aws-sdk-go-v2/service/sts github.com/aws/aws-sdk-go-v2/service/sts/internal/endpoints @@ -326,7 +326,7 @@ github.com/benbjohnson/immutable # github.com/beorn7/perks v1.0.1 ## explicit; go 1.11 github.com/beorn7/perks/quantile -# github.com/bits-and-blooms/bitset v1.15.0 +# github.com/bits-and-blooms/bitset v1.16.0 ## explicit; go 1.16 github.com/bits-and-blooms/bitset # github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 @@ -344,20 +344,20 @@ github.com/cespare/xxhash # github.com/cespare/xxhash/v2 v2.3.0 ## explicit; go 1.11 github.com/cespare/xxhash/v2 -# github.com/charmbracelet/bubbletea v1.2.2 +# github.com/charmbracelet/bubbletea v1.2.3 ## explicit; go 1.18 github.com/charmbracelet/bubbletea # github.com/charmbracelet/lipgloss v1.0.0 ## explicit; go 1.18 github.com/charmbracelet/lipgloss -# github.com/charmbracelet/x/ansi v0.4.5 +# github.com/charmbracelet/x/ansi v0.5.2 ## explicit; go 1.18 github.com/charmbracelet/x/ansi github.com/charmbracelet/x/ansi/parser # github.com/charmbracelet/x/term v0.2.1 ## explicit; go 1.18 github.com/charmbracelet/x/term -# github.com/cloudflare/cloudflare-go v0.109.0 +# github.com/cloudflare/cloudflare-go v0.110.0 ## explicit; go 1.19 github.com/cloudflare/cloudflare-go # github.com/cockroachdb/errors v1.11.3 @@ -581,7 +581,7 @@ github.com/go-logr/stdr ## explicit; go 1.12 github.com/go-ole/go-ole github.com/go-ole/go-ole/oleutil -# github.com/go-resty/resty/v2 v2.16.0 +# github.com/go-resty/resty/v2 v2.16.2 ## explicit; go 1.20 github.com/go-resty/resty/v2 github.com/go-resty/resty/v2/shellescape @@ -632,7 +632,7 @@ github.com/google/go-querystring/query ## explicit; go 1.12 github.com/google/gofuzz github.com/google/gofuzz/bytesource -# github.com/google/pprof v0.0.0-20241101162523-b92577c0c142 +# github.com/google/pprof v0.0.0-20241122213907-cbe949e5a41b ## explicit; go 1.22 github.com/google/pprof/profile # github.com/google/uuid v1.6.0 @@ -693,7 +693,7 @@ github.com/influxdata/line-protocol # github.com/jackpal/go-nat-pmp v1.0.2 ## explicit github.com/jackpal/go-nat-pmp -# github.com/jedib0t/go-pretty/v6 v6.6.1 +# github.com/jedib0t/go-pretty/v6 v6.6.2 ## explicit; go 1.17 github.com/jedib0t/go-pretty/v6/progress github.com/jedib0t/go-pretty/v6/text @@ -894,8 +894,8 @@ github.com/pion/rtp github.com/pion/rtp/codecs github.com/pion/rtp/codecs/av1/obu github.com/pion/rtp/codecs/vp9 -# github.com/pion/sctp v1.8.33 -## explicit; go 1.19 +# github.com/pion/sctp v1.8.34 +## explicit; go 1.20 github.com/pion/sctp # github.com/pion/sdp/v3 v3.0.9 ## explicit; go 1.13 @@ -1283,7 +1283,7 @@ gopkg.in/yaml.v3 lukechampine.com/blake3 lukechampine.com/blake3/bao lukechampine.com/blake3/guts -# modernc.org/libc v1.61.1 +# modernc.org/libc v1.61.2 ## explicit; go 1.21 modernc.org/libc modernc.org/libc/errno