mirror of
https://github.com/Slug-Boi/cocommit.git
synced 2026-05-13 12:45:47 +00:00
refactor: remove some of the clear screen commands
This commit is contained in:
+1
-1
@@ -6,8 +6,8 @@ import (
|
||||
|
||||
"github.com/Slug-Boi/cocommit/src/cmd/tui"
|
||||
"github.com/Slug-Boi/cocommit/src/cmd/utils"
|
||||
|
||||
"github.com/inancgumus/screen"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ import (
|
||||
"github.com/charmbracelet/bubbles/textarea"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/inancgumus/screen"
|
||||
)
|
||||
|
||||
type KeyMap struct {
|
||||
@@ -43,8 +42,7 @@ func Entry_CM() string {
|
||||
log.Fatal(err)
|
||||
}
|
||||
if m.(model_cm).textarea.Value() == "" {
|
||||
screen.Clear()
|
||||
screen.MoveTopLeft()
|
||||
|
||||
fmt.Println("No commit message provided. Exiting...")
|
||||
os.Exit(0)
|
||||
}
|
||||
@@ -62,9 +60,9 @@ type model_cm struct {
|
||||
func initialModel_cm() model_cm {
|
||||
ti := textarea.New()
|
||||
ti.FocusedStyle = textarea.Style{
|
||||
Base: lipgloss.NewStyle().Foreground(lipgloss.Color("170")),
|
||||
LineNumber: lipgloss.NewStyle().Foreground(lipgloss.Color("90")),
|
||||
}
|
||||
Base: lipgloss.NewStyle().Foreground(lipgloss.Color("170")),
|
||||
LineNumber: lipgloss.NewStyle().Foreground(lipgloss.Color("90")),
|
||||
}
|
||||
ti.SetWidth(80)
|
||||
ti.SetHeight(8)
|
||||
|
||||
|
||||
@@ -2,17 +2,17 @@ package tui
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/Slug-Boi/cocommit/src/cmd/utils"
|
||||
"io"
|
||||
"os"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/Slug-Boi/cocommit/src/cmd/utils"
|
||||
|
||||
"github.com/charmbracelet/bubbles/key"
|
||||
"github.com/charmbracelet/bubbles/list"
|
||||
tea "github.com/charmbracelet/bubbletea"
|
||||
"github.com/charmbracelet/lipgloss"
|
||||
"github.com/inancgumus/screen"
|
||||
)
|
||||
|
||||
const listHeight = 14
|
||||
@@ -201,14 +201,12 @@ func (m model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
return m, tea.ClearScreen
|
||||
|
||||
case key.Matches(msg, m.keys.tempAdd):
|
||||
screen.Clear()
|
||||
screen.MoveTopLeft()
|
||||
|
||||
sub_model = tempAuthorModel(&m)
|
||||
return m, tea.ClearScreen
|
||||
|
||||
case key.Matches(msg, m.keys.createAuthor):
|
||||
screen.Clear()
|
||||
screen.MoveTopLeft()
|
||||
|
||||
sub_model = createAuthorModel(&m)
|
||||
return m, tea.ClearScreen
|
||||
case key.Matches(msg, m.keys.deleteAuthor):
|
||||
|
||||
Reference in New Issue
Block a user