@@ -61,7 +61,7 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
6161 return m , tea .Quit
6262 case "e" :
6363 m .isShowingFileTree = ! m .isShowingFileTree
64- df , dfCmd := m .diffViewer .(diffModel ).Update (dimensionsMsg {Width : m .width - m .getFileTreeWidth (), Height : m .height - footerHeight })
64+ df , dfCmd := m .diffViewer .(diffModel ).Update (dimensionsMsg {Width : m .width - m .getFileTreeWidth (), Height : m .height - footerHeight - headerHeight })
6565 m .diffViewer = df
6666 return m , dfCmd
6767 case "up" , "k" :
@@ -84,7 +84,7 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
8484 m .help .Width = msg .Width
8585 m .width = msg .Width
8686 m .height = msg .Height
87- df , dfCmd := m .diffViewer .(diffModel ).Update (dimensionsMsg {Width : m .width - m .getFileTreeWidth (), Height : m .height })
87+ df , dfCmd := m .diffViewer .(diffModel ).Update (dimensionsMsg {Width : m .width - m .getFileTreeWidth (), Height : m .height - footerHeight - headerHeight })
8888 m .diffViewer = df
8989 cmds = append (cmds , dfCmd )
9090
@@ -113,20 +113,26 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
113113}
114114
115115func (m mainModel ) View () string {
116+ header := lipgloss .NewStyle ().Width (m .width ).
117+ Border (lipgloss .NormalBorder (), false , false , true , false ).
118+ BorderForeground (lipgloss .Color ("8" )).
119+ Foreground (lipgloss .Color ("2" )).
120+ Render (" diffnav" )
121+ footer := m .footerView ()
122+
116123 ft := ""
117124 ftWidth := m .getFileTreeWidth ()
118125 if m .isShowingFileTree {
119126 ft = lipgloss .NewStyle ().
120127 Width (constants .OpenFileTreeWidth ).
121- Height (m .height - footerHeight ).
128+ Height (m .height - footerHeight - headerHeight ).
122129 Border (lipgloss .NormalBorder (), false , true , false , false ).
123130 BorderForeground (lipgloss .Color ("8" )).
124131 Render (m .fileTree .View ())
125132 }
126- dv := lipgloss .NewStyle ().MaxHeight (m .height - footerHeight ).Width (m .width - ftWidth ).Render (m .diffViewer .View ())
133+ dv := lipgloss .NewStyle ().MaxHeight (m .height - footerHeight - headerHeight ).Width (m .width - ftWidth ).Render (m .diffViewer .View ())
127134 content := lipgloss .JoinHorizontal (lipgloss .Top , ft , dv )
128- footer := m .footerView ()
129- return lipgloss .JoinVertical (lipgloss .Left , content , footer )
135+ return lipgloss .JoinVertical (lipgloss .Left , header , content , footer )
130136}
131137
132138func (m mainModel ) getFileTreeWidth () int {
@@ -194,7 +200,10 @@ func sortFiles(files []*gitdiff.File) {
194200 })
195201}
196202
197- const footerHeight = 1
203+ const (
204+ footerHeight = 1
205+ headerHeight = 2
206+ )
198207
199208func (m mainModel ) footerView () string {
200209 return lipgloss .NewStyle ().
0 commit comments