Visitar URL original
feat: hide-left-sidebar toggle (|) for the explorer by GitBluub · Pull Request #476 · janosmiko/lfk · GitHub
Skip to content

feat: hide-left-sidebar toggle (|) for the explorer - #476

Merged
janosmiko merged 2 commits into
janosmiko:mainfrom
GitBluub:feature/hide-left-pane
Jun 24, 2026
Merged

janosmiko merged 2 commits into
janosmiko:mainfrom
GitBluub:feature/hide-left-pane

Conversation

@GitBluub

@GitBluub GitBluub commented Jun 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds a per-tab toggle (|) that hides only the explorer's left resource-type sidebar while keeping the middle list and right preview visible. This is distinct from F fullscreen (which hides both side panes) — useful when browsing a single resource kind (e.g. secrets) where the resource-type column is just noise.

Why:
I don't really feel the need for the sidebar, coming from k9s i use : a lot especially with the completion. But i also really liked what you did with the preview so I wanted to have a 2 column layout for this. I also needed to tweak some width calculation everywhere (for mouse input for exemple) so I made a function to wrap all these calculations.

Type of change

  • feat: new user-facing feature
  • fix: bug fix
  • refactor: code change that neither fixes a bug nor adds a feature
  • docs: documentation only
  • test: add or update tests
  • chore: maintenance (dependencies, tooling)
  • perf: performance improvement
  • ci: CI/CD configuration

Related issue

Changes

  • New keybinding kb.HideSidebar (default |) toggling per-tab hideLeftPane state (saved/restored in tabs.go).
  • explorerColumnWidths() in view.go is now the single source of truth for left/middle/right widths; mouse hit-tests (columnBoundaries), footer renderer (rightFooterInnerWidth), preview-scroll clamp (clampPreviewScroll), and dashboard width (dashboardContentWidth) all route through it so every mode (fullscreen, hide-sidebar) stays in lock-step.
  • New viewExplorerTwoColMiddleRight renderer for the middle+right layout.
  • Fixes a mouse bug: clicks in the now-hidden left band no longer navigate to the parent level (columnBoundaries collapses the left band to width 0).
  • Docs + in-app help updated: README, docs/keybindings.md, docs/config-reference.md, docs/config.schema.json, help section.
  • Tests: TestHandleKeyPipeTogglesHideLeftPane, TestColumnBoundariesRespectsHideLeftPane.

Testing

  • go build ./... succeeds
  • go test ./... passes (incl. -race)
  • golangci-lint run passes — edit : was able to run it, it passes with golangci-lint 2.12.2
  • Manually verified against a real cluster (when behavior changed)

