@@ -20,7 +20,7 @@ import (
2020 "github.com/dlvhdr/diffnav/pkg/filenode"
2121 "github.com/dlvhdr/diffnav/pkg/ui/common"
2222 "github.com/dlvhdr/diffnav/pkg/ui/panes/diffviewer"
23- "github.com/dlvhdr/diffnav/pkg/ui/panes/filetreev2 "
23+ "github.com/dlvhdr/diffnav/pkg/ui/panes/filetree "
2424 "github.com/dlvhdr/diffnav/pkg/utils"
2525)
2626
@@ -58,7 +58,7 @@ type mainModel struct {
5858 input string
5959 files []* gitdiff.File
6060 cursor int
61- fileTreeV2 filetreev2 .Model
61+ fileTree filetree .Model
6262 diffViewer diffviewer.Model
6363 width int
6464 height int
@@ -81,8 +81,8 @@ func New(input string, cfg config.Config) mainModel {
8181 input : input , isShowingFileTree : cfg .UI .ShowFileTree ,
8282 activePanel : FileTreePanel , config : cfg , iconStyle : cfg .UI .Icons , sideBySide : cfg .UI .SideBySide ,
8383 }
84- m .fileTreeV2 = filetreev2 .New (cfg .UI .Icons , cfg .UI .ColorFileNames )
85- m .fileTreeV2 .SetSize (cfg .UI .FileTreeWidth , 0 )
84+ m .fileTree = filetree .New (cfg .UI .Icons , cfg .UI .ColorFileNames )
85+ m .fileTree .SetSize (cfg .UI .FileTreeWidth , 0 )
8686 m .diffViewer = diffviewer .New (cfg .UI .SideBySide )
8787
8888 m .help = help .New ()
@@ -161,7 +161,7 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
161161 treeWidth = m .config .UI .FileTreeWidth
162162 }
163163
164- m .fileTreeV2 .SetSize (treeWidth , h - searchHeight - 1 )
164+ m .fileTree .SetSize (treeWidth , h - searchHeight - 1 )
165165 dfCmd := m .diffViewer .SetSize (m .width - sidebarWidth , h )
166166 cmds = append (cmds , dfCmd )
167167 case key .Matches (msg , keys .ToggleIconStyle ):
@@ -199,7 +199,7 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
199199 m .diffViewer .ScrollDown (1 )
200200 }
201201 case key .Matches (msg , keys .Copy ):
202- cmd = m .fileTreeV2 .CopyFilePath (m .cursor )
202+ cmd = m .fileTree .CopyFilePath (m .cursor )
203203 if cmd != nil {
204204 cmds = append (cmds , cmd )
205205 }
@@ -220,15 +220,15 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
220220
221221 tWidth , tHeight := m .sidebarWidth (), m .mainContentHeight ()- searchHeight
222222
223- m .fileTreeV2 .SetSize (tWidth , tHeight )
223+ m .fileTree .SetSize (tWidth , tHeight )
224224 m .search .SetWidth (tWidth )
225225
226226 case fileTreeMsg :
227227 m .files = msg .files
228228 if len (m .files ) == 0 {
229229 return m , tea .Quit
230230 }
231- m .fileTreeV2 = m .fileTreeV2 .SetFiles (m .files )
231+ m .fileTree = m .fileTree .SetFiles (m .files )
232232 cmd = m .setCursor (0 )
233233 cmds = append (cmds , cmd )
234234
@@ -255,14 +255,14 @@ func (m mainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
255255 m .diffViewer , cmd = m .diffViewer .Update (msg )
256256 cmds = append (cmds , cmd )
257257 } else {
258- m .fileTreeV2 , cmd = m .fileTreeV2 .Update (msg )
258+ m .fileTree , cmd = m .fileTree .Update (msg )
259259 cmds = append (cmds , cmd )
260260 }
261261 }
262262 default :
263263 m .diffViewer , cmd = m .diffViewer .Update (msg )
264264 cmds = append (cmds , cmd )
265- m .fileTreeV2 , cmd = m .fileTreeV2 .Update (msg )
265+ m .fileTree , cmd = m .fileTree .Update (msg )
266266 cmds = append (cmds , cmd )
267267 }
268268
@@ -288,7 +288,7 @@ func (m *mainModel) cycleIconStyle() {
288288 default :
289289 m .iconStyle = filenode .IconsASCII
290290 }
291- m .fileTreeV2 .SetIconStyle (m .iconStyle )
291+ m .fileTree .SetIconStyle (m .iconStyle )
292292}
293293
294294func (m mainModel ) searchUpdate (msg tea.Msg ) (mainModel , []tea.Cmd ) {
@@ -314,7 +314,7 @@ func (m mainModel) searchUpdate(msg tea.Msg) (mainModel, []tea.Cmd) {
314314 if filenode .GetFileName (f ) == selected {
315315 m .cursor = i
316316 m .diffViewer , cmd = m .diffViewer .SetFilePatch (f )
317- m .fileTreeV2 .SetCursor (i )
317+ m .fileTree .SetCursor (i )
318318 cmds = append (cmds , cmd )
319319 break
320320 }
@@ -384,7 +384,7 @@ func (m mainModel) View() tea.View {
384384 if m .searching {
385385 content = zone .Mark (zoneSearchResults , m .resultsVp .View ())
386386 } else {
387- content = zone .Mark (zoneFileTree , m .fileTreeV2 .View ())
387+ content = zone .Mark (zoneFileTree , m .fileTree .View ())
388388 }
389389 content = lipgloss .NewStyle ().Render (lipgloss .JoinVertical (lipgloss .Left , searchBox , content ))
390390
@@ -473,7 +473,7 @@ func (m mainModel) sidebarWidth() int {
473473 }
474474
475475 if m .isShowingFileTree {
476- return m .fileTreeV2 .Width ()
476+ return m .fileTree .Width ()
477477 }
478478
479479 return 0
@@ -508,7 +508,7 @@ func (m *mainModel) setCursor(cursor int) tea.Cmd {
508508 var cmd tea.Cmd
509509 m .cursor = cursor
510510 m .diffViewer , cmd = m .diffViewer .SetFilePatch (m .files [m .cursor ])
511- m .fileTreeV2 .SetCursor (m .cursor )
511+ m .fileTree .SetCursor (m .cursor )
512512
513513 return cmd
514514}
@@ -600,7 +600,7 @@ func (m mainModel) handleSearchResultClick(msg tea.MouseMsg) (tea.Model, tea.Cmd
600600 if filenode .GetFileName (f ) == selected {
601601 m .cursor = i
602602 m .diffViewer , cmd = m .diffViewer .SetFilePatch (f )
603- m .fileTreeV2 .SetCursor (i )
603+ m .fileTree .SetCursor (i )
604604 cmds = append (cmds , cmd )
605605 break
606606 }
@@ -633,10 +633,10 @@ func (m mainModel) handleFileTreeClick(msg tea.MouseMsg) (tea.Model, tea.Cmd) {
633633 if y < 0 {
634634 return m , nil
635635 }
636- clickedY := y + m .fileTreeV2 .ViewportYOffset ()
636+ clickedY := y + m .fileTree .ViewportYOffset ()
637637
638638 // Find file at this Y position using tree traversal.
639- filePath := m .fileTreeV2 .GetFileAtY (clickedY )
639+ filePath := m .fileTree .GetFileAtY (clickedY )
640640 if filePath == "" {
641641 return m , nil
642642 }
@@ -649,7 +649,7 @@ func (m mainModel) handleFileTreeClick(msg tea.MouseMsg) (tea.Model, tea.Cmd) {
649649 var cmd tea.Cmd
650650 m .diffViewer , cmd = m .diffViewer .SetFilePatch (f )
651651 // Use SetCursorNoScroll to avoid jumping the file tree view.
652- m .fileTreeV2 .SetCursorNoScroll (i )
652+ m .fileTree .SetCursorNoScroll (i )
653653 return m , cmd
654654 }
655655 }
@@ -665,13 +665,13 @@ func (m mainModel) handleScroll(msg tea.MouseMsg) (tea.Model, tea.Cmd) {
665665 if m .searching {
666666 m .resultsVp .ScrollUp (lines )
667667 } else {
668- m .fileTreeV2 .ScrollUp (lines )
668+ m .fileTree .ScrollUp (lines )
669669 }
670670 } else {
671671 if m .searching {
672672 m .resultsVp .ScrollDown (lines )
673673 } else {
674- m .fileTreeV2 .ScrollDown (lines )
674+ m .fileTree .ScrollDown (lines )
675675 }
676676 }
677677 return m , nil
@@ -712,7 +712,7 @@ func (m mainModel) handleSidebarDrag(msg tea.MouseMsg) (tea.Model, tea.Cmd) {
712712 cmds := []tea.Cmd {}
713713
714714 cmds = append (cmds , m .diffViewer .SetSize (m .width - newWidth , m .mainContentHeight ()))
715- m .fileTreeV2 .SetSize (newWidth - 1 , m .mainContentHeight ()- searchHeight - 1 )
715+ m .fileTree .SetSize (newWidth - 1 , m .mainContentHeight ()- searchHeight - 1 )
716716
717717 return m , tea .Batch (cmds ... )
718718}
0 commit comments