Merge remote-tracking branch 'origin/master' into v2-exp

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker
2025-10-01 17:29:32 -03:00
6 changed files with 56 additions and 6 deletions
+12
View File
@@ -13,6 +13,10 @@ updates:
commit-message:
prefix: "chore"
include: "scope"
groups:
all:
patterns:
- "*"
- package-ecosystem: "github-actions"
directory: "/"
@@ -26,6 +30,10 @@ updates:
commit-message:
prefix: "chore"
include: "scope"
groups:
all:
patterns:
- "*"
- package-ecosystem: "docker"
directory: "/"
@@ -39,3 +47,7 @@ updates:
commit-message:
prefix: "chore"
include: "scope"
groups:
all:
patterns:
- "*"
+2 -2
View File
@@ -11,12 +11,12 @@ jobs:
runs-on: ${{ matrix.os }}
steps:
- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Download Go modules
run: go mod download
+2 -2
View File
@@ -12,12 +12,12 @@ jobs:
GO111MODULE: "on"
steps:
- name: Install Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Coverage
env:
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2020-2023 Charmbracelet, Inc
Copyright (c) 2020-2025 Charmbracelet, Inc
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -216,6 +216,6 @@ Wed love to hear your thoughts on this project. Feel free to drop us a note!
Part of [Charm](https://charm.sh).
<a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-badge.jpg" width="400"></a>
<a href="https://charm.sh/"><img alt="The Charm logo" src="https://stuff.charm.sh/charm-banner-next.jpg" width="400"></a>
Charm热爱开源 • Charm loves open source
+38
View File
@@ -5,6 +5,8 @@ import (
"strconv"
"strings"
"testing"
tea "github.com/charmbracelet/bubbletea"
)
func Test_CurrentSuggestion(t *testing.T) {
@@ -46,6 +48,30 @@ func Test_SlicingOutsideCap(t *testing.T) {
textinput.View()
}
func TestChinesePlaceholder(t *testing.T) {
textinput := New()
textinput.Placeholder = "输入消息..."
textinput.Width = 20
got := textinput.View()
expected := "> 输入消息... "
if got != expected {
t.Fatalf("expected %q but got %q", expected, got)
}
}
func TestPlaceholderTruncate(t *testing.T) {
textinput := New()
textinput.Placeholder = "A very long placeholder, or maybe not so much"
textinput.Width = 10
got := textinput.View()
expected := "> A very …"
if got != expected {
t.Fatalf("expected %q but got %q", expected, got)
}
}
func ExampleValidateFunc() {
creditCardNumber := New()
creditCardNumber.Placeholder = "4505 **** **** 1234"
@@ -78,3 +104,15 @@ func ExampleValidateFunc() {
return err
}
}
func keyPress(key rune) tea.Msg {
return tea.KeyMsg{Type: tea.KeyRunes, Runes: []rune{key}, Alt: false}
}
func sendString(m Model, str string) Model {
for _, k := range str {
m, _ = m.Update(keyPress(k))
}
return m
}