@@ -32,6 +32,9 @@ const (
3232 zoneFileTree = "filetree"
3333 zoneSearchResults = "searchresults"
3434 zoneDiffViewer = "diffviewer"
35+
36+ // Sidebar resize detection threshold in pixels.
37+ sidebarGrabThreshold = 2
3538)
3639
3740type mainModel struct {
@@ -260,6 +263,15 @@ func (m mainModel) View() string {
260263 Width (width ).
261264 Border (lipgloss .NormalBorder (), false , true , false , false ).
262265 BorderForeground (lipgloss .Color ("8" )).Render (content )
266+ } else {
267+ // Show a thin grab line when sidebar is hidden.
268+ grabLine := lipgloss .NewStyle ().
269+ Width (0 ).
270+ Height (m .height - footerHeight - headerHeight ).
271+ Border (lipgloss .NormalBorder (), false , true , false , false ).
272+ BorderForeground (lipgloss .Color ("8" )).
273+ Render ("" )
274+ sidebar = grabLine
263275 }
264276 dv := lipgloss .NewStyle ().MaxHeight (m .height - m .footerHeight () - m .headerHeight ()).Width (m .width - m .sidebarWidth ()).Render (m .diffViewer .View ())
265277 dv = zone .Mark (zoneDiffViewer , dv )
@@ -377,8 +389,14 @@ func (m mainModel) handleMouse(msg tea.MouseMsg) (tea.Model, tea.Cmd) {
377389 if msg .Button == tea .MouseButtonLeft {
378390 // Keep coordinate check for resize border (hybrid approach).
379391 sidebarWidth := m .sidebarWidth ()
380- if m .isShowingFileTree && abs (msg .X - sidebarWidth ) <= 2 {
392+ if m .isShowingFileTree && abs (msg .X - sidebarWidth ) <= sidebarGrabThreshold {
393+ m .draggingSidebar = true
394+ return m , nil
395+ }
396+ // Allow grabbing the line when sidebar is hidden.
397+ if ! m .isShowingFileTree && msg .X <= sidebarGrabThreshold {
381398 m .draggingSidebar = true
399+ m .isShowingFileTree = true
382400 return m , nil
383401 }
384402
0 commit comments