Skip to content

Commit 75347ab

Browse files
chore: auto-format Go code via gofmt
1 parent 41a1961 commit 75347ab

File tree

6 files changed

+53
-56
lines changed

6 files changed

+53
-56
lines changed

internal/backend/demo/dummy_data.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,4 +218,4 @@ func (d *DemoGenerator) createEndpoints(ctx context.Context, endpointData []endp
218218
log.Debug("created demo endpoint", "name", data.Name, "method", data.Method, "url", data.URL)
219219
}
220220
return nil
221-
}
221+
}

internal/tui/app/model.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ func NewModel(ctx *Context) Model {
3434
if ctx.DummyDataCreated {
3535
collectionsView.SetDummyDataNotification(true)
3636
}
37-
37+
3838
m := Model{
3939
ctx: ctx,
4040
mode: CollectionsViewMode,

internal/tui/components/keyvalue_editor.go

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ type KeyValuePair struct {
1313
}
1414

1515
type KeyValueEditor struct {
16-
label string
17-
pairs []KeyValuePair
18-
width int
19-
height int
20-
focused bool
21-
focusIndex int // Which pair is focused
22-
fieldIndex int // 0=key, 1=value, 2=enabled
16+
label string
17+
pairs []KeyValuePair
18+
width int
19+
height int
20+
focused bool
21+
focusIndex int // Which pair is focused
22+
fieldIndex int // 0=key, 1=value, 2=enabled
2323
}
2424

2525
func NewKeyValueEditor(label string) KeyValueEditor {
@@ -176,11 +176,11 @@ func (kv KeyValueEditor) View() string {
176176

177177
// Header - better column proportions
178178
headerStyle := styles.ListItemStyle.Copy().Bold(true)
179-
availableWidth := containerWidth - 8 // Account for padding and separators
180-
keyWidth := availableWidth * 40 / 100 // 40% for key
181-
valueWidth := availableWidth * 50 / 100 // 50% for value
179+
availableWidth := containerWidth - 8 // Account for padding and separators
180+
keyWidth := availableWidth * 40 / 100 // 40% for key
181+
valueWidth := availableWidth * 50 / 100 // 50% for value
182182
enabledWidth := availableWidth * 10 / 100 // 10% for enabled
183-
183+
184184
header := lipgloss.JoinHorizontal(
185185
lipgloss.Top,
186186
headerStyle.Copy().Width(keyWidth).Render("Key"),
@@ -199,7 +199,7 @@ func (kv KeyValueEditor) View() string {
199199

200200
for i := 0; i < maxPairs && i < len(kv.pairs); i++ {
201201
pair := kv.pairs[i]
202-
202+
203203
// Style fields based on focus
204204
keyStyle := styles.ListItemStyle.Copy().Width(keyWidth)
205205
valueStyle := styles.ListItemStyle.Copy().Width(valueWidth)
@@ -257,4 +257,4 @@ func (kv KeyValueEditor) View() string {
257257
containerView := container.Render(content)
258258

259259
return containerView
260-
}
260+
}

internal/tui/components/textarea.go

Lines changed: 33 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import (
99
)
1010

1111
type Textarea struct {
12-
label string
13-
content string
14-
width int
15-
height int
16-
focused bool
17-
cursor int
18-
lines []string
19-
cursorRow int
20-
cursorCol int
12+
label string
13+
content string
14+
width int
15+
height int
16+
focused bool
17+
cursor int
18+
lines []string
19+
cursorRow int
20+
cursorCol int
2121
scrollOffset int
2222
}
2323

@@ -42,11 +42,11 @@ func (t *Textarea) SetValue(value string) {
4242
if len(rawLines) == 0 {
4343
rawLines = []string{""}
4444
}
45-
45+
4646
// Wrap long lines to fit within the textarea width
4747
t.lines = []string{}
4848
contentWidth := t.getContentWidth()
49-
49+
5050
for _, line := range rawLines {
5151
if len(line) <= contentWidth {
5252
t.lines = append(t.lines, line)
@@ -56,11 +56,11 @@ func (t *Textarea) SetValue(value string) {
5656
t.lines = append(t.lines, wrapped...)
5757
}
5858
}
59-
59+
6060
if len(t.lines) == 0 {
6161
t.lines = []string{""}
6262
}
63-
63+
6464
// Set cursor to end
6565
t.cursorRow = len(t.lines) - 1
6666
t.cursorCol = len(t.lines[t.cursorRow])
@@ -95,20 +95,19 @@ func (t *Textarea) moveCursor(row, col int) {
9595
if row >= len(t.lines) {
9696
row = len(t.lines) - 1
9797
}
98-
98+
9999
// Ensure col is in bounds for the row
100100
if col < 0 {
101101
col = 0
102102
}
103103
if col > len(t.lines[row]) {
104104
col = len(t.lines[row])
105105
}
106-
106+
107107
t.cursorRow = row
108108
t.cursorCol = col
109109
}
110110

111-
112111
func (t Textarea) Update(msg tea.Msg) (Textarea, tea.Cmd) {
113112
if !t.focused {
114113
return t, nil
@@ -122,23 +121,23 @@ func (t Textarea) Update(msg tea.Msg) (Textarea, tea.Cmd) {
122121
currentLine := t.lines[t.cursorRow]
123122
beforeCursor := currentLine[:t.cursorCol]
124123
afterCursor := currentLine[t.cursorCol:]
125-
124+
126125
t.lines[t.cursorRow] = beforeCursor
127126
newLines := make([]string, len(t.lines)+1)
128127
copy(newLines[:t.cursorRow+1], t.lines[:t.cursorRow+1])
129128
newLines[t.cursorRow+1] = afterCursor
130129
copy(newLines[t.cursorRow+2:], t.lines[t.cursorRow+1:])
131130
t.lines = newLines
132-
131+
133132
t.cursorRow++
134133
t.cursorCol = 0
135-
134+
136135
case "tab":
137136
// Insert 2 spaces for indentation
138137
currentLine := t.lines[t.cursorRow]
139138
t.lines[t.cursorRow] = currentLine[:t.cursorCol] + " " + currentLine[t.cursorCol:]
140139
t.cursorCol += 2
141-
140+
142141
case "backspace":
143142
if t.cursorCol > 0 {
144143
// Remove character
@@ -150,16 +149,16 @@ func (t Textarea) Update(msg tea.Msg) (Textarea, tea.Cmd) {
150149
prevLine := t.lines[t.cursorRow-1]
151150
currentLine := t.lines[t.cursorRow]
152151
t.lines[t.cursorRow-1] = prevLine + currentLine
153-
152+
154153
newLines := make([]string, len(t.lines)-1)
155154
copy(newLines[:t.cursorRow], t.lines[:t.cursorRow])
156155
copy(newLines[t.cursorRow:], t.lines[t.cursorRow+1:])
157156
t.lines = newLines
158-
157+
159158
t.cursorRow--
160159
t.cursorCol = len(prevLine)
161160
}
162-
161+
163162
case "delete":
164163
if t.cursorCol < len(t.lines[t.cursorRow]) {
165164
// Remove character
@@ -170,13 +169,13 @@ func (t Textarea) Update(msg tea.Msg) (Textarea, tea.Cmd) {
170169
currentLine := t.lines[t.cursorRow]
171170
nextLine := t.lines[t.cursorRow+1]
172171
t.lines[t.cursorRow] = currentLine + nextLine
173-
172+
174173
newLines := make([]string, len(t.lines)-1)
175174
copy(newLines[:t.cursorRow+1], t.lines[:t.cursorRow+1])
176175
copy(newLines[t.cursorRow+1:], t.lines[t.cursorRow+2:])
177176
t.lines = newLines
178177
}
179-
178+
180179
case "up":
181180
t.moveCursor(t.cursorRow-1, t.cursorCol)
182181
case "down":
@@ -199,7 +198,7 @@ func (t Textarea) Update(msg tea.Msg) (Textarea, tea.Cmd) {
199198
t.cursorCol = 0
200199
case "end":
201200
t.cursorCol = len(t.lines[t.cursorRow])
202-
201+
203202
default:
204203
// Insert printable characters
205204
if len(msg.String()) == 1 && msg.String() >= " " {
@@ -244,16 +243,16 @@ func (t Textarea) View() string {
244243
lineIndex := i // No scrolling for now
245244
if lineIndex < len(t.lines) {
246245
line := t.lines[lineIndex]
247-
246+
248247
// Add cursor if this is the cursor row and textarea is focused
249248
if t.focused && lineIndex == t.cursorRow {
250249
if t.cursorCol <= len(line) {
251250
line = line[:t.cursorCol] + "│" + line[t.cursorCol:]
252251
}
253252
}
254-
253+
255254
// Lines should already be wrapped, no need to truncate
256-
255+
257256
visibleLines[i] = line
258257
} else {
259258
visibleLines[i] = ""
@@ -283,7 +282,7 @@ func (t Textarea) wrapLine(line string, maxWidth int) []string {
283282
if len(line) <= maxWidth {
284283
return []string{line}
285284
}
286-
285+
287286
var wrapped []string
288287
for len(line) > maxWidth {
289288
// Find the best place to break (prefer spaces)
@@ -294,20 +293,19 @@ func (t Textarea) wrapLine(line string, maxWidth int) []string {
294293
break
295294
}
296295
}
297-
296+
298297
wrapped = append(wrapped, line[:breakPoint])
299298
line = line[breakPoint:]
300-
299+
301300
// Skip leading space on continuation lines
302301
if len(line) > 0 && line[0] == ' ' {
303302
line = line[1:]
304303
}
305304
}
306-
305+
307306
if len(line) > 0 {
308307
wrapped = append(wrapped, line)
309308
}
310-
309+
311310
return wrapped
312311
}
313-

internal/tui/views/request_builder.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (rb *RequestBuilder) SetSize(width, height int) {
6464
if textareaWidth < 60 {
6565
textareaWidth = 60 // Ensure minimum usable width
6666
}
67-
67+
6868
// Set height for textarea (leave space for method/URL, tabs)
6969
textareaHeight := height - 8 // Account for method/URL row + tabs + spacing
7070
if textareaHeight < 5 {
@@ -73,7 +73,7 @@ func (rb *RequestBuilder) SetSize(width, height int) {
7373
if textareaHeight > 15 {
7474
textareaHeight = 15 // Cap at reasonable height
7575
}
76-
76+
7777
rb.bodyTextarea.SetSize(textareaWidth, textareaHeight)
7878
rb.headersEditor.SetSize(textareaWidth, textareaHeight)
7979
rb.queryEditor.SetSize(textareaWidth, textareaHeight)
@@ -292,7 +292,7 @@ func (rb RequestBuilder) renderPlaceholderTab(message string) string {
292292
if textareaWidth < 60 {
293293
textareaWidth = 60
294294
}
295-
295+
296296
textareaHeight := rb.height - 8
297297
if textareaHeight < 5 {
298298
textareaHeight = 5
@@ -323,4 +323,3 @@ type RequestSendMsg struct {
323323
URL string
324324
Body string
325325
}
326-

internal/tui/views/selected_collection.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ func (v SelectedCollectionView) Update(msg tea.Msg) (SelectedCollectionView, tea
105105
case tea.KeyMsg:
106106
// Clear notification on any keypress
107107
v.notification = ""
108-
108+
109109
// If request builder is in component editing mode, only handle esc - forward everything else
110110
if v.activeMainTab == RequestBuilderMainTab && v.requestBuilder.IsEditingComponent() {
111111
if msg.String() == "esc" {
@@ -119,7 +119,7 @@ func (v SelectedCollectionView) Update(msg tea.Msg) (SelectedCollectionView, tea
119119
v.requestBuilder, builderCmd = v.requestBuilder.Update(msg)
120120
return v, builderCmd
121121
}
122-
122+
123123
// Normal key handling when not editing
124124
switch msg.String() {
125125
case "esc", "q":

0 commit comments

Comments
 (0)