Checklist

  • Commits follow conventional commit style (feat:, fix:, refactor:, docs:, test:, chore:, perf:, ci:)
  • README / docs/ updated when user-visible behavior or config changed
  • docs/keybindings.md and the in-app help screen updated when keybindings changed
  • No secrets, tokens, or personal data included in diffs, logs, or screenshots
  • PR is opened from a feature branch on my fork (not from my fork's main)

Screenshots / recordings

@coderabbitai

coderabbitai Bot commented Jun 23, 2026 •

Copy link
Copy Markdown

Review Change Stack

Summary by CodeRabbit

  • New Features
    • Added a new layout cycle for F: hide the left sidebar, switch to fullscreen, then restore the normal layout.
    • Added a clearer “Hide / show left resource-type sidebar” help entry.
  • Documentation
    • Updated keybinding and config docs to reflect the new layout behavior and the revised F shortcut descriptions.
  • Bug Fixes
    • Improved layout and mouse handling so clicks, scrolling, and pane sizing stay consistent when the sidebar is hidden or fullscreen is active.

Walkthrough

The F keybinding in explorer mode is changed from a simple fullscreen toggle to a three-phase layout cycle: normal → sidebar hidden → fullscreen middle column → normal. A new hideLeftPane boolean field is added to Model and TabState, persisted through saveCurrentTab/loadTab. A centralized explorerColumnWidths() method replaces inline width calculations across viewExplorer, clampPreviewScroll, rightFooterInnerWidth, dashboardContentWidth, and columnBoundaries. A new viewExplorerTwoColMiddleRight renderer handles the two-column layout. Port-forward helper functions are extracted from tabs.go into a new tabs_portforward.go file, and easter-egg state fields are consolidated into a new easterEggState struct.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 70.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main feature, though it mentions the old | hotkey instead of the updated Shift+F behavior.
Description check ✅ Passed The description follows the template and covers summary, type, changes, testing, and checklist, with only minor gaps.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@GitBluub
GitBluub force-pushed the feature/hide-left-pane branch from bff2dc5 to 9d913c5 Compare June 23, 2026 17:58
@GitBluub
GitBluub marked this pull request as ready for review June 23, 2026 18:04
@GitBluub
GitBluub requested a review from janosmiko as a code owner June 23, 2026 18:04
janosmiko
janosmiko previously approved these changes Jun 24, 2026
@janosmiko

Copy link
Copy Markdown
Owner

Hi @GitBluub ,

Thanks for your contribution. I like this idea, but I changed the hotkey and the logic to work a bit differently as I'd like to keep the | hotkey for a future feature I'm still working on.

So I updated your PR, shift+F will first hide the left sidebar and on next hit it'll go to fullscreen. Similar functionality, easy to remember.

GitBluub and others added 2 commits June 24, 2026 19:51
Adds a per-tab toggle (kb.HideSidebar, bound to `|`) that hides only the
left resource-type sidebar while keeping the middle list and right preview
visible. Centralizes column-width math in explorerColumnWidths() so mouse
hit-tests, footer renderers, preview-scroll clamps, and dashboard width all
flow through one source of truth and respect the wider layout when the
sidebar is hidden.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Fold the hide-left-sidebar toggle into Shift+F as a 3-phase layout
cycle for the three-pane explorer: normal -> sidebar hidden ->
fullscreen -> normal. Drop the dedicated kb.HideSidebar (`|`) binding.
Dashboards keep their plain fullscreen toggle. Status messages share a
consistent "Layout: ..." prefix.

Keep both app.go and tabs.go under the 800-line revive cap (breached
after merging main) by extracting cohesive groups into new files,
mirroring the existing securityModelState pattern:
- easter_egg_state.go: embedded easterEggState sub-struct
- tabs_portforward.go: port-forward list helpers

Update tests, README, docs/keybindings.md, docs/config-reference.md,
docs/config.schema.json, and the in-app help.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@janosmiko
janosmiko force-pushed the feature/hide-left-pane branch from bba7ecc to 43dda9e Compare June 24, 2026 17:51

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@internal/app/tabs_portforward.go`:
- Line 56: The context loading in the port-forward tab is ignoring failures
because `GetContexts()` is called with a discarded error, which can leave
navigation state partially updated. Update the context-loading path in the tab
navigation flow to check the error from `m.client.GetContexts()` before mutating
state, return early on failure, and surface the problem through the existing
status messaging mechanism so the user gets feedback instead of a broken history
state.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d6262a1e-4ce5-46f0-a945-757a3110ca25

📥 Commits

Reviewing files that changed from the base of the PR and between 9d913c5 and 43dda9e.

📒 Files selected for processing (17)
  • README.md
  • docs/config-reference.md
  • docs/keybindings.md
  • internal/app/app.go
  • internal/app/app_types.go
  • internal/app/commands_dashboard.go
  • internal/app/easter_egg_state.go
  • internal/app/recompose.go
  • internal/app/tabs.go
  • internal/app/tabs_portforward.go
  • internal/app/update_keys_explorer.go
  • internal/app/update_keys_test.go
  • internal/app/update_mouse.go
  • internal/app/update_mouse_test.go
  • internal/app/view.go
  • internal/app/view_dashboard.go
  • internal/app/view_right.go
💤 Files with no reviewable changes (1)
  • internal/app/view_right.go
✅ Files skipped from review due to trivial changes (4)
  • internal/app/easter_egg_state.go
  • docs/config-reference.md
  • docs/keybindings.md
  • README.md
🚧 Files skipped from review as they are similar to previous changes (8)
  • internal/app/app_types.go
  • internal/app/commands_dashboard.go
  • internal/app/recompose.go
  • internal/app/view_dashboard.go
  • internal/app/update_mouse_test.go
  • internal/app/update_mouse.go
  • internal/app/tabs.go
  • internal/app/view.go

m.pushJumpHistory()

// Build the correct left column state for LevelResources.
contexts, _ := m.client.GetContexts()

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Handle GetContexts() errors before mutating navigation state.

contexts, _ := m.client.GetContexts() drops failures and continues, which can leave the view in a partially updated state with broken history and no user feedback. Return early on error and surface it via status messaging.

Suggested fix
-	contexts, _ := m.client.GetContexts()
+	contexts, err := m.client.GetContexts()
+	if err != nil {
+		m.setStatusMessage(fmt.Sprintf("failed to load contexts: %v", err), true)
+		return m.scheduleStatusClear()
+	}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
contexts, _ := m.client.GetContexts()
contexts, err := m.client.GetContexts()
if err != nil {
m.setStatusMessage(fmt.Sprintf("failed to load contexts: %v", err), true)
return m.scheduleStatusClear()
}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@internal/app/tabs_portforward.go` at line 56, The context loading in the
port-forward tab is ignoring failures because `GetContexts()` is called with a
discarded error, which can leave navigation state partially updated. Update the
context-loading path in the tab navigation flow to check the error from
`m.client.GetContexts()` before mutating state, return early on failure, and
surface the problem through the existing status messaging mechanism so the user
gets feedback instead of a broken history state.

Source: Coding guidelines

@janosmiko
janosmiko merged commit c1a895a into janosmiko:main Jun 24, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants