From 745950a33b7d76184abf4b9ba748647a5ed2e15d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 10:14:41 +0000 Subject: [PATCH] Bump github.com/navidys/tvxwidgets from 0.11.1 to 0.13.0 Bumps [github.com/navidys/tvxwidgets](https://github.com/navidys/tvxwidgets) from 0.11.1 to 0.13.0. - [Release notes](https://github.com/navidys/tvxwidgets/releases) - [Commits](https://github.com/navidys/tvxwidgets/compare/v0.11.1...v0.13.0) --- updated-dependencies: - dependency-name: github.com/navidys/tvxwidgets dependency-version: 0.13.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- go.mod | 10 +- go.sum | 20 +-- vendor/github.com/gdamore/tcell/v2/tscreen.go | 9 +- .../navidys/tvxwidgets/.golangci.yml | 48 ++++--- vendor/github.com/navidys/tvxwidgets/Makefile | 2 +- .../github.com/navidys/tvxwidgets/barchart.go | 5 +- .../github.com/navidys/tvxwidgets/dialog.go | 7 +- .../github.com/navidys/tvxwidgets/gauge_am.go | 7 +- .../github.com/navidys/tvxwidgets/gauge_pm.go | 7 +- .../github.com/navidys/tvxwidgets/gauge_um.go | 17 +-- vendor/github.com/navidys/tvxwidgets/plot.go | 21 +-- .../navidys/tvxwidgets/sparkline.go | 6 +- .../github.com/navidys/tvxwidgets/spinner.go | 21 +-- vendor/github.com/navidys/tvxwidgets/utils.go | 5 +- vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md | 10 ++ .../onsi/ginkgo/v2/internal/suite.go | 5 +- .../internal/testingtproxy/testing_t_proxy.go | 7 +- .../onsi/ginkgo/v2/types/version.go | 2 +- vendor/github.com/onsi/gomega/CHANGELOG.md | 11 ++ .../github.com/onsi/gomega/format/format.go | 26 ++-- vendor/github.com/onsi/gomega/gomega_dsl.go | 2 +- vendor/github.com/onsi/gomega/matchers.go | 22 +++- .../onsi/gomega/matchers/have_key_matcher.go | 2 +- .../matchers/have_key_with_value_matcher.go | 2 +- .../matchers/match_error_strictly_matcher.go | 39 ++++++ .../matchers/support/goraph/edge/edge.go | 13 +- vendor/github.com/rivo/tview/README.md | 5 +- vendor/github.com/rivo/tview/ansi.go | 11 +- vendor/github.com/rivo/tview/application.go | 27 +++- vendor/github.com/rivo/tview/box.go | 2 +- vendor/github.com/rivo/tview/doc.go | 2 +- vendor/github.com/rivo/tview/inputfield.go | 26 ++-- vendor/github.com/rivo/tview/pages.go | 17 ++- vendor/github.com/rivo/tview/strings.go | 121 ++++++++++-------- vendor/github.com/rivo/tview/table.go | 6 +- vendor/modules.txt | 12 +- 36 files changed, 356 insertions(+), 199 deletions(-) create mode 100644 vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go diff --git a/go.mod b/go.mod index fbf1dc18f..acdb59345 100644 --- a/go.mod +++ b/go.mod @@ -3,15 +3,15 @@ module github.com/netobserv/network-observability-cli go 1.25.0 require ( - github.com/gdamore/tcell/v2 v2.13.7 + github.com/gdamore/tcell/v2 v2.13.8 github.com/gopacket/gopacket v1.5.0 github.com/jpillora/sizestr v1.0.0 github.com/mattn/go-sqlite3 v1.14.32 - github.com/navidys/tvxwidgets v0.11.1 + github.com/navidys/tvxwidgets v0.13.0 github.com/netobserv/flowlogs-pipeline v1.10.1-community github.com/netobserv/netobserv-ebpf-agent v1.10.1-community - github.com/onsi/ginkgo/v2 v2.27.3 - github.com/onsi/gomega v1.38.2 + github.com/onsi/ginkgo/v2 v2.27.5 + github.com/onsi/gomega v1.39.0 github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.10.2 github.com/stretchr/testify v1.11.1 @@ -66,7 +66,7 @@ require ( github.com/prometheus/client_model v0.6.2 // indirect github.com/prometheus/common v0.67.5 github.com/prometheus/procfs v0.16.1 // indirect - github.com/rivo/tview v0.0.0-20250501113434-0c592cd31026 + github.com/rivo/tview v0.42.0 github.com/rivo/uniseg v0.4.7 // indirect github.com/segmentio/kafka-go v0.4.49 // indirect github.com/spf13/pflag v1.0.10 // indirect diff --git a/go.sum b/go.sum index a94cff09e..6aae7e895 100644 --- a/go.sum +++ b/go.sum @@ -39,8 +39,8 @@ github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sa github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= github.com/gdamore/encoding v1.0.1 h1:YzKZckdBL6jVt2Gc+5p82qhrGiqMdG/eNs6Wy0u3Uhw= github.com/gdamore/encoding v1.0.1/go.mod h1:0Z0cMFinngz9kS1QfMjCP8TY7em3bZYeeklsSDPivEo= -github.com/gdamore/tcell/v2 v2.13.7 h1:yfHdeC7ODIYCc6dgRos8L1VujQtXHmUpU6UZotzD6os= -github.com/gdamore/tcell/v2 v2.13.7/go.mod h1:+Wfe208WDdB7INEtCsNrAN6O2m+wsTPk1RAovjaILlo= +github.com/gdamore/tcell/v2 v2.13.8 h1:Mys/Kl5wfC/GcC5Cx4C2BIQH9dbnhnkPgS9/wF3RlfU= +github.com/gdamore/tcell/v2 v2.13.8/go.mod h1:+Wfe208WDdB7INEtCsNrAN6O2m+wsTPk1RAovjaILlo= github.com/gkampitakis/ciinfo v0.3.2 h1:JcuOPk8ZU7nZQjdUhctuhQofk7BGHuIy0c9Ez8BNhXs= github.com/gkampitakis/ciinfo v0.3.2/go.mod h1:1NIwaOcFChN4fa/B0hEBdAb6npDlFL8Bwx4dfRLRqAo= github.com/gkampitakis/go-diff v1.3.2 h1:Qyn0J9XJSDTgnsgHRdz9Zp24RaJeKMUHg2+PDZZdC4M= @@ -132,18 +132,18 @@ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+ github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f h1:y5//uYreIhSUg3J1GEMiLbxo1LJaP8RfCpH6pymGZus= github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= -github.com/navidys/tvxwidgets v0.11.1 h1:H/H3IdD1bxRoDt6yPl8/I2ZG+dGARMao7nK7kYnprxc= -github.com/navidys/tvxwidgets v0.11.1/go.mod h1:3Pdk7b/8myzGTediDaeaG5i4Nv+ozVoPtorU3Ihcx9M= +github.com/navidys/tvxwidgets v0.13.0 h1:ccGODowWhHQH7zh43lwdeML+qpZS0cMHByjS3CPcRJY= +github.com/navidys/tvxwidgets v0.13.0/go.mod h1:C+hTUXTFCOaYQkKlwqqn9K54RT0zrNqfqhI/RWwt+g4= github.com/netobserv/flowlogs-pipeline v1.10.1-community h1:NJvzcrxf101qdQ5tEteckRJrl4iidSuRf3uIJ8g0Cxw= github.com/netobserv/flowlogs-pipeline v1.10.1-community/go.mod h1:ucluGizSprM18pO6Pj6cMUiF1/QnEthW1AewX8G6w0Q= github.com/netobserv/netobserv-ebpf-agent v1.10.1-community h1:9elSOcMkEQeztWH6w8eB3cRZUApaBvexZNQ/xExXXnA= github.com/netobserv/netobserv-ebpf-agent v1.10.1-community/go.mod h1:l9igyOCKLjPGD49AOuMWPbwdUTPHqid1fvC8dSYzOR4= github.com/netsampler/goflow2 v1.3.7 h1:XZaTy8kkMnGXpJ9hS3KbO1McyrFTpVNhVFEx9rNhMmc= github.com/netsampler/goflow2 v1.3.7/go.mod h1:4UZsVGVAs//iMCptUHn3WNScztJeUhZH7kDW2+/vDdQ= -github.com/onsi/ginkgo/v2 v2.27.3 h1:ICsZJ8JoYafeXFFlFAG75a7CxMsJHwgKwtO+82SE9L8= -github.com/onsi/ginkgo/v2 v2.27.3/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= -github.com/onsi/gomega v1.38.2 h1:eZCjf2xjZAqe+LeWvKb5weQ+NcPwX84kqJ0cZNxok2A= -github.com/onsi/gomega v1.38.2/go.mod h1:W2MJcYxRGV63b418Ai34Ud0hEdTVXq9NW9+Sx6uXf3k= +github.com/onsi/ginkgo/v2 v2.27.5 h1:ZeVgZMx2PDMdJm/+w5fE/OyG6ILo1Y3e+QX4zSR0zTE= +github.com/onsi/ginkgo/v2 v2.27.5/go.mod h1:ArE1D/XhNXBXCBkKOLkbsb2c81dQHCRcF5zwn/ykDRo= +github.com/onsi/gomega v1.39.0 h1:y2ROC3hKFmQZJNFeGAMeHZKkjBL65mIZcvrLQBF9k6Q= +github.com/onsi/gomega v1.39.0/go.mod h1:ZCU1pkQcXDO5Sl9/VVEGlDyp+zm0m1cmeG5TOzLgdh4= github.com/ovn-org/libovsdb v0.7.1-0.20240820095311-ce1951614a20 h1:OoDvzyaK7F/ZANIIFOgb4Haj7mye3Hle0fYZZNdidSs= github.com/ovn-org/libovsdb v0.7.1-0.20240820095311-ce1951614a20/go.mod h1:dJbxEaalQl83nn904K32FaMjlH/qOObZ0bj4ejQ78AI= github.com/ovn-org/ovn-kubernetes/go-controller v0.0.0-20250227173154-57a2590a1d16 h1:t4NphP6IIFRe5/2NGc1MD0e72pLYIzaG9YizrYyk84Y= @@ -163,8 +163,8 @@ github.com/prometheus/common v0.67.5 h1:pIgK94WWlQt1WLwAC5j2ynLaBRDiinoAb86HZHTU github.com/prometheus/common v0.67.5/go.mod h1:SjE/0MzDEEAyrdr5Gqc6G+sXI67maCxzaT3A2+HqjUw= github.com/prometheus/procfs v0.16.1 h1:hZ15bTNuirocR6u0JZ6BAHHmwS1p8B4P6MRqxtzMyRg= github.com/prometheus/procfs v0.16.1/go.mod h1:teAbpZRB1iIAJYREa1LsoWUXykVXA1KlTmWl8x/U+Is= -github.com/rivo/tview v0.0.0-20250501113434-0c592cd31026 h1:ij8h8B3psk3LdMlqkfPTKIzeGzTaZLOiyplILMlxPAM= -github.com/rivo/tview v0.0.0-20250501113434-0c592cd31026/go.mod h1:02iFIz7K/A9jGCvrizLPvoqr4cEIx7q54RH5Qudkrss= +github.com/rivo/tview v0.42.0 h1:b/ftp+RxtDsHSaynXTbJb+/n/BxDEi+W3UfF5jILK6c= +github.com/rivo/tview v0.42.0/go.mod h1:cSfIYfhpSGCjp3r/ECJb+GKS7cGJnqV8vfjQPwoXyfY= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= diff --git a/vendor/github.com/gdamore/tcell/v2/tscreen.go b/vendor/github.com/gdamore/tcell/v2/tscreen.go index b4dfdf960..7dc7cdf81 100644 --- a/vendor/github.com/gdamore/tcell/v2/tscreen.go +++ b/vendor/github.com/gdamore/tcell/v2/tscreen.go @@ -622,7 +622,7 @@ func (t *tScreen) drawCell(x, y int) int { width = 1 str = " " } - if width > 1 { + if width > 1 && x+width < t.w { // Clobber over any content in the next cell. // This fixes a problem with some terminals where overwriting two // adjacent single cells with a wide rune would leave an image @@ -997,9 +997,14 @@ func (t *tScreen) buildAcsMap() { } func (t *tScreen) scanInput(buf *bytes.Buffer) { + // The end of the buffer isn't necessarily the end of the input, because + // large inputs are chunked. Set atEOF to false so the UTF-8 validating decoder + // returns ErrShortSrc instead of ErrInvalidUTF8 for incomplete multi-byte codepoints. + const atEOF = false + for buf.Len() > 0 { utf := make([]byte, min(8, max(buf.Len()*2, 128))) - nOut, nIn, e := t.decoder.Transform(utf, buf.Bytes(), true) + nOut, nIn, e := t.decoder.Transform(utf, buf.Bytes(), atEOF) _ = buf.Next(nIn) t.input.ScanUTF8(utf[:nOut]) if e == transform.ErrShortSrc { diff --git a/vendor/github.com/navidys/tvxwidgets/.golangci.yml b/vendor/github.com/navidys/tvxwidgets/.golangci.yml index e4c4fbb1a..7a6a3c874 100644 --- a/vendor/github.com/navidys/tvxwidgets/.golangci.yml +++ b/vendor/github.com/navidys/tvxwidgets/.golangci.yml @@ -1,26 +1,36 @@ +version: "2" run: - timeout: 10m - deadline: 5m + modules-download-mode: readonly + +formatters: + enable: + - gofmt + - goimports + exclusions: + generated: disable + linters: - enable-all: true + default: all disable: - varnamelen - exhaustruct - depguard - # deprecated - - tenv - - rowserrcheck - - wastedassign -linters-settings: - errcheck: - check-blank: false - exclude-functions: - - fmt:.* - nolintlint: - require-specific: true - + - wsl + settings: + errcheck: + check-blank: false + exclude-functions: + - fmt:.* + nolintlint: + require-specific: true + revive: + rules: + - name: package-comments + disabled: true + exclusions: + paths: + - demos + - ".*_test.go" issues: - exclude-dirs: - - demos - exclude-files: - - ".*_test.go" + max-issues-per-linter: 0 + max-same-issues: 0 diff --git a/vendor/github.com/navidys/tvxwidgets/Makefile b/vendor/github.com/navidys/tvxwidgets/Makefile index e15182f5b..9d532d9ec 100644 --- a/vendor/github.com/navidys/tvxwidgets/Makefile +++ b/vendor/github.com/navidys/tvxwidgets/Makefile @@ -32,7 +32,7 @@ install.tools: .install.pre-commit .install.codespell .install.golangci-lint .in .PHONY: .install.golangci-lint .install.golangci-lint: - VERSION=1.64.4 ./hack/install_golangci.sh + VERSION=2.3.1 ./hack/install_golangci.sh #================================================= # Testing (units, functionality, ...) targets diff --git a/vendor/github.com/navidys/tvxwidgets/barchart.go b/vendor/github.com/navidys/tvxwidgets/barchart.go index 815e0b7d1..4af011e27 100644 --- a/vendor/github.com/navidys/tvxwidgets/barchart.go +++ b/vendor/github.com/navidys/tvxwidgets/barchart.go @@ -23,6 +23,7 @@ type BarChartItem struct { // BarChart represents bar chart primitive. type BarChart struct { *tview.Box + // bar items bars []BarChartItem // maximum value of bars @@ -62,9 +63,9 @@ func (c *BarChart) HasFocus() bool { // Draw draws this primitive onto the screen. func (c *BarChart) Draw(screen tcell.Screen) { //nolint:funlen,cyclop - c.Box.DrawForSubclass(screen, c) + c.DrawForSubclass(screen, c) - x, y, width, height := c.Box.GetInnerRect() + x, y, width, height := c.GetInnerRect() maxValY := y + 1 xAxisStartY := y + height - 2 //nolint:mnd diff --git a/vendor/github.com/navidys/tvxwidgets/dialog.go b/vendor/github.com/navidys/tvxwidgets/dialog.go index a9a653500..8827910a6 100644 --- a/vendor/github.com/navidys/tvxwidgets/dialog.go +++ b/vendor/github.com/navidys/tvxwidgets/dialog.go @@ -16,6 +16,7 @@ const ( // MessageDialog represents message dialog primitive. type MessageDialog struct { *tview.Box + // layout message dialog layout layout *tview.Flex // message view @@ -122,8 +123,8 @@ func (d *MessageDialog) SetTextColor(color tcell.Color) { // Draw draws this primitive onto the screen. func (d *MessageDialog) Draw(screen tcell.Screen) { - d.Box.DrawForSubclass(screen, d) - x, y, width, height := d.Box.GetInnerRect() + d.DrawForSubclass(screen, d) + x, y, width, height := d.GetInnerRect() d.layout.SetRect(x, y, width, height) d.layout.Draw(screen) } @@ -196,7 +197,7 @@ func (d *MessageDialog) setColor() { func (d *MessageDialog) setRect() { maxHeight := d.height - maxWidth := d.width //nolint:ifshort + maxWidth := d.width messageHeight := len(strings.Split(d.message, "\n")) messageWidth := getMessageWidth(d.message) diff --git a/vendor/github.com/navidys/tvxwidgets/gauge_am.go b/vendor/github.com/navidys/tvxwidgets/gauge_am.go index 4f70e265a..3fb407bf6 100644 --- a/vendor/github.com/navidys/tvxwidgets/gauge_am.go +++ b/vendor/github.com/navidys/tvxwidgets/gauge_am.go @@ -10,6 +10,7 @@ import ( // ActivityModeGauge represents activity mode gauge permitive. type ActivityModeGauge struct { *tview.Box + // counter value counter int @@ -30,8 +31,8 @@ func NewActivityModeGauge() *ActivityModeGauge { // Draw draws this primitive onto the screen. func (g *ActivityModeGauge) Draw(screen tcell.Screen) { - g.Box.DrawForSubclass(screen, g) - x, y, width, height := g.Box.GetInnerRect() + g.DrawForSubclass(screen, g) + x, y, width, height := g.GetInnerRect() tickStr := g.tickStr(width) for i := range height { @@ -40,7 +41,7 @@ func (g *ActivityModeGauge) Draw(screen tcell.Screen) { } // Focus is called when this primitive receives focus. -func (g *ActivityModeGauge) Focus(delegate func(p tview.Primitive)) { //nolint:revive +func (g *ActivityModeGauge) Focus(delegate func(p tview.Primitive)) { } // HasFocus returns whether or not this primitive has focus. diff --git a/vendor/github.com/navidys/tvxwidgets/gauge_pm.go b/vendor/github.com/navidys/tvxwidgets/gauge_pm.go index 6f35a2517..c6034f7c6 100644 --- a/vendor/github.com/navidys/tvxwidgets/gauge_pm.go +++ b/vendor/github.com/navidys/tvxwidgets/gauge_pm.go @@ -10,6 +10,7 @@ import ( // PercentageModeGauge represents percentage mode gauge permitive. type PercentageModeGauge struct { *tview.Box + // maxValue value maxValue int // value is current value @@ -31,13 +32,13 @@ func NewPercentageModeGauge() *PercentageModeGauge { // Draw draws this primitive onto the screen. func (g *PercentageModeGauge) Draw(screen tcell.Screen) { - g.Box.DrawForSubclass(screen, g) + g.DrawForSubclass(screen, g) if g.maxValue == 0 { return } - x, y, width, height := g.Box.GetInnerRect() + x, y, width, height := g.GetInnerRect() pcWidth := 3 pc := g.value * gaugeMaxPc / g.maxValue pcString := fmt.Sprintf("%d%%", pc) @@ -71,7 +72,7 @@ func (g *PercentageModeGauge) Draw(screen tcell.Screen) { } // Focus is called when this primitive receives focus. -func (g *PercentageModeGauge) Focus(delegate func(p tview.Primitive)) { //nolint:revive +func (g *PercentageModeGauge) Focus(delegate func(p tview.Primitive)) { } // HasFocus returns whether or not this primitive has focus. diff --git a/vendor/github.com/navidys/tvxwidgets/gauge_um.go b/vendor/github.com/navidys/tvxwidgets/gauge_um.go index e810b993a..6af2eba96 100644 --- a/vendor/github.com/navidys/tvxwidgets/gauge_um.go +++ b/vendor/github.com/navidys/tvxwidgets/gauge_um.go @@ -10,6 +10,7 @@ import ( // UtilModeGauge represents utilisation mode gauge permitive. type UtilModeGauge struct { *tview.Box + // pc percentage value pc float64 // warn percentage value @@ -59,7 +60,7 @@ func (g *UtilModeGauge) SetLabelColor(color tcell.Color) { } // Focus is called when this primitive receives focus. -func (g *UtilModeGauge) Focus(delegate func(p tview.Primitive)) { //nolint:revive +func (g *UtilModeGauge) Focus(delegate func(p tview.Primitive)) { } // HasFocus returns whether or not this primitive has focus. @@ -91,8 +92,8 @@ func (g *UtilModeGauge) GetValue() float64 { // Draw draws this primitive onto the screen. func (g *UtilModeGauge) Draw(screen tcell.Screen) { - g.Box.DrawForSubclass(screen, g) - x, y, width, height := g.Box.GetInnerRect() + g.DrawForSubclass(screen, g) + x, y, width, height := g.GetInnerRect() labelPCWidth := 7 labelWidth := len(g.label) barWidth := width - labelPCWidth - labelWidth @@ -138,6 +139,11 @@ func (g *UtilModeGauge) SetCritPercentage(percentage float64) { } } +// SetEmptyColor sets empty gauge color. +func (g *UtilModeGauge) SetEmptyColor(color tcell.Color) { + g.emptyColor = color +} + func (g *UtilModeGauge) getBarColor(percentage float64) tcell.Color { if percentage < g.warnPc { return g.okColor @@ -147,8 +153,3 @@ func (g *UtilModeGauge) getBarColor(percentage float64) tcell.Color { return g.critColor } - -// SetEmptyColor sets empty gauge color. -func (g *UtilModeGauge) SetEmptyColor(color tcell.Color) { - g.emptyColor = color -} diff --git a/vendor/github.com/navidys/tvxwidgets/plot.go b/vendor/github.com/navidys/tvxwidgets/plot.go index efe45a5e9..2a085cbd0 100644 --- a/vendor/github.com/navidys/tvxwidgets/plot.go +++ b/vendor/github.com/navidys/tvxwidgets/plot.go @@ -16,7 +16,6 @@ import ( type Marker uint const ( - // plot marker. PlotMarkerBraille Marker = iota PlotMarkerDot ) @@ -54,6 +53,7 @@ type brailleCell struct { // Plot represents a plot primitive used for different charts. type Plot struct { *tview.Box + data [][]float64 // maxVal is the maximum y-axis (vertical) value found in any of the lines in the data set. maxVal float64 @@ -100,7 +100,7 @@ func NewPlot() *Plot { // Draw draws this primitive onto the screen. func (plot *Plot) Draw(screen tcell.Screen) { - plot.Box.DrawForSubclass(screen, plot) + plot.DrawForSubclass(screen, plot) switch plot.marker { case PlotMarkerDot: @@ -194,14 +194,17 @@ func (plot *Plot) SetData(data [][]float64) { } } +// SetMaxVal sets plot maximum value. func (plot *Plot) SetMaxVal(maxVal float64) { plot.maxVal = maxVal } +// SetMinVal sets plot minimum value. func (plot *Plot) SetMinVal(minVal float64) { plot.minVal = minVal } +// SetYRange sets plot Y range. func (plot *Plot) SetYRange(minVal float64, maxVal float64) { plot.minVal = minVal plot.maxVal = maxVal @@ -212,14 +215,9 @@ func (plot *Plot) SetDotMarkerRune(r rune) { plot.dotMarkerRune = r } -// Figure out the text width necessary to display the largest data value. -func (plot *Plot) getYAxisLabelsWidth() int { - return len(fmt.Sprintf("%.2f", plot.maxVal)) -} - // GetPlotRect returns the rect for the inner part of the plot, ie not including axes. func (plot *Plot) GetPlotRect() (int, int, int, int) { - x, y, width, height := plot.Box.GetInnerRect() + x, y, width, height := plot.GetInnerRect() plotYAxisLabelsWidth := plot.getYAxisLabelsWidth() if plot.drawAxes { @@ -234,6 +232,11 @@ func (plot *Plot) GetPlotRect() (int, int, int, int) { return x, y, width, height } +// Figure out the text width necessary to display the largest data value. +func (plot *Plot) getYAxisLabelsWidth() int { + return len(fmt.Sprintf("%.2f", plot.maxVal)) +} + func (plot *Plot) getData() [][]float64 { plot.mu.Lock() data := plot.data @@ -247,7 +250,7 @@ func (plot *Plot) drawAxesToScreen(screen tcell.Screen) { return } - x, y, width, height := plot.Box.GetInnerRect() + x, y, width, height := plot.GetInnerRect() plotYAxisLabelsWidth := plot.getYAxisLabelsWidth() axesStyle := tcell.StyleDefault.Background(plot.GetBackgroundColor()).Foreground(plot.axesColor) diff --git a/vendor/github.com/navidys/tvxwidgets/sparkline.go b/vendor/github.com/navidys/tvxwidgets/sparkline.go index 7b2d8ef22..493c752ed 100644 --- a/vendor/github.com/navidys/tvxwidgets/sparkline.go +++ b/vendor/github.com/navidys/tvxwidgets/sparkline.go @@ -8,7 +8,7 @@ import ( "github.com/rivo/tview" ) -// Spartline represents a sparkline widgets. +// Sparkline represents a sparkline widgets. type Sparkline struct { *tview.Box @@ -28,9 +28,9 @@ func NewSparkline() *Sparkline { // Draw draws this primitive onto the screen. func (sl *Sparkline) Draw(screen tcell.Screen) { - sl.Box.DrawForSubclass(screen, sl) + sl.DrawForSubclass(screen, sl) - x, y, width, height := sl.Box.GetInnerRect() + x, y, width, height := sl.GetInnerRect() barHeight := height // print label diff --git a/vendor/github.com/navidys/tvxwidgets/spinner.go b/vendor/github.com/navidys/tvxwidgets/spinner.go index c211f2e65..50833bc93 100644 --- a/vendor/github.com/navidys/tvxwidgets/spinner.go +++ b/vendor/github.com/navidys/tvxwidgets/spinner.go @@ -15,6 +15,7 @@ type Spinner struct { styles map[SpinnerStyle][]rune } +// SpinnerStyle spinner style. type SpinnerStyle int const ( @@ -63,8 +64,8 @@ func NewSpinner() *Spinner { // Draw draws this primitive onto the screen. func (s *Spinner) Draw(screen tcell.Screen) { - s.Box.DrawForSubclass(screen, s) - x, y, width, _ := s.Box.GetInnerRect() + s.DrawForSubclass(screen, s) + x, y, width, _ := s.GetInnerRect() tview.Print(screen, s.getCurrentFrame(), x, y, width, tview.AlignLeft, tcell.ColorDefault) } @@ -85,6 +86,14 @@ func (s *Spinner) SetStyle(style SpinnerStyle) *Spinner { return s } +// SetCustomStyle sets a list of runes as custom frames to show as the spinner. +func (s *Spinner) SetCustomStyle(frames []rune) *Spinner { + s.styles[spinnerCustom] = frames + s.currentStyle = spinnerCustom + + return s +} + func (s *Spinner) getCurrentFrame() string { frames := s.styles[s.currentStyle] if len(frames) == 0 { @@ -93,11 +102,3 @@ func (s *Spinner) getCurrentFrame() string { return string(frames[s.counter%len(frames)]) } - -// SetCustomStyle sets a list of runes as custom frames to show as the spinner. -func (s *Spinner) SetCustomStyle(frames []rune) *Spinner { - s.styles[spinnerCustom] = frames - s.currentStyle = spinnerCustom - - return s -} diff --git a/vendor/github.com/navidys/tvxwidgets/utils.go b/vendor/github.com/navidys/tvxwidgets/utils.go index 454f17d19..a9ac3a6e3 100644 --- a/vendor/github.com/navidys/tvxwidgets/utils.go +++ b/vendor/github.com/navidys/tvxwidgets/utils.go @@ -166,11 +166,12 @@ func absInt(x int) int { } func drawLine(screen tcell.Screen, startX int, startY int, length int, mode drawLineMode, style tcell.Style) { - if mode == horizontalLine { + switch mode { + case horizontalLine: for i := range length { tview.PrintJoinedSemigraphics(screen, startX+i, startY, tview.BoxDrawingsLightTripleDashHorizontal, style) } - } else if mode == verticalLine { + case verticalLine: for i := range length { tview.PrintJoinedSemigraphics(screen, startX, startY+i, tview.BoxDrawingsLightTripleDashVertical, style) } diff --git a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md index 9d1bb914b..dd35aa1c2 100644 --- a/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md +++ b/vendor/github.com/onsi/ginkgo/v2/CHANGELOG.md @@ -1,3 +1,13 @@ +## 2.27.5 + +### Fixes +Don't make a new formatter for each GinkgoT(); that's just silly and uses precious memory + +## 2.27.4 + +### Fixes +- CurrentTreeConstructionNodeReport: fix for nested container nodes [59bc751] + ## 2.27.3 ### Fixes diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/suite.go b/vendor/github.com/onsi/ginkgo/v2/internal/suite.go index ef76cd099..9d5f59001 100644 --- a/vendor/github.com/onsi/ginkgo/v2/internal/suite.go +++ b/vendor/github.com/onsi/ginkgo/v2/internal/suite.go @@ -208,9 +208,12 @@ func (suite *Suite) PushNode(node Node) error { // Ensure that code running in the body of the container node // has access to information about the current container node(s). + // The current one (nil in top-level container nodes, non-nil in an + // embedded container node) gets restored when the node is done. + oldConstructionNodeReport := suite.currentConstructionNodeReport suite.currentConstructionNodeReport = constructionNodeReportForTreeNode(suite.tree) defer func() { - suite.currentConstructionNodeReport = nil + suite.currentConstructionNodeReport = oldConstructionNodeReport }() node.Body(nil) diff --git a/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go b/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go index 9806e315a..5704f0fdf 100644 --- a/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go +++ b/vendor/github.com/onsi/ginkgo/v2/internal/testingtproxy/testing_t_proxy.go @@ -27,6 +27,11 @@ type ginkgoWriterInterface interface { type ginkgoRecoverFunc func() type attachProgressReporterFunc func(func() string) func() +var formatters = map[bool]formatter.Formatter{ + true: formatter.NewWithNoColorBool(true), + false: formatter.NewWithNoColorBool(false), +} + func New(writer ginkgoWriterInterface, fail failFunc, skip skipFunc, cleanup cleanupFunc, report reportFunc, addReportEntry addReportEntryFunc, ginkgoRecover ginkgoRecoverFunc, attachProgressReporter attachProgressReporterFunc, randomSeed int64, parallelProcess int, parallelTotal int, noColor bool, offset int) *ginkgoTestingTProxy { return &ginkgoTestingTProxy{ fail: fail, @@ -41,7 +46,7 @@ func New(writer ginkgoWriterInterface, fail failFunc, skip skipFunc, cleanup cle randomSeed: randomSeed, parallelProcess: parallelProcess, parallelTotal: parallelTotal, - f: formatter.NewWithNoColorBool(noColor), + f: formatters[noColor], //minimize allocations by reusing formatters } } diff --git a/vendor/github.com/onsi/ginkgo/v2/types/version.go b/vendor/github.com/onsi/ginkgo/v2/types/version.go index 2a5019287..72fb8ec30 100644 --- a/vendor/github.com/onsi/ginkgo/v2/types/version.go +++ b/vendor/github.com/onsi/ginkgo/v2/types/version.go @@ -1,3 +1,3 @@ package types -const VERSION = "2.27.3" +const VERSION = "2.27.5" diff --git a/vendor/github.com/onsi/gomega/CHANGELOG.md b/vendor/github.com/onsi/gomega/CHANGELOG.md index b7d7309f3..cf020605c 100644 --- a/vendor/github.com/onsi/gomega/CHANGELOG.md +++ b/vendor/github.com/onsi/gomega/CHANGELOG.md @@ -1,3 +1,14 @@ +## 1.39.0 + +### Features + +Add `MatchErrorStrictly` which only passes if `errors.Is(actual, expected)` returns true. `MatchError`, by contrast, will fallback to string comparison. + +## 1.38.3 + +### Fixes +make string formatitng more consistent for users who use format.Object directly + ## 1.38.2 - roll back to go 1.23.0 [c404969] diff --git a/vendor/github.com/onsi/gomega/format/format.go b/vendor/github.com/onsi/gomega/format/format.go index 96f04b210..6c23ba338 100644 --- a/vendor/github.com/onsi/gomega/format/format.go +++ b/vendor/github.com/onsi/gomega/format/format.go @@ -262,7 +262,7 @@ func Object(object any, indentation uint) string { if err, ok := object.(error); ok && !isNilValue(value) { // isNilValue check needed here to avoid nil deref due to boxed nil commonRepresentation += "\n" + IndentString(err.Error(), indentation) + "\n" + indent } - return fmt.Sprintf("%s<%s>: %s%s", indent, formatType(value), commonRepresentation, formatValue(value, indentation)) + return fmt.Sprintf("%s<%s>: %s%s", indent, formatType(value), commonRepresentation, formatValue(value, indentation, true)) } /* @@ -306,7 +306,7 @@ func formatType(v reflect.Value) string { } } -func formatValue(value reflect.Value, indentation uint) string { +func formatValue(value reflect.Value, indentation uint, isTopLevel bool) string { if indentation > MaxDepth { return "..." } @@ -367,11 +367,11 @@ func formatValue(value reflect.Value, indentation uint) string { case reflect.Func: return fmt.Sprintf("0x%x", value.Pointer()) case reflect.Ptr: - return formatValue(value.Elem(), indentation) + return formatValue(value.Elem(), indentation, isTopLevel) case reflect.Slice: return truncateLongStrings(formatSlice(value, indentation)) case reflect.String: - return truncateLongStrings(formatString(value.String(), indentation)) + return truncateLongStrings(formatString(value.String(), indentation, isTopLevel)) case reflect.Array: return truncateLongStrings(formatSlice(value, indentation)) case reflect.Map: @@ -392,8 +392,8 @@ func formatValue(value reflect.Value, indentation uint) string { } } -func formatString(object any, indentation uint) string { - if indentation == 1 { +func formatString(object any, indentation uint, isTopLevel bool) string { + if isTopLevel { s := fmt.Sprintf("%s", object) components := strings.Split(s, "\n") result := "" @@ -416,14 +416,14 @@ func formatString(object any, indentation uint) string { func formatSlice(v reflect.Value, indentation uint) string { if v.Kind() == reflect.Slice && v.Type().Elem().Kind() == reflect.Uint8 && isPrintableString(string(v.Bytes())) { - return formatString(v.Bytes(), indentation) + return formatString(v.Bytes(), indentation, false) } l := v.Len() result := make([]string, l) longest := 0 - for i := 0; i < l; i++ { - result[i] = formatValue(v.Index(i), indentation+1) + for i := range l { + result[i] = formatValue(v.Index(i), indentation+1, false) if len(result[i]) > longest { longest = len(result[i]) } @@ -443,7 +443,7 @@ func formatMap(v reflect.Value, indentation uint) string { longest := 0 for i, key := range v.MapKeys() { value := v.MapIndex(key) - result[i] = fmt.Sprintf("%s: %s", formatValue(key, indentation+1), formatValue(value, indentation+1)) + result[i] = fmt.Sprintf("%s: %s", formatValue(key, indentation+1, false), formatValue(value, indentation+1, false)) if len(result[i]) > longest { longest = len(result[i]) } @@ -462,10 +462,10 @@ func formatStruct(v reflect.Value, indentation uint) string { l := v.NumField() result := []string{} longest := 0 - for i := 0; i < l; i++ { + for i := range l { structField := t.Field(i) fieldEntry := v.Field(i) - representation := fmt.Sprintf("%s: %s", structField.Name, formatValue(fieldEntry, indentation+1)) + representation := fmt.Sprintf("%s: %s", structField.Name, formatValue(fieldEntry, indentation+1, false)) result = append(result, representation) if len(representation) > longest { longest = len(representation) @@ -479,7 +479,7 @@ func formatStruct(v reflect.Value, indentation uint) string { } func formatInterface(v reflect.Value, indentation uint) string { - return fmt.Sprintf("<%s>%s", formatType(v.Elem()), formatValue(v.Elem(), indentation)) + return fmt.Sprintf("<%s>%s", formatType(v.Elem()), formatValue(v.Elem(), indentation, false)) } func isNilValue(a reflect.Value) bool { diff --git a/vendor/github.com/onsi/gomega/gomega_dsl.go b/vendor/github.com/onsi/gomega/gomega_dsl.go index fdba34ee9..cd6ce450f 100644 --- a/vendor/github.com/onsi/gomega/gomega_dsl.go +++ b/vendor/github.com/onsi/gomega/gomega_dsl.go @@ -22,7 +22,7 @@ import ( "github.com/onsi/gomega/types" ) -const GOMEGA_VERSION = "1.38.2" +const GOMEGA_VERSION = "1.39.0" const nilGomegaPanic = `You are trying to make an assertion, but haven't registered Gomega's fail handler. If you're using Ginkgo then you probably forgot to put your assertion in an It(). diff --git a/vendor/github.com/onsi/gomega/matchers.go b/vendor/github.com/onsi/gomega/matchers.go index 10b6693fd..16ca8f46d 100644 --- a/vendor/github.com/onsi/gomega/matchers.go +++ b/vendor/github.com/onsi/gomega/matchers.go @@ -146,6 +146,24 @@ func MatchError(expected any, functionErrorDescription ...any) types.GomegaMatch } } +// MatchErrorStrictly succeeds iff actual is a non-nil error that matches the passed in +// expected error according to errors.Is(actual, expected). +// +// This behavior differs from MatchError where +// +// Expect(errors.New("some error")).To(MatchError(errors.New("some error"))) +// +// succeeds, but errors.Is would return false so: +// +// Expect(errors.New("some error")).To(MatchErrorStrictly(errors.New("some error"))) +// +// fails. +func MatchErrorStrictly(expected error) types.GomegaMatcher { + return &matchers.MatchErrorStrictlyMatcher{ + Expected: expected, + } +} + // BeClosed succeeds if actual is a closed channel. // It is an error to pass a non-channel to BeClosed, it is also an error to pass nil // @@ -515,8 +533,8 @@ func HaveExistingField(field string) types.GomegaMatcher { // and even interface values. // // actual := 42 -// Expect(actual).To(HaveValue(42)) -// Expect(&actual).To(HaveValue(42)) +// Expect(actual).To(HaveValue(Equal(42))) +// Expect(&actual).To(HaveValue(Equal(42))) func HaveValue(matcher types.GomegaMatcher) types.GomegaMatcher { return &matchers.HaveValueMatcher{ Matcher: matcher, diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go index 9e16dcf5d..16630c18e 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_matcher.go @@ -39,7 +39,7 @@ func (matcher *HaveKeyMatcher) Match(actual any) (success bool, err error) { } keys := reflect.ValueOf(actual).MapKeys() - for i := 0; i < len(keys); i++ { + for i := range keys { success, err := keyMatcher.Match(keys[i].Interface()) if err != nil { return false, fmt.Errorf("HaveKey's key matcher failed with:\n%s%s", format.Indent, err.Error()) diff --git a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go index 1c53f1e56..0cd708153 100644 --- a/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go +++ b/vendor/github.com/onsi/gomega/matchers/have_key_with_value_matcher.go @@ -52,7 +52,7 @@ func (matcher *HaveKeyWithValueMatcher) Match(actual any) (success bool, err err } keys := reflect.ValueOf(actual).MapKeys() - for i := 0; i < len(keys); i++ { + for i := range keys { success, err := keyMatcher.Match(keys[i].Interface()) if err != nil { return false, fmt.Errorf("HaveKeyWithValue's key matcher failed with:\n%s%s", format.Indent, err.Error()) diff --git a/vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go b/vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go new file mode 100644 index 000000000..63969b266 --- /dev/null +++ b/vendor/github.com/onsi/gomega/matchers/match_error_strictly_matcher.go @@ -0,0 +1,39 @@ +package matchers + +import ( + "errors" + "fmt" + + "github.com/onsi/gomega/format" +) + +type MatchErrorStrictlyMatcher struct { + Expected error +} + +func (matcher *MatchErrorStrictlyMatcher) Match(actual any) (success bool, err error) { + + if isNil(matcher.Expected) { + return false, fmt.Errorf("Expected error is nil, use \"ToNot(HaveOccurred())\" to explicitly check for nil errors") + } + + if isNil(actual) { + return false, fmt.Errorf("Expected an error, got nil") + } + + if !isError(actual) { + return false, fmt.Errorf("Expected an error. Got:\n%s", format.Object(actual, 1)) + } + + actualErr := actual.(error) + + return errors.Is(actualErr, matcher.Expected), nil +} + +func (matcher *MatchErrorStrictlyMatcher) FailureMessage(actual any) (message string) { + return format.Message(actual, "to match error", matcher.Expected) +} + +func (matcher *MatchErrorStrictlyMatcher) NegatedFailureMessage(actual any) (message string) { + return format.Message(actual, "not to match error", matcher.Expected) +} diff --git a/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go b/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go index 8c38411b2..72edba20f 100644 --- a/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go +++ b/vendor/github.com/onsi/gomega/matchers/support/goraph/edge/edge.go @@ -1,6 +1,9 @@ package edge -import . "github.com/onsi/gomega/matchers/support/goraph/node" +import ( + . "github.com/onsi/gomega/matchers/support/goraph/node" + "slices" +) type Edge struct { Node1 int @@ -20,13 +23,7 @@ func (ec EdgeSet) Free(node Node) bool { } func (ec EdgeSet) Contains(edge Edge) bool { - for _, e := range ec { - if e == edge { - return true - } - } - - return false + return slices.Contains(ec, edge) } func (ec EdgeSet) FindByNodes(node1, node2 Node) (Edge, bool) { diff --git a/vendor/github.com/rivo/tview/README.md b/vendor/github.com/rivo/tview/README.md index 75e4bac22..245f9b856 100644 --- a/vendor/github.com/rivo/tview/README.md +++ b/vendor/github.com/rivo/tview/README.md @@ -140,6 +140,7 @@ For a presentation highlighting this package, compile and run the program found - [chiko: Ultimate Beauty TUI gRPC Client](https://github.com/felangga/chiko) - [kmip-explorer: Browse & manage your KMIP objects from the terminal](https://github.com/phsym/kmip-explorer) - [stui: Slurm TUI for managing HPC clusters](https://github.com/antvirf/stui) +- [nerdlog: Fast, remote-first, multi-host log viewer with timeline histogram](https://github.com/dimonomid/nerdlog) ## Documentation @@ -153,9 +154,9 @@ This package is based on [github.com/gdamore/tcell](https://github.com/gdamore/t [Become a Sponsor on GitHub](https://github.com/sponsors/rivo?metadata_source=tview_readme) to further this project! -## Versioning and Backwards-Compatibility +## Backwards-Compatibility -I try really hard to keep this project backwards compatible. Your software should not break when you upgrade `tview`. But this also means that some of its shortcomings that were present in the initial versions will remain. In addition, at least for the time being, you won't find any version tags in this repo. The newest version should be the one to upgrade to. It has all the bugfixes and latest features. Having said that, backwards compatibility may still break when: +I try really hard to keep this project backwards compatible. Your software should not break when you upgrade `tview`. But this also means that some of its shortcomings that were present in the initial versions will remain. Having said that, backwards compatibility may still break when: - a new version of an imported package (most likely [`tcell`](https://github.com/gdamore/tcell)) changes in such a way that forces me to make changes in `tview` as well, - I fix something that I consider a bug, rather than a feature, something that does not work as originally intended, diff --git a/vendor/github.com/rivo/tview/ansi.go b/vendor/github.com/rivo/tview/ansi.go index 1b7d2e3c1..53bccd109 100644 --- a/vendor/github.com/rivo/tview/ansi.go +++ b/vendor/github.com/rivo/tview/ansi.go @@ -95,11 +95,9 @@ func (a *ansi) Write(text []byte) (int, error) { fields := strings.Split(params, ";") if len(params) == 0 || fields[0] == "" || fields[0] == "0" { // Reset. - a.attributes = "" - if _, err := a.buffer.WriteString("[-:-:-]"); err != nil { - return 0, err - } - break + foreground = "-" + background = "-" + a.attributes = "-" } lookupColor := func(colorNumber int) string { if colorNumber < 0 || colorNumber > 15 { @@ -232,6 +230,9 @@ func (a *ansi) Write(text []byte) (int, error) { } } var colon string + if len(a.attributes) > 1 && a.attributes[0] == '-' { + a.attributes = a.attributes[1:] + } if len(a.attributes) > 0 { colon = ":" } diff --git a/vendor/github.com/rivo/tview/application.go b/vendor/github.com/rivo/tview/application.go index 6e6666b1d..3c5fde846 100644 --- a/vendor/github.com/rivo/tview/application.go +++ b/vendor/github.com/rivo/tview/application.go @@ -77,6 +77,10 @@ type Application struct { // Fini(), to set a new screen (or nil to stop the application). screen tcell.Screen + // The application's title. If not empty, it will be set on every new screen + // that is added. + title string + // The primitive which currently has the keyboard focus. focus Primitive @@ -187,7 +191,9 @@ func (a *Application) GetMouseCapture() func(event *tcell.EventMouse, action Mou // SetScreen allows you to provide your own tcell.Screen object. For most // applications, this is not needed and you should be familiar with -// tcell.Screen when using this function. +// tcell.Screen when using this function. As the tcell.Screen interface may +// change in the future, you may need to update your code when this package +// updates to a new tcell version. // // This function is typically called before the first call to Run(). Init() need // not be called on the screen. @@ -214,6 +220,19 @@ func (a *Application) SetScreen(screen tcell.Screen) *Application { return a } +// SetTitle sets the title of the terminal window, to the extent that the +// terminal supports it. A non-empty title will be set on every new tcell.Screen +// that is created by or added to this application. +func (a *Application) SetTitle(title string) *Application { + a.Lock() + defer a.Unlock() + a.title = title + if a.screen != nil { + a.screen.SetTitle(title) + } + return a +} + // EnableMouse enables mouse events or disables them (if "false" is provided). func (a *Application) EnableMouse(enable bool) *Application { a.Lock() @@ -286,6 +305,9 @@ func (a *Application) Run() error { } else { a.screen.DisablePaste() } + if a.title != "" { + a.screen.SetTitle(a.title) + } } // We catch panics to clean up because they mess up the terminal. @@ -354,6 +376,9 @@ func (a *Application) Run() error { } else { screen.DisablePaste() } + if a.title != "" { + screen.SetTitle(a.title) + } a.draw() } }() diff --git a/vendor/github.com/rivo/tview/box.go b/vendor/github.com/rivo/tview/box.go index 04ce08523..c05994cc5 100644 --- a/vendor/github.com/rivo/tview/box.go +++ b/vendor/github.com/rivo/tview/box.go @@ -314,7 +314,7 @@ func (b *Box) SetBorderColor(color tcell.Color) *Box { // SetBorderAttributes sets the border's style attributes. You can combine // different attributes using bitmask operations: // -// box.SetBorderAttributes(tcell.AttrUnderline | tcell.AttrBold) +// box.SetBorderAttributes(tcell.AttrItalic | tcell.AttrBold) func (b *Box) SetBorderAttributes(attr tcell.AttrMask) *Box { b.borderStyle = b.borderStyle.Attributes(attr) return b diff --git a/vendor/github.com/rivo/tview/doc.go b/vendor/github.com/rivo/tview/doc.go index bfefa03a1..b4ddbc664 100644 --- a/vendor/github.com/rivo/tview/doc.go +++ b/vendor/github.com/rivo/tview/doc.go @@ -65,7 +65,7 @@ Throughout this package, styles are specified using the [tcell.Style] type. Styles specify colors with the [tcell.Color] type. Functions such as [tcell.GetColor], [tcell.NewHexColor], and [tcell.NewRGBColor] can be used to create colors from W3C color names or RGB values. The [tcell.Style] type also -allows you to specify text attributes such as "bold" or "underline" or a URL +allows you to specify text attributes such as "bold" or "italic" or a URL which some terminals use to display hyperlinks. Almost all strings which are displayed may contain style tags. A style tag's diff --git a/vendor/github.com/rivo/tview/inputfield.go b/vendor/github.com/rivo/tview/inputfield.go index 2edc98d5f..f5439343b 100644 --- a/vendor/github.com/rivo/tview/inputfield.go +++ b/vendor/github.com/rivo/tview/inputfield.go @@ -542,14 +542,11 @@ func (i *InputField) InputHandler() func(event *tcell.EventKey, setFocus func(p var skipAutocomplete bool currentText := i.textArea.GetText() defer func() { - newText := i.textArea.GetText() - if newText != currentText { - if !skipAutocomplete { - i.Autocomplete() - } - if i.changed != nil { - i.changed(newText) - } + if skipAutocomplete { + return + } + if i.textArea.GetText() != currentText { + i.Autocomplete() } }() @@ -649,14 +646,11 @@ func (i *InputField) MouseHandler() func(action MouseAction, event *tcell.EventM var skipAutocomplete bool currentText := i.GetText() defer func() { - newText := i.GetText() - if newText != currentText { - if !skipAutocomplete { - i.Autocomplete() - } - if i.changed != nil { - i.changed(newText) - } + if skipAutocomplete { + return + } + if i.textArea.GetText() != currentText { + i.Autocomplete() } }() diff --git a/vendor/github.com/rivo/tview/pages.go b/vendor/github.com/rivo/tview/pages.go index 83410ada0..d2b6dbd3c 100644 --- a/vendor/github.com/rivo/tview/pages.go +++ b/vendor/github.com/rivo/tview/pages.go @@ -66,12 +66,12 @@ func (p *Pages) GetPageNames(visibleOnly bool) []string { // AddPage adds a new page with the given name and primitive. If there was // previously a page with the same name, it is overwritten. Leaving the name -// empty may cause conflicts in other functions so always specify a non-empty -// name. +// empty may cause conflicts in other functions so you should always specify a +// non-empty name. // // Visible pages will be drawn in the order they were added (unless that order // was changed in one of the other functions). If "resize" is set to true, the -// primitive will be set to the size available to the Pages primitive whenever +// primitive will be set to the size available to the [Pages] primitive whenever // the pages are drawn. func (p *Pages) AddPage(name string, item Primitive, resize, visible bool) *Pages { hasFocus := p.HasFocus() @@ -248,6 +248,17 @@ func (p *Pages) GetFrontPage() (name string, item Primitive) { return } +// GetPage returns the page with the given name. If no such page exists, nil is +// returned. +func (p *Pages) GetPage(name string) Primitive { + for _, page := range p.pages { + if page.Name == name { + return page.Item + } + } + return nil +} + // HasFocus returns whether or not this primitive has focus. func (p *Pages) HasFocus() bool { for _, page := range p.pages { diff --git a/vendor/github.com/rivo/tview/strings.go b/vendor/github.com/rivo/tview/strings.go index 81c6a7112..1c13fe233 100644 --- a/vendor/github.com/rivo/tview/strings.go +++ b/vendor/github.com/rivo/tview/strings.go @@ -254,7 +254,6 @@ func parseTag(str string, state *stepState) (length int, style tcell.Style, regi // Attribute map. attrs := map[byte]tcell.AttrMask{ 'B': tcell.AttrBold, - 'U': tcell.AttrUnderline, 'I': tcell.AttrItalic, 'L': tcell.AttrBlink, 'D': tcell.AttrDim, @@ -284,17 +283,18 @@ func parseTag(str string, state *stepState) (length int, style tcell.Style, regi return } case tagStateStart: - if ch == '"' { // Start of a region tag. + switch { + case ch == '"': // Start of a region tag. tempStr.Reset() tagState = tagStateRegionStart - } else if !isOneOf(ch, "#:-") { // Invalid style tag. + case !isOneOf(ch, "#:-"): // Invalid style tag. return - } else if ch == '-' { // Reset foreground color. + case ch == '-': // Reset foreground color. tStyle = tStyle.Foreground(state.initialForeground) tagState = tagStateEndForeground - } else if ch == ':' { // No foreground color. + case ch == ':': // No foreground color. tagState = tagStateStartBackground - } else { + default: tempStr.Reset() tempStr.WriteByte(ch) if ch == '#' { // Numeric foreground color. @@ -304,11 +304,12 @@ func parseTag(str string, state *stepState) (length int, style tcell.Style, regi } } case tagStateEndForeground: - if ch == ']' { // End of tag. + switch ch { + case ']': // End of tag. tagState = tagStateDoneTag - } else if ch == ':' { + case ':': tagState = tagStateStartBackground - } else { // Invalid tag. + default: // Invalid tag. return } case tagStateNumericForeground: @@ -318,14 +319,15 @@ func parseTag(str string, state *stepState) (length int, style tcell.Style, regi } tStyle = tStyle.Foreground(tcell.GetColor(tempStr.String())) } - if ch == ']' { // End of tag. + switch { + case ch == ']': // End of tag. tagState = tagStateDoneTag - } else if ch == ':' { // Start of background color. + case ch == ':': // Start of background color. tagState = tagStateStartBackground - } else if strings.IndexByte("0123456789abcdefABCDEF", ch) >= 0 { // Hex digit. + case strings.IndexByte("0123456789abcdefABCDEF", ch) >= 0: // Hex digit. tempStr.WriteByte(ch) tagState = tagStateNumericForeground - } else { // Invalid tag. + default: // Invalid tag. return } case tagStateNameForeground: @@ -336,26 +338,28 @@ func parseTag(str string, state *stepState) (length int, style tcell.Style, regi } tStyle = tStyle.Foreground(tcell.ColorNames[name]) } - if !isOneOf(ch, "]:") { // Invalid tag. + switch { + case !isOneOf(ch, "]:"): // Invalid tag. return - } else if ch == ']' { // End of tag. + case ch == ']': // End of tag. tagState = tagStateDoneTag - } else if ch == ':' { // Start of background color. + case ch == ':': // Start of background color. tagState = tagStateStartBackground - } else { // Letters or numbers. + default: // Letters or numbers. tempStr.WriteByte(ch) } case tagStateStartBackground: - if !isOneOf(ch, "#:-]") { // Invalid style tag. + switch { + case !isOneOf(ch, "#:-]"): // Invalid style tag. return - } else if ch == ']' { // End of tag. + case ch == ']': // End of tag. tagState = tagStateDoneTag - } else if ch == '-' { // Reset background color. + case ch == '-': // Reset background color. tStyle = tStyle.Background(state.initialBackground) tagState = tagStateEndBackground - } else if ch == ':' { // No background color. + case ch == ':': // No background color. tagState = tagStateStartAttributes - } else { + default: tempStr.Reset() tempStr.WriteByte(ch) if ch == '#' { // Numeric background color. @@ -365,11 +369,12 @@ func parseTag(str string, state *stepState) (length int, style tcell.Style, regi } } case tagStateEndBackground: - if ch == ']' { // End of tag. + switch ch { + case ']': // End of tag. tagState = tagStateDoneTag - } else if ch == ':' { // Start of attributes. + case ':': // Start of attributes. tagState = tagStateStartAttributes - } else { // Invalid tag. + default: // Invalid tag. return } case tagStateNumericBackground: @@ -397,28 +402,30 @@ func parseTag(str string, state *stepState) (length int, style tcell.Style, regi } tStyle = tStyle.Background(tcell.ColorNames[name]) } - if !isOneOf(ch, "]:") { // Invalid tag. + switch { + case !isOneOf(ch, "]:"): // Invalid tag. return - } else if ch == ']' { // End of tag. + case ch == ']': // End of tag. tagState = tagStateDoneTag - } else if ch == ':' { // Start of background color. + case ch == ':': // Start of background color. tagState = tagStateStartAttributes - } else { // Letters or numbers. + default: // Letters or numbers. tempStr.WriteByte(ch) } case tagStateStartAttributes: - if ch == ']' { // End of tag. + switch { + case ch == ']': // End of tag. tagState = tagStateDoneTag - } else if ch == '-' { // Reset attributes. + case ch == '-': // Reset attributes. tStyle = tStyle.Attributes(state.initialAttributes) tagState = tagStateEndAttributes - } else if ch == ':' { // Start of URL. + case ch == ':': // Start of URL. tagState = tagStateStartURL - } else if strings.IndexByte("buildsrBUILDSR", ch) >= 0 { // Attribute tag. + case strings.IndexByte("buildsrBUILDSR", ch) >= 0: // Attribute tag. tempStr.Reset() tempStr.WriteByte(ch) tagState = tagStateAttributes - } else { // Invalid tag. + default: // Invalid tag. return } case tagStateAttributes: @@ -427,38 +434,46 @@ func parseTag(str string, state *stepState) (length int, style tcell.Style, regi _, _, a := tStyle.Decompose() for index := 0; index < len(flags); index++ { ch := flags[index] - if ch >= 'a' && ch <= 'z' { + switch { + case ch == 'u': + tStyle = tStyle.Underline(true) + case ch == 'U': + tStyle = tStyle.Underline(false) + case ch >= 'a' && ch <= 'z': a |= attrs[ch-('a'-'A')] - } else { + default: a &^= attrs[ch] } } tStyle = tStyle.Attributes(a) } - if ch == ']' { // End of tag. + switch { + case ch == ']': // End of tag. tagState = tagStateDoneTag - } else if ch == ':' { // Start of URL. + case ch == ':': // Start of URL. tagState = tagStateStartURL - } else if strings.IndexByte("buildsrBUILDSR", ch) >= 0 { // Attribute tag. + case strings.IndexByte("buildsrBUILDSR", ch) >= 0: // Attribute tag. tempStr.WriteByte(ch) - } else { // Invalid tag. + default: // Invalid tag. return } case tagStateEndAttributes: - if ch == ']' { // End of tag. + switch ch { + case ']': // End of tag. tagState = tagStateDoneTag - } else if ch == ':' { // Start of URL. + case ':': // Start of URL. tagState = tagStateStartURL - } else { // Invalid tag. + default: // Invalid tag. return } case tagStateStartURL: - if ch == ']' { // End of tag. + switch ch { + case ']': // End of tag. tagState = tagStateDoneTag - } else if ch == '-' { // Reset URL. + case '-': // Reset URL. tStyle = tStyle.Url("").UrlId("") tagState = tagStateEndURL - } else { // URL character. + default: // URL character. tempStr.Reset() tempStr.WriteByte(ch) tStyle = tStyle.UrlId(strconv.Itoa(int(rand.Uint32()))) // Generate a unique ID for this URL. @@ -478,12 +493,13 @@ func parseTag(str string, state *stepState) (length int, style tcell.Style, regi tempStr.WriteByte(ch) } case tagStateRegionStart: - if ch == '"' { // End of region tag. + switch { + case ch == '"': // End of region tag. tagState = tagStateRegionEnd - } else if isOneOf(ch, "_,;: -.") { // Region name. + case isOneOf(ch, "_,;: -."): // Region name. tempStr.WriteByte(ch) tagState = tagStateRegionName - } else { // Invalid tag. + default: // Invalid tag. return } case tagStateRegionEnd: @@ -494,11 +510,12 @@ func parseTag(str string, state *stepState) (length int, style tcell.Style, regi return } case tagStateRegionName: - if ch == '"' { // End of region tag. + switch { + case ch == '"': // End of region tag. tagState = tagStateRegionEnd - } else if isOneOf(ch, "_,;: -.") { // Region name. + case isOneOf(ch, "_,;: -."): // Region name. tempStr.WriteByte(ch) - } else { // Invalid tag. + default: // Invalid tag. return } } diff --git a/vendor/github.com/rivo/tview/table.go b/vendor/github.com/rivo/tview/table.go index 2dd88029b..c04fc4003 100644 --- a/vendor/github.com/rivo/tview/table.go +++ b/vendor/github.com/rivo/tview/table.go @@ -155,7 +155,7 @@ func (c *TableCell) SetTransparency(transparent bool) *TableCell { // SetAttributes sets the cell's text attributes. You can combine different // attributes using bitmask operations: // -// cell.SetAttributes(tcell.AttrUnderline | tcell.AttrBold) +// cell.SetAttributes(tcell.AttrItalic | tcell.AttrBold) func (c *TableCell) SetAttributes(attr tcell.AttrMask) *TableCell { if c.Style == tcell.StyleDefault { c.Attributes = attr @@ -1474,6 +1474,7 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi down = func() { if t.rowsSelectable { + row, column := t.selectedRow, t.selectedColumn t.selectedRow++ if t.selectedRow >= rowCount { if t.wrapVertically { @@ -1482,7 +1483,6 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi t.selectedRow = rowCount - 1 } } - row, column := t.selectedRow, t.selectedColumn finalRow, finalColumn := rowCount-1, lastColumn if t.wrapVertically { finalRow = row @@ -1499,6 +1499,7 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi up = func() { if t.rowsSelectable { + row, column := t.selectedRow, t.selectedColumn t.selectedRow-- if t.selectedRow < 0 { if t.wrapVertically { @@ -1507,7 +1508,6 @@ func (t *Table) InputHandler() func(event *tcell.EventKey, setFocus func(p Primi t.selectedRow = 0 } } - row, column := t.selectedRow, t.selectedColumn finalRow, finalColumn := 0, 0 if t.wrapVertically { finalRow = row diff --git a/vendor/modules.txt b/vendor/modules.txt index 1ada0987e..8677b035f 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -30,7 +30,7 @@ github.com/fxamacker/cbor/v2 # github.com/gdamore/encoding v1.0.1 ## explicit; go 1.9 github.com/gdamore/encoding -# github.com/gdamore/tcell/v2 v2.13.7 +# github.com/gdamore/tcell/v2 v2.13.8 ## explicit; go 1.24.0 github.com/gdamore/tcell/v2 github.com/gdamore/tcell/v2/terminfo @@ -161,8 +161,8 @@ github.com/mwitkow/go-conntrack # github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f ## explicit github.com/mxk/go-flowrate/flowrate -# github.com/navidys/tvxwidgets v0.11.1 -## explicit; go 1.23.3 +# github.com/navidys/tvxwidgets v0.13.0 +## explicit; go 1.24.7 github.com/navidys/tvxwidgets # github.com/netobserv/flowlogs-pipeline v1.10.1-community ## explicit; go 1.24.0 @@ -184,7 +184,7 @@ github.com/netsampler/goflow2/decoders/sflow github.com/netsampler/goflow2/decoders/utils github.com/netsampler/goflow2/pb github.com/netsampler/goflow2/producer -# github.com/onsi/ginkgo/v2 v2.27.3 +# github.com/onsi/ginkgo/v2 v2.27.5 ## explicit; go 1.23.0 github.com/onsi/ginkgo/v2 github.com/onsi/ginkgo/v2/config @@ -208,7 +208,7 @@ github.com/onsi/ginkgo/v2/internal/reporters github.com/onsi/ginkgo/v2/internal/testingtproxy github.com/onsi/ginkgo/v2/reporters github.com/onsi/ginkgo/v2/types -# github.com/onsi/gomega v1.38.2 +# github.com/onsi/gomega v1.39.0 ## explicit; go 1.23.0 github.com/onsi/gomega github.com/onsi/gomega/format @@ -251,7 +251,7 @@ github.com/prometheus/common/model github.com/prometheus/procfs github.com/prometheus/procfs/internal/fs github.com/prometheus/procfs/internal/util -# github.com/rivo/tview v0.0.0-20250501113434-0c592cd31026 +# github.com/rivo/tview v0.42.0 ## explicit; go 1.18 github.com/rivo/tview # github.com/rivo/uniseg v0.4.7