Skip to content

Commit 8db6945

Browse files
authored
fix: remove numeric hint, feels useless (#24)
1 parent 2edee48 commit 8db6945

7 files changed

Lines changed: 12 additions & 96 deletions

File tree

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,6 @@ or any other location specified via the `--config` flag.
223223
```toml
224224
[general]
225225
hint_characters = "asdfghjkl" # Characters used for hints
226-
hint_style = "alphabet" # "alphabet" or "numeric"
227226

228227
[accessibility]
229228
# Clickable elements

cmd/govim/main.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ func NewApp(cfg *config.Config) (*App, error) {
9292
// Create hint generator
9393
hintGen := hints.NewGenerator(
9494
cfg.General.HintCharacters,
95-
cfg.General.HintStyle,
9695
cfg.Performance.MaxHintsDisplayed,
9796
)
9897

configs/default-config.toml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,11 @@
99
# - Colors: `#RGB`, `#RRGGBB`, or `#RRGGBBAA`.
1010
# - Hotkeys: `Modifier+...+Key` with modifiers `Cmd`, `Ctrl`, `Alt`, `Shift`, `Option`.
1111
# Examples: `Cmd+Shift+Space`, `Ctrl+D`. Set to "" to disable.
12-
# - When `hint_style = "numeric"`, `hint_characters` are ignored.
13-
1412
[general]
1513
# Characters used to build hint labels for alphabet style.
1614
# - At least 2 characters; choose distinct, easy-to-type ones.
1715
hint_characters = "asdfghjkl"
1816

19-
# Hint label style: "alphabet" or "numeric".
20-
# - "alphabet": uses `hint_characters` to build AA/AS/...
21-
# - "numeric": labels are numbers 1..N; ignores `hint_characters`.
22-
hint_style = "alphabet"
23-
2417
# Check Accessibility permission on startup; exits with guidance if missing.
2518
accessibility_check_on_start = true
2619

internal/config/config.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ type Config struct {
2323

2424
type GeneralConfig struct {
2525
HintCharacters string `toml:"hint_characters"`
26-
HintStyle string `toml:"hint_style"`
2726
AccessibilityCheckOnStart bool `toml:"accessibility_check_on_start"`
2827
}
2928

@@ -102,7 +101,6 @@ func DefaultConfig() *Config {
102101
return &Config{
103102
General: GeneralConfig{
104103
HintCharacters: "asdfghjkl",
105-
HintStyle: "alphabet",
106104
AccessibilityCheckOnStart: true,
107105
},
108106
Accessibility: AccessibilityConfig{
@@ -239,16 +237,11 @@ func GetConfigPath() string {
239237

240238
// Validate validates the configuration
241239
func (c *Config) Validate() error {
242-
// Validate hint style
243-
if c.General.HintStyle != "alphabet" && c.General.HintStyle != "numeric" {
244-
return fmt.Errorf("hint_style must be 'alphabet' or 'numeric'")
245-
}
246-
247240
// Validate hint characters
248241
if strings.TrimSpace(c.General.HintCharacters) == "" {
249242
return fmt.Errorf("hint_characters cannot be empty")
250243
}
251-
if c.General.HintStyle == "alphabet" && len(c.General.HintCharacters) < 2 {
244+
if len(c.General.HintCharacters) < 2 {
252245
return fmt.Errorf("hint_characters must contain at least 2 characters")
253246
}
254247

internal/config/config_test.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ func TestDefaultConfig(t *testing.T) {
1313
t.Errorf("Expected hint_characters to be 'asdfghjkl', got '%s'", cfg.General.HintCharacters)
1414
}
1515

16-
if cfg.General.HintStyle != "alphabet" {
17-
t.Errorf("Expected hint_style to be 'alphabet', got '%s'", cfg.General.HintStyle)
18-
}
19-
2016
if cfg.Logging.LogLevel != "info" {
2117
t.Errorf("Expected log_level to be 'info', got '%s'", cfg.Logging.LogLevel)
2218
}
@@ -33,13 +29,6 @@ func TestValidate(t *testing.T) {
3329
modify: func(c *Config) {},
3430
wantErr: false,
3531
},
36-
{
37-
name: "invalid hint style",
38-
modify: func(c *Config) {
39-
c.General.HintStyle = "invalid"
40-
},
41-
wantErr: true,
42-
},
4332
{
4433
name: "invalid log level",
4534
modify: func(c *Config) {

internal/hints/generator.go

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package hints
22

33
import (
4-
"fmt"
54
"image"
65
"sort"
76
"strings"
@@ -21,19 +20,17 @@ type Hint struct {
2120
// Generator generates hints for UI elements
2221
type Generator struct {
2322
characters string
24-
style string
2523
maxHints int
2624
}
2725

2826
// NewGenerator creates a new hint generator
29-
func NewGenerator(characters, style string, maxHints int) *Generator {
27+
func NewGenerator(characters string, maxHints int) *Generator {
3028
// Ensure we have at least some characters
3129
if characters == "" {
3230
characters = "asdfghjkl" // fallback to default
3331
}
3432
return &Generator{
3533
characters: characters,
36-
style: style,
3734
maxHints: maxHints,
3835
}
3936
}
@@ -64,13 +61,8 @@ func (g *Generator) Generate(elements []*accessibility.TreeNode) ([]*Hint, error
6461
sortedElements = sortedElements[:g.maxHints]
6562
}
6663

67-
// Generate labels
68-
var labels []string
69-
if g.style == "alphabet" {
70-
labels = g.generateAlphabetLabels(len(sortedElements))
71-
} else {
72-
labels = g.generateNumericLabels(len(sortedElements))
73-
}
64+
// Generate labels (alphabet-only)
65+
labels := g.generateAlphabetLabels(len(sortedElements))
7466

7567
// Generate hints
7668
hints := make([]*Hint, len(sortedElements))
@@ -140,15 +132,6 @@ func (g *Generator) generateAlphabetLabels(count int) []string {
140132
return labels[:count]
141133
}
142134

143-
// generateNumericLabels generates numeric labels (1, 2, 3, ...)
144-
func (g *Generator) generateNumericLabels(count int) []string {
145-
labels := make([]string, count)
146-
for i := 0; i < count; i++ {
147-
labels[i] = fmt.Sprintf("%d", i+1)
148-
}
149-
return labels
150-
}
151-
152135
// FindHintByLabel finds a hint by its label
153136
func FindHintByLabel(hints []*Hint, label string) *Hint {
154137
label = strings.ToLower(label)

internal/hints/generator_test.go

Lines changed: 8 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
func TestGenerateAlphabetLabels(t *testing.T) {
13-
gen := NewGenerator("asdf", "alphabet", 100)
13+
gen := NewGenerator("asdf", 100)
1414

1515
tests := []struct {
1616
count int
@@ -38,34 +38,6 @@ func TestGenerateAlphabetLabels(t *testing.T) {
3838
}
3939
}
4040

41-
func TestGenerateNumericLabels(t *testing.T) {
42-
gen := NewGenerator("", "numeric", 100)
43-
44-
tests := []struct {
45-
count int
46-
expected []string
47-
}{
48-
{0, []string{}},
49-
{1, []string{"1"}},
50-
{5, []string{"1", "2", "3", "4", "5"}},
51-
{10, []string{"1", "2", "3", "4", "5", "6", "7", "8", "9", "10"}},
52-
}
53-
54-
for _, tt := range tests {
55-
labels := gen.generateNumericLabels(tt.count)
56-
if len(labels) != len(tt.expected) {
57-
t.Errorf("Expected %d labels, got %d", len(tt.expected), len(labels))
58-
continue
59-
}
60-
61-
for i, label := range labels {
62-
if label != tt.expected[i] {
63-
t.Errorf("Label %d: expected %s, got %s", i, tt.expected[i], label)
64-
}
65-
}
66-
}
67-
}
68-
6941
func TestFindHintByLabel(t *testing.T) {
7042
hints := []*Hint{
7143
{Label: "a", Position: image.Point{X: 0, Y: 0}},
@@ -221,7 +193,6 @@ func TestGenerate(t *testing.T) {
221193
tests := []struct {
222194
name string
223195
characters string
224-
style string
225196
maxHints int
226197
elements []*accessibility.TreeNode
227198
wantCount int
@@ -230,25 +201,15 @@ func TestGenerate(t *testing.T) {
230201
{
231202
name: "alphabet style",
232203
characters: "asdf",
233-
style: "alphabet",
234204
maxHints: 10,
235205
elements: elements,
236206
wantCount: 3,
237207
wantLabels: []string{"A", "S", "D"},
238208
},
239-
{
240-
name: "numeric style",
241-
characters: "asdf",
242-
style: "numeric",
243-
maxHints: 10,
244-
elements: elements,
245-
wantCount: 3,
246-
wantLabels: []string{"1", "2", "3"},
247-
},
209+
248210
{
249211
name: "limited hints",
250212
characters: "asdf",
251-
style: "alphabet",
252213
maxHints: 2,
253214
elements: elements,
254215
wantCount: 2,
@@ -257,7 +218,6 @@ func TestGenerate(t *testing.T) {
257218
{
258219
name: "empty elements",
259220
characters: "asdf",
260-
style: "alphabet",
261221
maxHints: 10,
262222
elements: []*accessibility.TreeNode{},
263223
wantCount: 0,
@@ -267,7 +227,7 @@ func TestGenerate(t *testing.T) {
267227

268228
for _, tt := range tests {
269229
t.Run(tt.name, func(t *testing.T) {
270-
generator := NewGenerator(tt.characters, tt.style, tt.maxHints)
230+
generator := NewGenerator(tt.characters, tt.maxHints)
271231
hints, err := generator.Generate(tt.elements)
272232

273233
if err != nil {
@@ -343,7 +303,7 @@ func createMockElement(x, y int) *accessibility.TreeNode {
343303
}
344304

345305
func TestGenerateHints(t *testing.T) {
346-
gen := NewGenerator("asdf", "alphabet", 100)
306+
gen := NewGenerator("asdf", 100)
347307

348308
elements := []*accessibility.TreeNode{
349309
createMockElement(10, 10),
@@ -412,7 +372,7 @@ func TestGenerateHints_EdgeCases(t *testing.T) {
412372

413373
for _, tt := range tests {
414374
t.Run(tt.name, func(t *testing.T) {
415-
gen := NewGenerator("asdf", "alphabet", tt.maxHints)
375+
gen := NewGenerator("asdf", tt.maxHints)
416376
hints, err := gen.Generate(tt.elements)
417377

418378
if tt.expectError {
@@ -445,7 +405,7 @@ func TestGenerateHints_EdgeCases(t *testing.T) {
445405
}
446406

447407
func TestGenerateHintsWithMaxLimit(t *testing.T) {
448-
gen := NewGenerator("asdf", "alphabet", 2)
408+
gen := NewGenerator("asdf", 2)
449409

450410
elements := []*accessibility.TreeNode{
451411
createMockElement(10, 10),
@@ -480,7 +440,7 @@ func TestGenerateAlphabetLabels_EdgeCases(t *testing.T) {
480440

481441
for _, tt := range tests {
482442
t.Run(tt.name, func(t *testing.T) {
483-
gen := NewGenerator(tt.chars, "alphabet", 1000)
443+
gen := NewGenerator(tt.chars, 1000)
484444
labels := gen.generateAlphabetLabels(tt.count)
485445

486446
if tt.count <= 0 {
@@ -535,7 +495,7 @@ func TestNoPrefixConflicts(t *testing.T) {
535495

536496
for _, tt := range tests {
537497
t.Run(tt.name, func(t *testing.T) {
538-
gen := NewGenerator(tt.chars, "alphabet", 1000)
498+
gen := NewGenerator(tt.chars, 1000)
539499
labels := gen.generateAlphabetLabels(tt.count)
540500

541501
if len(labels) != tt.count {

0 commit comments

Comments
 (0)