Skip to content

Commit 6743633

Browse files
authored
refactor: textarea handling to use pointer-based implementation (#218)
- Add a blank line for better readability in `commit.go` - Change `textarea` field to be a pointer in `textarea.go` - Update `textarea` initialization to use a pointer in `textarea.go` - Modify `textarea` update method to dereference the pointer in `textarea.go` Signed-off-by: appleboy <[email protected]>
1 parent 4e891ac commit 6743633

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

cmd/commit.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,6 +316,7 @@ var commitCmd = &cobra.Command{
316316
return err
317317
}
318318
p.Wait()
319+
319320
commitMessage = m.textarea.Value()
320321
}
321322
}

cmd/textarea.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
type errMsg error
1212

1313
type model struct {
14-
textarea textarea.Model
14+
textarea *textarea.Model
1515
err error
1616
}
1717

@@ -42,7 +42,7 @@ func initialPrompt(value string) model {
4242
ti.Focus()
4343

4444
return model{
45-
textarea: ti,
45+
textarea: &ti,
4646
err: nil,
4747
}
4848
}
@@ -77,7 +77,7 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
7777
return m, nil
7878
}
7979

80-
m.textarea, cmd = m.textarea.Update(msg)
80+
*m.textarea, cmd = m.textarea.Update(msg)
8181
cmds = append(cmds, cmd)
8282
return m, tea.Batch(cmds...)
8383
}

0 commit comments

Comments
 (0)