@@ -25,13 +25,14 @@ type GitPane struct {
2525 height int // Height of the terminal window
2626
2727 // Input focus management
28- // focusedInput: 0=URL, 1=USER, 2=PASS, 3=buttons
28+ // focusedInput: 0=URL, 1=USER, 2=PASS, 3=buttons, 4=commit message
2929 focusedInput int
3030
3131 // Input fields (using textinput from bubbletea)
32- urlInput textinput.Model // Input field for Git repository URL
33- userInput textinput.Model // Input field for Git username
34- passInput textinput.Model // Input field for Git password or GitHub PAT (ghp_*)
32+ urlInput textinput.Model // Input field for Git repository URL
33+ userInput textinput.Model // Input field for Git username
34+ passInput textinput.Model // Input field for Git password or GitHub PAT (ghp_*)
35+ commitMsgInput textinput.Model // Input field for commit message (only shown when Commit is selected)
3536
3637 // Button state
3738 // selectedButton: 0=Clone, 1=Pull, 2=Fetch, 3=Stage, 4=Commit, 5=Push, 6=Status, 7=Restore
@@ -96,6 +97,13 @@ func (g *GitPane) Init() tea.Cmd {
9697 g .passInput .EchoMode = textinput .EchoPassword // Hide password input
9798 g .passInput .EchoCharacter = '•'
9899
100+ // Initialize commit message input field
101+ g .commitMsgInput = textinput .New ()
102+ g .commitMsgInput .Placeholder = "Enter commit message"
103+ g .commitMsgInput .Prompt = "Commit Message: "
104+ g .commitMsgInput .CharLimit = 200
105+ g .commitMsgInput .Width = 60
106+
99107 // Set initial focus to URL input
100108 g .urlInput .Focus ()
101109 g .focusedInput = 0
@@ -527,18 +535,29 @@ func (g *GitPane) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
527535 return g , nil
528536
529537 case "tab" , "down" :
530- // Tab or Down moves focus forward: URL → USER → PASS → buttons
538+ // Tab or Down moves focus forward: URL → USER → PASS → buttons (→ commit msg if Commit selected)
531539 g .focusedInput ++
532- if g .focusedInput > 3 {
540+ // If Commit button is selected and we're at buttons, move to commit message input
541+ if g .focusedInput == 4 && g .selectedButton == 4 {
542+ // Allow moving to commit message input
543+ } else if g .focusedInput > 3 {
544+ // Skip commit message input if not on Commit button
533545 g .focusedInput = 0
534546 }
535547 g .updateFocus ()
536548
537549 case "shift+tab" , "up" :
538- // Shift+Tab or Up moves focus backward: buttons → PASS → USER → URL
550+ // Shift+Tab or Up moves focus backward
539551 g .focusedInput --
540552 if g .focusedInput < 0 {
541- g .focusedInput = 3
553+ // If Commit button is selected, go to commit message input
554+ if g .selectedButton == 4 {
555+ g .focusedInput = 4
556+ } else {
557+ g .focusedInput = 3
558+ }
559+ } else if g .focusedInput == 3 && g .selectedButton == 4 {
560+ // Coming from commit message, stay at buttons
542561 }
543562 g .updateFocus ()
544563
@@ -555,6 +574,14 @@ func (g *GitPane) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
555574 username := g .userInput .Value ()
556575 password := g .passInput .Value ()
557576
577+ // For Commit button, check if we need to show commit message input
578+ if g .selectedButton == 4 {
579+ // Move focus to commit message input
580+ g .focusedInput = 4
581+ g .updateFocus ()
582+ return g , nil
583+ }
584+
558585 // Trigger the appropriate Git operation based on selected button
559586 switch g .selectedButton {
560587 case 0 : // Clone
@@ -565,8 +592,6 @@ func (g *GitPane) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
565592 return g , g .executeFetch (username , password )
566593 case 3 : // Stage
567594 return g , g .executeStage ()
568- case 4 : // Commit
569- return g , g .executeCommit ("Update files" )
570595 case 5 : // Push
571596 return g , g .executePush (username , password )
572597 case 6 : // Status
@@ -575,6 +600,18 @@ func (g *GitPane) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
575600 return g , g .executeRestore ()
576601 }
577602 return g , nil
603+ } else if g .focusedInput == 4 {
604+ // Focused on commit message input - execute commit
605+ commitMsg := g .commitMsgInput .Value ()
606+ if commitMsg == "" {
607+ g .errorMessage = "Commit message cannot be empty"
608+ return g , nil
609+ }
610+ // Clear the commit message input and go back to buttons
611+ g .commitMsgInput .SetValue ("" )
612+ g .focusedInput = 3
613+ g .updateFocus ()
614+ return g , g .executeCommit (commitMsg )
578615 }
579616 // If focused on input field, Enter does nothing (use Tab/Down to move)
580617
@@ -592,20 +629,27 @@ func (g *GitPane) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
592629 g .selectedButton = 0 // Wrap to first button (Clone)
593630 }
594631 }
632+ // If we moved away from Commit button, reset focus if on commit message
633+ if g .selectedButton != 4 && g .focusedInput == 4 {
634+ g .focusedInput = 3
635+ g .updateFocus ()
636+ }
595637 }
596638 }
597639 }
598640
599641 // Update the focused input field with keyboard input
600642 // Only update if we're focused on an input field (not buttons)
601- if g .focusedInput < 3 {
643+ if g .focusedInput < 3 || g . focusedInput == 4 {
602644 switch g .focusedInput {
603645 case 0 :
604646 g .urlInput , cmd = g .urlInput .Update (msg )
605647 case 1 :
606648 g .userInput , cmd = g .userInput .Update (msg )
607649 case 2 :
608650 g .passInput , cmd = g .passInput .Update (msg )
651+ case 4 :
652+ g .commitMsgInput , cmd = g .commitMsgInput .Update (msg )
609653 }
610654 }
611655
@@ -619,6 +663,7 @@ func (g *GitPane) updateFocus() {
619663 g .urlInput .Blur ()
620664 g .userInput .Blur ()
621665 g .passInput .Blur ()
666+ g .commitMsgInput .Blur ()
622667
623668 // Focus the appropriate input field
624669 switch g .focusedInput {
@@ -630,6 +675,8 @@ func (g *GitPane) updateFocus() {
630675 g .passInput .Focus ()
631676 case 3 :
632677 // Focused on buttons - no input field should be focused
678+ case 4 :
679+ g .commitMsgInput .Focus ()
633680 }
634681}
635682
@@ -712,6 +759,12 @@ func (g *GitPane) View() string {
712759 content .WriteString (buttonRow )
713760 content .WriteString ("\n \n " )
714761
762+ // Show commit message input only when Commit button is selected
763+ if g .selectedButton == 4 {
764+ content .WriteString (g .commitMsgInput .View ())
765+ content .WriteString ("\n \n " )
766+ }
767+
715768 // Status/Error messages
716769 if g .isProcessing {
717770 content .WriteString (processingStyle .Render ("Processing..." ))
0 commit comments