From 0f9e38c9a7217bcd3d04b87c725c20047bc6aa64 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Wed, 27 Nov 2024 15:35:44 +0100 Subject: [PATCH 1/4] Don't render suggestions when textinput is not focused. This can look confusing in forms otherwise. --- textinput/textinput.go | 2 +- textinput/textinput_test.go | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/textinput/textinput.go b/textinput/textinput.go index 66e4518..1b44ab2 100644 --- a/textinput/textinput.go +++ b/textinput/textinput.go @@ -665,7 +665,7 @@ func (m Model) View() string { v += styleText(m.echoTransform(string(value[pos+1:]))) // text after cursor v += m.completionView(0) // suggested completion } else { - if m.canAcceptSuggestion() { + if m.focus && m.canAcceptSuggestion() { suggestion := m.matchedSuggestions[m.currentSuggestionIndex] if len(value) < len(suggestion) { m.Cursor.TextStyle = m.CompletionStyle diff --git a/textinput/textinput_test.go b/textinput/textinput_test.go index 95ef0c6..6c288ab 100644 --- a/textinput/textinput_test.go +++ b/textinput/textinput_test.go @@ -1,6 +1,7 @@ package textinput import ( + "strings" "testing" ) @@ -29,6 +30,11 @@ func Test_CurrentSuggestion(t *testing.T) { if suggestion != expected { t.Fatalf("Error: expected first suggestion but was %s", suggestion) } + + textinput.Blur() + if strings.HasSuffix(textinput.View(), "test2") { + t.Fatalf("Error: suggestions should not be rendered when input isn't focused. expected \"> test\" but got \"%s\"", textinput.View()) + } } func Test_SlicingOutsideCap(t *testing.T) { From 2f4944346fafb64706fb83d9bfdefea8e22e430c Mon Sep 17 00:00:00 2001 From: Charm <124303983+charmcli@users.noreply.github.com> Date: Thu, 13 Feb 2025 10:58:35 -0300 Subject: [PATCH 2/4] ci: sync dependabot config (#734) --- .github/dependabot.yml | 41 ++++++++++++++++++++------- .github/workflows/dependabot-sync.yml | 15 ++++++++++ 2 files changed, 46 insertions(+), 10 deletions(-) create mode 100644 .github/workflows/dependabot-sync.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9fc3b07..cbc9aa4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,20 +1,41 @@ version: 2 + updates: - package-ecosystem: "gomod" directory: "/" schedule: - interval: "daily" - labels: - - "dependencies" - commit-message: - prefix: "feat" - include: "scope" - - package-ecosystem: "github-actions" - directory: "/" - schedule: - interval: "daily" + interval: "weekly" + day: "monday" + time: "05:00" + timezone: "America/New_York" labels: - "dependencies" commit-message: prefix: "chore" include: "scope" + + - package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "05:00" + timezone: "America/New_York" + labels: + - "dependencies" + commit-message: + prefix: "chore" + include: "scope" + + - package-ecosystem: "docker" + directory: "/" + schedule: + interval: "weekly" + day: "monday" + time: "05:00" + timezone: "America/New_York" + labels: + - "dependencies" + commit-message: + prefix: "feat" + include: "scope" diff --git a/.github/workflows/dependabot-sync.yml b/.github/workflows/dependabot-sync.yml new file mode 100644 index 0000000..e5aa74e --- /dev/null +++ b/.github/workflows/dependabot-sync.yml @@ -0,0 +1,15 @@ +name: dependabot-sync +on: + schedule: + - cron: "0 0 * * 0" # every Sunday at midnight + workflow_dispatch: # allows manual triggering + +permissions: + contents: write + pull-requests: write + +jobs: + dependabot-sync: + uses: charmbracelet/meta/.github/workflows/dependabot-sync.yml@main + with: + repo_name: ${{ github.event.repository.name }} From 7a6b190840c8193adddce23afa79824aac6f3442 Mon Sep 17 00:00:00 2001 From: Charm <124303983+charmcli@users.noreply.github.com> Date: Thu, 13 Feb 2025 11:29:08 -0300 Subject: [PATCH 3/4] ci: sync dependabot config (#736) --- .github/workflows/dependabot-sync.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/dependabot-sync.yml b/.github/workflows/dependabot-sync.yml index e5aa74e..9b08259 100644 --- a/.github/workflows/dependabot-sync.yml +++ b/.github/workflows/dependabot-sync.yml @@ -13,3 +13,5 @@ jobs: uses: charmbracelet/meta/.github/workflows/dependabot-sync.yml@main with: repo_name: ${{ github.event.repository.name }} + secrets: + gh_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} From cdc743f1f4881343ebc57b3ae820d2dc03331acb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kotowski?= Date: Wed, 5 Mar 2025 07:40:00 +0100 Subject: [PATCH 4/4] chore(links): switch bubbletea links to use main MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cosmetic change. Old links used `master` as the main branch. Resulting in GitHub redirecting to the correct default branch and displaying: > Branch not found, redirected to default branch. Signed-off-by: Michał Kotowski --- README.md | 38 +++++++++++++++++++------------------- list/README.md | 6 +++--- 2 files changed, 22 insertions(+), 22 deletions(-) diff --git a/README.md b/README.md index dac05bd..c6a4efd 100644 --- a/README.md +++ b/README.md @@ -24,8 +24,8 @@ applications. These components are used in production in [Glow][glow], A spinner, useful for indicating that some kind an operation is happening. There are a couple default ones, but you can also pass your own ”frames.” -- [Example code, basic spinner](https://github.com/charmbracelet/bubbletea/tree/master/examples/spinner/main.go) -- [Example code, various spinners](https://github.com/charmbracelet/bubbletea/tree/master/examples/spinners/main.go) +- [Example code, basic spinner](https://github.com/charmbracelet/bubbletea/blob/main/examples/spinner/main.go) +- [Example code, various spinners](https://github.com/charmbracelet/bubbletea/blob/main/examples/spinners/main.go) ## Text Input @@ -35,8 +35,8 @@ A text input field, akin to an `` in HTML. Supports unicode, pasting, in-place scrolling when the value exceeds the width of the element and the common, and many customization options. -- [Example code, one field](https://github.com/charmbracelet/bubbletea/tree/master/examples/textinput/main.go) -- [Example code, many fields](https://github.com/charmbracelet/bubbletea/tree/master/examples/textinputs/main.go) +- [Example code, one field](https://github.com/charmbracelet/bubbletea/blob/main/examples/textinput/main.go) +- [Example code, many fields](https://github.com/charmbracelet/bubbletea/blob/main/examples/textinputs/main.go) ## Text Area @@ -47,8 +47,8 @@ spans multiple lines. Supports unicode, pasting, vertical scrolling when the value exceeds the width and height of the element, and many customization options. -- [Example code, chat input](https://github.com/charmbracelet/bubbletea/tree/master/examples/chat/main.go) -- [Example code, story time input](https://github.com/charmbracelet/bubbletea/tree/master/examples/textarea/main.go) +- [Example code, chat input](https://github.com/charmbracelet/bubbletea/blob/main/examples/chat/main.go) +- [Example code, story time input](https://github.com/charmbracelet/bubbletea/blob/main/examples/textarea/main.go) ## Table @@ -57,7 +57,7 @@ options. A component for displaying and navigating tabular data (columns and rows). Supports vertical scrolling and many customization options. -- [Example code, countries and populations](https://github.com/charmbracelet/bubbletea/tree/master/examples/table/main.go) +- [Example code, countries and populations](https://github.com/charmbracelet/bubbletea/blob/main/examples/table/main.go) ## Progress @@ -68,8 +68,8 @@ A simple, customizable progress meter, with optional animation via runes can be set to whatever you'd like. The percentage readout is customizable and can also be omitted entirely. -- [Animated example](https://github.com/charmbracelet/bubbletea/blob/master/examples/progress-animated/main.go) -- [Static example](https://github.com/charmbracelet/bubbletea/blob/master/examples/progress-static/main.go) +- [Animated example](https://github.com/charmbracelet/bubbletea/blob/main/examples/progress-animated/main.go) +- [Static example](https://github.com/charmbracelet/bubbletea/blob/main/examples/progress-static/main.go) [harmonica]: https://github.com/charmbracelet/harmonica @@ -82,7 +82,7 @@ Supports "dot-style" pagination (similar to what you might see on iOS) and numeric page numbering, but you could also just use this component for the logic and visualize pagination however you like. -- [Example code](https://github.com/charmbracelet/bubbletea/blob/master/examples/paginator/main.go) +- [Example code](https://github.com/charmbracelet/bubbletea/blob/main/examples/paginator/main.go) ## Viewport @@ -92,7 +92,7 @@ A viewport for vertically scrolling content. Optionally includes standard pager keybindings and mouse wheel support. A high performance mode is available for applications which make use of the alternate screen buffer. -- [Example code](https://github.com/charmbracelet/bubbletea/tree/master/examples/pager/main.go) +- [Example code](https://github.com/charmbracelet/bubbletea/blob/main/examples/pager/main.go) This component is well complemented with [Reflow][reflow] for ANSI-aware indenting and text wrapping. @@ -108,9 +108,9 @@ Features pagination, fuzzy filtering, auto-generated help, an activity spinner, and status messages, all of which can be enabled and disabled as needed. Extrapolated from [Glow][glow]. -- [Example code, default list](https://github.com/charmbracelet/bubbletea/tree/master/examples/list-default/main.go) -- [Example code, simple list](https://github.com/charmbracelet/bubbletea/tree/master/examples/list-simple/main.go) -- [Example code, all features](https://github.com/charmbracelet/bubbletea/tree/master/examples/list-fancy/main.go) +- [Example code, default list](https://github.com/charmbracelet/bubbletea/blob/main/examples/list-default/main.go) +- [Example code, simple list](https://github.com/charmbracelet/bubbletea/blob/main/examples/list-simple/main.go) +- [Example code, all features](https://github.com/charmbracelet/bubbletea/blob/main/examples/list-fancy/main.go) ## File Picker @@ -120,7 +120,7 @@ A customizable component for picking a file from the file system. Navigate through directories and select files, optionally limit to certain file extensions. -- [Example code](https://github.com/charmbracelet/bubbletea/tree/master/examples/file-picker/main.go) +- [Example code](https://github.com/charmbracelet/bubbletea/blob/main/examples/file-picker/main.go) ## Timer @@ -129,7 +129,7 @@ can be customized as you like. Timer example -- [Example code](https://github.com/charmbracelet/bubbletea/blob/master/examples/timer/main.go) +- [Example code](https://github.com/charmbracelet/bubbletea/blob/main/examples/timer/main.go) ## Stopwatch @@ -138,7 +138,7 @@ can be customized as you like. A simple, flexible component for counting up. The update frequency and output can be customized as you see fit. -- [Example code](https://github.com/charmbracelet/bubbletea/blob/master/examples/stopwatch/main.go) +- [Example code](https://github.com/charmbracelet/bubbletea/blob/main/examples/stopwatch/main.go) ## Help @@ -149,7 +149,7 @@ from your keybindings. It features single and multi-line modes, which the user can optionally toggle between. It will truncate gracefully if the terminal is too wide for the content. -- [Example code](https://github.com/charmbracelet/bubbletea/blob/master/examples/help/main.go) +- [Example code](https://github.com/charmbracelet/bubbletea/blob/main/examples/help/main.go) ## Key @@ -212,7 +212,7 @@ We’d love to hear your thoughts on this project. Feel free to drop us a note! ## License -[MIT](https://github.com/charmbracelet/bubbletea/raw/master/LICENSE) +[MIT](https://github.com/charmbracelet/bubbletea/raw/main/LICENSE) --- diff --git a/list/README.md b/list/README.md index ad073ed..7dac8e7 100644 --- a/list/README.md +++ b/list/README.md @@ -66,6 +66,6 @@ own `ItemDelegate` too ([example][customDelegate]). [kancli]: https://github.com/charmbracelet/kancli/blob/main/main.go#L45 [itemDelegate]: https://pkg.go.dev/github.com/charmbracelet/bubbles/list#ItemDelegate -[replacedLine]: https://github.com/charmbracelet/bubbletea/blob/master/examples/list-default/main.go#L77 -[listDefault]: https://github.com/charmbracelet/bubbletea/tree/master/examples/list-default -[customDelegate]: https://github.com/charmbracelet/bubbletea/blob/master/examples/list-simple/main.go#L29-L50 +[replacedLine]: https://github.com/charmbracelet/bubbletea/blob/main/examples/list-default/main.go#L77 +[listDefault]: https://github.com/charmbracelet/bubbletea/tree/main/examples/list-default +[customDelegate]: https://github.com/charmbracelet/bubbletea/blob/main/examples/list-simple/main.go#L29-L50