Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

feat: Select mode with better feedback#1074

Merged
lazysegtree merged 1 commit into
mainyorukot/superfile:mainfrom
select-iconyorukot/superfile:select-iconCopy head branch name to clipboard
Sep 18, 2025
Merged

feat: Select mode with better feedback#1074
lazysegtree merged 1 commit into
mainyorukot/superfile:mainfrom
select-iconyorukot/superfile:select-iconCopy head branch name to clipboard

Conversation

@lazysegtree

@lazysegtree lazysegtree commented Sep 15, 2025

Copy link
Copy Markdown
Collaborator

User request - #1071 (comment)

image

Summary by CodeRabbit

  • New Features

    • Optional checkbox icons in select mode, showing checked/empty states next to items; visuals adapt to panel focus.
  • Configuration

    • Added show_select_icons option (default: true) to enable/disable checkbox icons in select mode. Requires Nerd Font.
  • Style

    • New select-box styling uses the file-panel background for consistent appearance.
  • Documentation

    • Config guide updated with show_select_icons usage and Nerd Font note.

@lazysegtree
lazysegtree marked this pull request as draft September 15, 2025 01:37
@coderabbitai

coderabbitai Bot commented Sep 15, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

Adds checkbox icons and styled pre-rendered checkbox strings, a config flag to enable showing checkbox icons in select mode, a file-panel select-box style, rendering to display per-item checkboxes in select mode, updates default config, and documents the new option.

Changes

Cohort / File(s) Summary
Icons
src/config/icon/icon.go
Adds CheckboxEmpty and CheckboxChecked icon constants in the "other" icon group; minor alignment/formatting adjustments.
Config type & default
src/internal/common/config_type.go, src/superfile_config/config.toml
Adds ShowSelectIcons bool to ConfigType (TOML: show_select_icons) and sets show_select_icons = true in default config with explanatory comment.
Predefined styled values
src/internal/common/predefined_variable.go
Adds CheckboxChecked, CheckboxCheckedFocused, CheckboxEmpty, CheckboxEmptyFocused and initializes them in LoadPrerenderedVariables() with lipgloss-styled checkbox strings (foreground colors and trailing space).
Styling
src/internal/common/style.go
Adds FilePanelSelectBoxStyle and initializes it in LoadThemeConfig with FilePanelBGColor background.
Rendering logic
src/internal/model_render.go
Renders a select box between the cursor and filename when ShowSelectIcons + Nerdfont are enabled and panel is in select mode; adds filePanel.renderSelectBox(isSelected bool) and adjusts prefix width/padding to preserve alignment.
Docs
website/src/content/docs/configure/superfile-config.mdx
Documents show_select_icons option with true/false meanings and note that it requires nerdfont = true.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  participant U as User
  participant UI as UI Loop
  participant FP as filePanel
  participant C as Config
  participant I as Icons/Vars
  participant S as Styles

  U->>UI: trigger render
  UI->>FP: render file list
  FP->>C: read nerdfont, show_select_icons, panelMode
  alt show_select_icons && nerdfont && selectMode
    loop per item
      FP->>FP: isSelected = contains(selected, item)
      FP->>I: pick CheckboxChecked or CheckboxEmpty (focused variant if focused)
      FP->>S: style via FilePanelSelectBoxStyle + border color
      FP-->>UI: emit cursor + select box + padded filename
    end
  else
    FP-->>UI: emit cursor + padded filename
  end
  UI-->>U: paint updated list
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

I nibble through the file parade,
Tiny boxes checked or neatly laid.
A styled border, a gentle light,
Selects now sparkle in the night.
Hop along — the list feels right. 🐇✅

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "feat: Select mode with better feedback" is a concise, single-sentence summary that accurately reflects the main change set—adding checkbox icons, related styles, config, rendering logic, and docs to improve visual feedback in select mode. It directly relates to the changes in the provided summary and is specific enough for a reviewer scanning history to understand the primary UI improvement.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch select-icon

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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 and usage tips.

codescene-delta-analysis[bot]

This comment was marked as outdated.

codescene-delta-analysis[bot]

This comment was marked as outdated.

Comment thread src/internal/model_render.go Outdated
Comment thread src/internal/model_render.go Outdated
codescene-delta-analysis[bot]

This comment was marked as outdated.

@lazysegtree
lazysegtree marked this pull request as ready for review September 15, 2025 09:32
@lazysegtree
lazysegtree requested a review from yorukot September 15, 2025 09:32
codescene-delta-analysis[bot]

This comment was marked as outdated.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (4)
src/superfile_config/config.toml (1)

60-62: Consider auto‑ignoring when nerdfont=false.

To avoid “tofu” glyphs when users disable Nerdfont, either document that this flag is ignored unless nerdfont=true (in docs) or gate in rendering (see suggested code in model_render.go comment).

website/src/content/docs/configure/superfile-config.mdx (1)

178-183: Tiny doc nit: clarify interaction with nerdfont.

Add a note like “Ignored when nerdfont is false” or mention ASCII fallback if implemented.

src/internal/model_render.go (2)

146-149: Width budget not adjusted for the new select box (potential overflow/truncation).

PrettierName still uses a fixed “-5” but the line prefix grew by the checkbox. Compute the name width from the actual rendered prefix to keep alignment stable.

Apply this minimal refactor:

-        renderedName := common.PrettierName(
-            panel.element[i].name,
-            filePanelWidth-5,
-            dirExists,
-            isSelected,
-            common.FilePanelBGColor,
-        )
-
-        selectBox := panel.renderSelectBox(isSelected)
-        r.AddLines(common.FilePanelCursorStyle.Render(cursor+" ") + selectBox + renderedName)
+        selectBox := panel.renderSelectBox(isSelected)
+        prefix := common.FilePanelCursorStyle.Render(cursor+" ") + selectBox
+        // Keep the historical padding equivalent to the old “-5”:
+        basePadding := 5 - lipgloss.Width(common.FilePanelCursorStyle.Render(cursor+" "))
+        nameWidth := max(1, filePanelWidth - lipgloss.Width(prefix) - basePadding)
+        renderedName := common.PrettierName(
+            panel.element[i].name,
+            nameWidth,
+            dirExists,
+            isSelected,
+            common.FilePanelBGColor,
+        )
+        r.AddLines(prefix + renderedName)

187-207: Gate select icons behind Nerdfont (or provide ASCII fallback).

Docs say “requires nerdfont” but code doesn’t check it. Minimal change: only render when Nerdfont is enabled.

- if common.Config.ShowSelectIcons && panel.panelMode == selectMode {
+ if common.Config.ShowSelectIcons && panel.panelMode == selectMode && common.Config.Nerdfont {

Optionally, else-render ASCII “[x] ”/“[ ] ” to degrade gracefully when Nerdfont is off.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a07eac0 and 21d9223.

📒 Files selected for processing (6)
  • src/config/icon/icon.go (1 hunks)
  • src/internal/common/config_type.go (1 hunks)
  • src/internal/common/style.go (2 hunks)
  • src/internal/model_render.go (2 hunks)
  • src/superfile_config/config.toml (1 hunks)
  • website/src/content/docs/configure/superfile-config.mdx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: lazysegtree
PR: yorukot/superfile#963
File: src/internal/default_config.go:16-16
Timestamp: 2025-07-27T07:40:51.938Z
Learning: lazysegtree prefers simpler implementation approaches when the alternatives are significantly more complex, even if the alternatives might be architecturally cleaner, prioritizing maintainability and avoiding over-engineering.
Learnt from: lazysegtree
PR: yorukot/superfile#963
File: src/internal/default_config.go:16-16
Timestamp: 2025-07-27T07:40:51.938Z
Learning: lazysegtree prefers simpler implementation approaches when the alternatives are significantly more complex, even if the alternatives might be architecturally cleaner, prioritizing maintainability and avoiding over-engineering.
Learnt from: lazysegtree
PR: yorukot/superfile#969
File: src/internal/key_function.go:40-40
Timestamp: 2025-08-03T09:34:55.721Z
Learning: lazysegtree emphasizes proper dependency direction in software architecture, preferring that low-level components (like modal handlers) should not depend on high-level components (like the main model object). He also prioritizes performance considerations, noting that creating objects on every keypress in hot code paths like key handling is inefficient and should be avoided.
Learnt from: lazysegtree
PR: yorukot/superfile#1013
File: src/internal/model_render.go:329-341
Timestamp: 2025-08-29T14:11:21.380Z
Learning: lazysegtree prefers to defer help menu rendering optimizations and other technical debt improvements to separate GitHub issues when the current PR scope has grown too large, maintaining focus on the primary refactoring objectives while tracking performance improvements for future work.
Learnt from: lazysegtree
PR: yorukot/superfile#985
File: src/internal/model.go:0-0
Timestamp: 2025-08-11T01:49:30.040Z
Learning: lazysegtree prefers maintaining code correctness through proper design and invariants rather than adding defensive bounds checks at every slice access point, viewing such defensive programming as "duct taping" that can mask actual bugs instead of fixing them at their source.
Learnt from: lazysegtree
PR: yorukot/superfile#973
File: src/internal/ui/processbar/model_update.go:7-27
Timestamp: 2025-08-03T14:49:31.221Z
Learning: lazysegtree prefers to keep test-only code simple without adding production-level concerns like goroutine synchronization, cancellation contexts, or complex lifecycle management, even when such patterns might prevent potential issues, since the complexity isn't justified for test utilities.
Learnt from: lazysegtree
PR: yorukot/superfile#1044
File: src/internal/utils/file_utils.go:149-149
Timestamp: 2025-09-09T13:29:11.771Z
Learning: lazysegtree prefers to keep PR scope focused on the primary objectives and considers pre-existing technical debt issues as out of scope for migration/refactoring PRs, preferring to defer such issues to separate GitHub issues rather than expanding the current PR scope.
Learnt from: lazysegtree
PR: yorukot/superfile#950
File: src/internal/ui/metadata/README.md:7-7
Timestamp: 2025-07-24T03:46:29.516Z
Learning: lazysegtree prefers to defer comprehensive unit testing to separate PRs when the current PR has grown too large, maintaining focus on the primary refactoring objectives while tracking testing requirements in dedicated GitHub issues.
Learnt from: lazysegtree
PR: yorukot/superfile#967
File: src/internal/key_function.go:45-47
Timestamp: 2025-08-02T11:47:07.713Z
Learning: lazysegtree prefers to track technical debt and architectural improvements in dedicated GitHub issues when they are identified during PR reviews but are beyond the scope of the current PR, particularly for complex refactoring needs like input handling architecture that would require significant changes.
Learnt from: lazysegtree
PR: yorukot/superfile#963
File: src/internal/handle_file_operations.go:567-570
Timestamp: 2025-07-27T08:49:09.687Z
Learning: lazysegtree prefers to defer technical debt issues like model mutation concerns to later PRs when the current PR has already grown too large, maintaining focus on the primary objectives while acknowledging the need to track such issues for future work.
📚 Learning: 2025-04-12T13:51:24.691Z
Learnt from: lazysegtree
PR: yorukot/superfile#770
File: src/internal/ui/sidebar/render.go:0-0
Timestamp: 2025-04-12T13:51:24.691Z
Learning: In the sidebar component of yorukot/superfile, the partial list rendering in render.go is intentional. The sidebar implements scrolling functionality where ListUp/ListDown methods in navigation.go update cursor position and renderIndex to show the appropriate portion of the directory list based on available space.

Applied to files:

  • src/internal/model_render.go
🧬 Code graph analysis (1)
src/internal/model_render.go (3)
src/internal/common/style.go (4)
  • FilePanelCursorStyle (30-30)
  • FilePanelBorderColor (68-68)
  • FilePanelBorderActiveColor (72-72)
  • FilePanelSelectBoxStyle (39-39)
src/internal/common/default_config.go (1)
  • Config (11-11)
src/config/icon/icon.go (3)
  • CheckboxChecked (35-35)
  • CheckboxEmpty (34-34)
  • Space (10-10)
🔇 Additional comments (3)
src/internal/common/config_type.go (1)

86-86: Config flag LGTM; placement and TOML tag are correct.

No issues here.

src/internal/common/style.go (1)

39-39: Good: dedicated style for the select box.

Exported var and theme initialization look consistent with existing patterns.

Also applies to: 195-195

src/config/icon/icon.go (1)

31-47: Icons added in the right group; names/readability OK.

Nice reuse of existing Space const; no concerns.

codescene-delta-analysis[bot]

This comment was marked as outdated.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

♻️ Duplicate comments (1)
src/internal/model_render.go (1)

190-210: Helper looks good; prior feedback addressed. Consider early return for readability.

Nice: moved to predefined style and icon consts. This addresses earlier “Move to icon consts” and “Move this to a predefined style.”

 func (panel *filePanel) renderSelectBox(isSelected bool) string {
-    selectBox := ""
-    if common.Config.ShowSelectIcons && common.Config.Nerdfont && panel.panelMode == selectMode {
-        if isSelected {
-            selectBox = icon.CheckboxChecked
-        } else {
-            selectBox = icon.CheckboxEmpty
-        }
-        selectBox += icon.Space
-
-        borderColor := common.FilePanelBorderColor
-        if panel.isFocused {
-            borderColor = common.FilePanelBorderActiveColor
-        }
-
-        selectBox = common.FilePanelSelectBoxStyle.
-            Foreground(borderColor).
-            Render(selectBox)
-    }
-    return selectBox
+    if !(common.Config.ShowSelectIcons && common.Config.Nerdfont && panel.panelMode == selectMode) {
+        return ""
+    }
+    glyph := icon.CheckboxEmpty
+    if isSelected {
+        glyph = icon.CheckboxChecked
+    }
+    color := common.FilePanelBorderColor
+    if panel.isFocused {
+        color = common.FilePanelBorderActiveColor
+    }
+    return common.FilePanelSelectBoxStyle.Foreground(color).Render(glyph + icon.Space)
 }

Optional (not required): ASCII fallback when Nerdfont is off (e.g., "[x] " / "[ ] ") to preserve affordance without Nerd Font.

#!/bin/bash
# Verify supporting symbols/config exist
set -euo pipefail
echo "Icons:"
rg -nP 'Checkbox(Empty|Checked)\s*=' src/config/icon/icon.go -C1
echo "Style var:"
rg -nP '\bFilePanelSelectBoxStyle\b' src/internal/common/style.go -n -C2
echo "Config flag (type + docs + default):"
rg -nP 'ShowSelectIcons' -n -C2 src/internal/common/config_type.go
rg -nP 'show_select_icons' -n -C2 src/superfile_config/** website/** 2>/dev/null || true
echo "Call sites:"
rg -nP 'renderSelectBox\(' -n -C2 src/internal/model_render.go
🧹 Nitpick comments (3)
src/internal/model_render.go (3)

138-138: Select-box integration and gating look correct.

Good use of ShowSelectIcons + Nerdfont + selectMode to gate rendering. Optional: precompute styled checked/empty strings once per panel (based on focus) and reuse inside the loop to avoid per-row style construction.


140-142: Compute width on the styled cursor and reuse it to avoid double rendering.

Minor consistency/perf tidy-up: render the cursor once, use it for both width and output.

-        // Calculate the actual prefix width for proper alignment
-        prefixWidth := lipgloss.Width(cursor+" ") + lipgloss.Width(selectBox)
+        // Calculate the actual prefix width for proper alignment
+        cursorStr := common.FilePanelCursorStyle.Render(cursor + " ")
+        prefixWidth := lipgloss.Width(cursorStr) + lipgloss.Width(selectBox)
@@
-        r.AddLines(common.FilePanelCursorStyle.Render(cursor+" ") + selectBox + renderedName)
+        r.AddLines(cursorStr + selectBox + renderedName)

Also applies to: 151-151


145-145: Clamp available width to avoid negative values on very narrow panels.

If filePanelWidth < prefixWidth, TruncateText may receive a negative width. Clamp to 0 to be safe.

-            filePanelWidth-prefixWidth,
+            max(0, filePanelWidth-prefixWidth),
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 21d9223 and db65bab.

📒 Files selected for processing (6)
  • src/config/icon/icon.go (1 hunks)
  • src/internal/common/config_type.go (1 hunks)
  • src/internal/common/style.go (2 hunks)
  • src/internal/model_render.go (2 hunks)
  • src/superfile_config/config.toml (1 hunks)
  • website/src/content/docs/configure/superfile-config.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (5)
  • src/internal/common/style.go
  • website/src/content/docs/configure/superfile-config.mdx
  • src/config/icon/icon.go
  • src/internal/common/config_type.go
  • src/superfile_config/config.toml
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: lazysegtree
PR: yorukot/superfile#963
File: src/internal/default_config.go:16-16
Timestamp: 2025-07-27T07:40:51.938Z
Learning: lazysegtree prefers simpler implementation approaches when the alternatives are significantly more complex, even if the alternatives might be architecturally cleaner, prioritizing maintainability and avoiding over-engineering.
Learnt from: lazysegtree
PR: yorukot/superfile#963
File: src/internal/default_config.go:16-16
Timestamp: 2025-07-27T07:40:51.938Z
Learning: lazysegtree prefers simpler implementation approaches when the alternatives are significantly more complex, even if the alternatives might be architecturally cleaner, prioritizing maintainability and avoiding over-engineering.
Learnt from: lazysegtree
PR: yorukot/superfile#969
File: src/internal/key_function.go:40-40
Timestamp: 2025-08-03T09:34:55.721Z
Learning: lazysegtree emphasizes proper dependency direction in software architecture, preferring that low-level components (like modal handlers) should not depend on high-level components (like the main model object). He also prioritizes performance considerations, noting that creating objects on every keypress in hot code paths like key handling is inefficient and should be avoided.
Learnt from: lazysegtree
PR: yorukot/superfile#1013
File: src/internal/model_render.go:329-341
Timestamp: 2025-08-29T14:11:21.380Z
Learning: lazysegtree prefers to defer help menu rendering optimizations and other technical debt improvements to separate GitHub issues when the current PR scope has grown too large, maintaining focus on the primary refactoring objectives while tracking performance improvements for future work.
Learnt from: lazysegtree
PR: yorukot/superfile#985
File: src/internal/model.go:0-0
Timestamp: 2025-08-11T01:49:30.040Z
Learning: lazysegtree prefers maintaining code correctness through proper design and invariants rather than adding defensive bounds checks at every slice access point, viewing such defensive programming as "duct taping" that can mask actual bugs instead of fixing them at their source.
Learnt from: lazysegtree
PR: yorukot/superfile#973
File: src/internal/ui/processbar/model_update.go:7-27
Timestamp: 2025-08-03T14:49:31.221Z
Learning: lazysegtree prefers to keep test-only code simple without adding production-level concerns like goroutine synchronization, cancellation contexts, or complex lifecycle management, even when such patterns might prevent potential issues, since the complexity isn't justified for test utilities.
Learnt from: lazysegtree
PR: yorukot/superfile#1044
File: src/internal/utils/file_utils.go:149-149
Timestamp: 2025-09-09T13:29:11.771Z
Learning: lazysegtree prefers to keep PR scope focused on the primary objectives and considers pre-existing technical debt issues as out of scope for migration/refactoring PRs, preferring to defer such issues to separate GitHub issues rather than expanding the current PR scope.
Learnt from: lazysegtree
PR: yorukot/superfile#950
File: src/internal/ui/metadata/README.md:7-7
Timestamp: 2025-07-24T03:46:29.516Z
Learning: lazysegtree prefers to defer comprehensive unit testing to separate PRs when the current PR has grown too large, maintaining focus on the primary refactoring objectives while tracking testing requirements in dedicated GitHub issues.
Learnt from: lazysegtree
PR: yorukot/superfile#967
File: src/internal/key_function.go:45-47
Timestamp: 2025-08-02T11:47:07.713Z
Learning: lazysegtree prefers to track technical debt and architectural improvements in dedicated GitHub issues when they are identified during PR reviews but are beyond the scope of the current PR, particularly for complex refactoring needs like input handling architecture that would require significant changes.
Learnt from: lazysegtree
PR: yorukot/superfile#963
File: src/internal/handle_file_operations.go:567-570
Timestamp: 2025-07-27T08:49:09.687Z
Learning: lazysegtree prefers to defer technical debt issues like model mutation concerns to later PRs when the current PR has already grown too large, maintaining focus on the primary objectives while acknowledging the need to track such issues for future work.
📚 Learning: 2025-04-12T13:51:24.691Z
Learnt from: lazysegtree
PR: yorukot/superfile#770
File: src/internal/ui/sidebar/render.go:0-0
Timestamp: 2025-04-12T13:51:24.691Z
Learning: In the sidebar component of yorukot/superfile, the partial list rendering in render.go is intentional. The sidebar implements scrolling functionality where ListUp/ListDown methods in navigation.go update cursor position and renderIndex to show the appropriate portion of the directory list based on available space.

Applied to files:

  • src/internal/model_render.go
🧬 Code graph analysis (1)
src/internal/model_render.go (4)
src/internal/common/string_function.go (1)
  • PrettierName (61-74)
src/internal/common/style.go (5)
  • FilePanelBGColor (78-78)
  • FilePanelCursorStyle (30-30)
  • FilePanelBorderColor (68-68)
  • FilePanelBorderActiveColor (72-72)
  • FilePanelSelectBoxStyle (39-39)
src/internal/common/default_config.go (1)
  • Config (11-11)
src/config/icon/icon.go (3)
  • CheckboxChecked (35-35)
  • CheckboxEmpty (34-34)
  • Space (10-10)

@codescene-delta-analysis codescene-delta-analysis 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.

Gates Failed
Prevent hotspot decline (1 hotspot with Complex Conditional)

Gates Passed
2 Quality Gates Passed

See analysis details in CodeScene

Reason for failure
Prevent hotspot decline Violations Code Health Impact
model_render.go 1 rule in this hotspot 8.66 → 8.40 Suppress

Quality Gate Profile: The Bare Minimum
Want more control? Customize Code Health rules or catch issues early with our IDE extension and CLI tool.

}

func (panel *filePanel) renderSelectBox(isSelected bool) string {
if !common.Config.ShowSelectIcons || !common.Config.Nerdfont || panel.panelMode != selectMode {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

❌ New issue: Complex Conditional
renderSelectBox has 1 complex conditionals with 2 branches, threshold = 2

Suppress

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The hell ? How simpler you want it to be. This is simple enough.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
src/internal/common/predefined_variable.go (1)

53-57: LGTM; add brief doc comments for clarity and consistency with Go’s exported identifiers

Names/readability are fine. Given prior preference for simple implementations, this exported pre-rendered set works well. Add short godoc lines so callers know these include a trailing space and are file‑panel–scoped.

Apply this diff to document intent:

 var (
-	CheckboxChecked        string
-	CheckboxCheckedFocused string
-	CheckboxEmpty          string
-	CheckboxEmptyFocused   string
+	// CheckboxChecked is the styled checkbox for selected items (trailing space included).
+	CheckboxChecked string
+	// CheckboxCheckedFocused is the styled checkbox when the file panel is focused.
+	CheckboxCheckedFocused string
+	// CheckboxEmpty is the styled checkbox for unselected items (trailing space included).
+	CheckboxEmpty string
+	// CheckboxEmptyFocused is the styled checkbox when the file panel is focused.
+	CheckboxEmptyFocused string
 )
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between db65bab and cd90062.

📒 Files selected for processing (7)
  • src/config/icon/icon.go (1 hunks)
  • src/internal/common/config_type.go (1 hunks)
  • src/internal/common/predefined_variable.go (2 hunks)
  • src/internal/common/style.go (2 hunks)
  • src/internal/model_render.go (2 hunks)
  • src/superfile_config/config.toml (1 hunks)
  • website/src/content/docs/configure/superfile-config.mdx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (6)
  • src/internal/common/config_type.go
  • src/internal/common/style.go
  • website/src/content/docs/configure/superfile-config.mdx
  • src/internal/model_render.go
  • src/config/icon/icon.go
  • src/superfile_config/config.toml
🧰 Additional context used
🧠 Learnings (1)
📓 Common learnings
Learnt from: lazysegtree
PR: yorukot/superfile#963
File: src/internal/default_config.go:16-16
Timestamp: 2025-07-27T07:40:51.938Z
Learning: lazysegtree prefers simpler implementation approaches when the alternatives are significantly more complex, even if the alternatives might be architecturally cleaner, prioritizing maintainability and avoiding over-engineering.
Learnt from: lazysegtree
PR: yorukot/superfile#963
File: src/internal/default_config.go:16-16
Timestamp: 2025-07-27T07:40:51.938Z
Learning: lazysegtree prefers simpler implementation approaches when the alternatives are significantly more complex, even if the alternatives might be architecturally cleaner, prioritizing maintainability and avoiding over-engineering.
Learnt from: lazysegtree
PR: yorukot/superfile#969
File: src/internal/key_function.go:40-40
Timestamp: 2025-08-03T09:34:55.721Z
Learning: lazysegtree emphasizes proper dependency direction in software architecture, preferring that low-level components (like modal handlers) should not depend on high-level components (like the main model object). He also prioritizes performance considerations, noting that creating objects on every keypress in hot code paths like key handling is inefficient and should be avoided.
Learnt from: lazysegtree
PR: yorukot/superfile#1013
File: src/internal/model_render.go:329-341
Timestamp: 2025-08-29T14:11:21.380Z
Learning: lazysegtree prefers to defer help menu rendering optimizations and other technical debt improvements to separate GitHub issues when the current PR scope has grown too large, maintaining focus on the primary refactoring objectives while tracking performance improvements for future work.
Learnt from: lazysegtree
PR: yorukot/superfile#985
File: src/internal/model.go:0-0
Timestamp: 2025-08-11T01:49:30.040Z
Learning: lazysegtree prefers maintaining code correctness through proper design and invariants rather than adding defensive bounds checks at every slice access point, viewing such defensive programming as "duct taping" that can mask actual bugs instead of fixing them at their source.
Learnt from: lazysegtree
PR: yorukot/superfile#973
File: src/internal/ui/processbar/model_update.go:7-27
Timestamp: 2025-08-03T14:49:31.221Z
Learning: lazysegtree prefers to keep test-only code simple without adding production-level concerns like goroutine synchronization, cancellation contexts, or complex lifecycle management, even when such patterns might prevent potential issues, since the complexity isn't justified for test utilities.
Learnt from: lazysegtree
PR: yorukot/superfile#1044
File: src/internal/utils/file_utils.go:149-149
Timestamp: 2025-09-09T13:29:11.771Z
Learning: lazysegtree prefers to keep PR scope focused on the primary objectives and considers pre-existing technical debt issues as out of scope for migration/refactoring PRs, preferring to defer such issues to separate GitHub issues rather than expanding the current PR scope.
Learnt from: lazysegtree
PR: yorukot/superfile#950
File: src/internal/ui/metadata/README.md:7-7
Timestamp: 2025-07-24T03:46:29.516Z
Learning: lazysegtree prefers to defer comprehensive unit testing to separate PRs when the current PR has grown too large, maintaining focus on the primary refactoring objectives while tracking testing requirements in dedicated GitHub issues.
Learnt from: lazysegtree
PR: yorukot/superfile#967
File: src/internal/key_function.go:45-47
Timestamp: 2025-08-02T11:47:07.713Z
Learning: lazysegtree prefers to track technical debt and architectural improvements in dedicated GitHub issues when they are identified during PR reviews but are beyond the scope of the current PR, particularly for complex refactoring needs like input handling architecture that would require significant changes.
Learnt from: lazysegtree
PR: yorukot/superfile#963
File: src/internal/handle_file_operations.go:567-570
Timestamp: 2025-07-27T08:49:09.687Z
Learning: lazysegtree prefers to defer technical debt issues like model mutation concerns to later PRs when the current PR has already grown too large, maintaining focus on the primary objectives while acknowledging the need to track such issues for future work.
🧬 Code graph analysis (1)
src/internal/common/predefined_variable.go (1)
src/internal/common/style.go (3)
  • FilePanelSelectBoxStyle (39-39)
  • FilePanelBorderColor (68-68)
  • FilePanelBorderActiveColor (72-72)
🔇 Additional comments (1)
src/internal/common/predefined_variable.go (1)

105-116: Init order and spacing verified — optional Copy() only

  • LoadPrerenderedVariables is invoked after icon/theme initialization. (src/internal/config_function.go:55–58; src/internal/common/load_config.go:306–309)
  • renderSelectBox simply returns the pre-rendered Checkbox* strings and does not add extra padding; those strings already include icon.Space. (src/internal/model_render.go:190–205; src/internal/common/predefined_variable.go:105–116)
  • .Copy() is optional — lipgloss Style methods return new, non-mutating Styles; add .Copy() only for explicitness if desired.

@lobaluna

Copy link
Copy Markdown

I am amazed of how fast this is taken into account. Thank you very much, indeed!

@lazysegtree
lazysegtree merged commit 128e563 into main Sep 18, 2025
12 of 13 checks passed
tmeijn pushed a commit to tmeijn/dotfiles that referenced this pull request Oct 15, 2025
This MR contains the following updates:

| Package | Update | Change |
|---|---|---|
| [yorukot/superfile](https://github.com/yorukot/superfile) | minor | `v1.3.3` -> `v1.4.0` |

MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot).

**Proposed changes to behavior should be submitted there as MRs.**

---

### Release Notes

<details>
<summary>yorukot/superfile (yorukot/superfile)</summary>

### [`v1.4.0`](https://github.com/yorukot/superfile/releases/tag/v1.4.0)

[Compare Source](yorukot/superfile@v1.3.3...v1.4.0)

Hey folks. Releasing v1.4.0 with many new features, improvements, and bug fixes.

We have an async file preview now, a zoxide panel, and various new features improving UX.

#### Install:

[**Click me to know how to install**](https://github.com/yorukot/superfile?tab=readme-ov-file#installation)

#### Highlights

- We have the Zoxide Panel now. Ensure zoxide is installed on your system, set `zoxide_support` to `true` in the config, and press `z` to use zoxide. <img width="645" height="295" alt="Image" src="https://github.com/user-attachments/assets/238f6549-5318-49d1-a3a0-14cf8a686955" />

- File previewing is now async, meaning reduced lag while scrolling through images, or on slow systems.

- Many bug fixes. See 'Detailed Change Summary'

##### Internal Updates

- Most file operations are now truly async with the usage of the recommended `tea.Cmd` pattern.
- Enabled many new linters to improve code quality.
- Moved golangci-lint to v2. Now developers don't need to keep the old v1 in their systems.
- Refactored file preview in its own package for better maintainability and readability.
- Fixed flaky unit tests.

#### Detailed Change Summary

<details><summary>Details</summary>
<p>

##### Update
- feat: File operation via tea cmd [#&#8203;963](yorukot/superfile#963) by @&#8203;lazysegtree
- feat: processbar improvements, package separation, better channel management [#&#8203;973](yorukot/superfile#973) by @&#8203;lazysegtree
- feat: enable lll and recvcheck linter, fix tests, more refactors [#&#8203;977](yorukot/superfile#977) by @&#8203;lazysegtree
- feat: Remove channel for notification models [#&#8203;979](yorukot/superfile#979) by @&#8203;lazysegtree
- feat: enable cyclop, funlen, gocognit, gocyclo linters, and refactor large functions [#&#8203;984](yorukot/superfile#984) by @&#8203;lazysegtree
- feat: Add a new hotkey to handle cd-on-quit whenever needed [#&#8203;924](yorukot/superfile#924) by @&#8203;ahmed-habbachi
- feat: added option to permanently delete files [#&#8203;987](yorukot/superfile#987) by @&#8203;hupender
- feat: Preview panel separation [#&#8203;1021](yorukot/superfile#1021) by @&#8203;lazysegtree
- feat: Add search functionality to help menu [#&#8203;1011](yorukot/superfile#1011) by @&#8203;iZarrios
- feat: Use zoxide lib [#&#8203;1036](yorukot/superfile#1036) by @&#8203;lazysegtree
- feat: Add zoxide directory tracking on navigation [#&#8203;1041](yorukot/superfile#1041) by @&#8203;lazysegtree
- feat: Zoxide integration [#&#8203;1039](yorukot/superfile#1039) by @&#8203;lazysegtree
- feat: Select mode with better feedback [#&#8203;1074](yorukot/superfile#1074) by @&#8203;lazysegtree
- feat: owner/group in the metadata [#&#8203;1093](yorukot/superfile#1093) by @&#8203;xelavopelk
- feat: Async zoxide [#&#8203;1104](yorukot/superfile#1104) by @&#8203;lazysegtree

##### Bug Fix
- fix: sorting in searchbar [#&#8203;985](yorukot/superfile#985) by @&#8203;hupender
- fix: Async rendering, Include clipboard check in paste items, and update linter configs [#&#8203;997](yorukot/superfile#997) by @&#8203;lazysegtree
- fix: Move utility functions to utils package [#&#8203;1012](yorukot/superfile#1012) by @&#8203;lazysegtree
- fix: Refactoring and separation of preview panel and searchbar in help menu [#&#8203;1013](yorukot/superfile#1013) by @&#8203;lazysegtree
- fix(filePanel): allow focusType to be set correctly [#&#8203;1033](yorukot/superfile#1033) by @&#8203;faisal-990
- fix(ci): Update gomod2nix.toml, allow pre release in version output, release 1.4.0-rc1, bug fixes, and improvements [#&#8203;1054](yorukot/superfile#1054) by @&#8203;lazysegtree
- fix(nix): resolve build failures in the nix flake [#&#8203;1068](yorukot/superfile#1068) by @&#8203;Frost-Phoenix
- fix: Retry the file deletion to prevent flakies (#&#8203;938) [#&#8203;1076](yorukot/superfile#1076) by @&#8203;lazysegtree
- fix(issue-1066): Fixed issue where enter was not searchable [#&#8203;1078](yorukot/superfile#1078) by @&#8203;Simpaqt
- fix(#&#8203;1073): Tech debt fix [#&#8203;1077](yorukot/superfile#1077) by @&#8203;Simpaqt
- fix: fix deleted directory not able to remove from pins (#&#8203;1067) [#&#8203;1081](yorukot/superfile#1081) by @&#8203;yorukot
- fix: fix child process spawning attached [#&#8203;1084](yorukot/superfile#1084) by @&#8203;guemidiborhane
- fix: always clear images when showing a FullScreenStyle [#&#8203;1094](yorukot/superfile#1094) by @&#8203;snikoletopoulos
- fix: Allow j and k keys in zoxide [#&#8203;1102](yorukot/superfile#1102) by @&#8203;lazysegtree
- fix: Zoxide improvements and 1.4.0-rc2 [#&#8203;1105](yorukot/superfile#1105) by @&#8203;lazysegtree
- fix: rename cursor beginning on wrong character because of multiple dots in name (#&#8203;813) [#&#8203;1112](yorukot/superfile#1112) by @&#8203;SyedAsadK
- fix: check and fix file panel scroll position on height changes [#&#8203;1095](yorukot/superfile#1095) by @&#8203;snikoletopoulos

##### Optimization
- perf(website): optimize font loading and asset organization [#&#8203;1089](yorukot/superfile#1089) by @&#8203;yorukot

##### Documentation
- docs: fix incorrect zoxide plugin config name [#&#8203;1049](yorukot/superfile#1049) by @&#8203;shree-xvi
- docs(hotkeys): Fix typo in vimHotkeys.toml comments [#&#8203;1080](yorukot/superfile#1080) by @&#8203;wleoncio
- docs: add section for core maintainers in README.md [#&#8203;1088](yorukot/superfile#1088) by @&#8203;yorukot
- chore: add winget install instruction to readme and website [#&#8203;943](yorukot/superfile#943) by @&#8203;claykom

##### Dependencies
- chore(deps): update dependency go to v1.25.0, golangci-lint to v2, golangci-lint actions to v8 [#&#8203;750](yorukot/superfile#750) by @&#8203;renovate[bot]
- chore(deps): update amannn/action-semantic-pull-request action to v6 [#&#8203;1006](yorukot/superfile#1006) by @&#8203;renovate[bot]
- chore(deps): update actions/first-interaction action to v3 [#&#8203;1005](yorukot/superfile#1005) by @&#8203;renovate[bot]
- chore(deps): update actions/checkout action to v5 [#&#8203;1004](yorukot/superfile#1004) by @&#8203;renovate[bot]
- chore(deps): bump astro from 5.10.1 to 5.12.8 [#&#8203;982](yorukot/superfile#982) by @&#8203;dependabot[bot]
- fix(deps): update module golang.org/x/mod to v0.27.0 [#&#8203;989](yorukot/superfile#989) by @&#8203;renovate[bot]
- fix(deps): update dependency @&#8203;expressive-code/plugin-collapsible-sections to v0.41.3 [#&#8203;990](yorukot/superfile#990) by @&#8203;renovate[bot]
- fix(deps): update dependency sharp to v0.34.3 [#&#8203;992](yorukot/superfile#992) by @&#8203;renovate[bot]
- fix(deps): update dependency @&#8203;expressive-code/plugin-line-numbers to v0.41.3 [#&#8203;991](yorukot/superfile#991) by @&#8203;renovate[bot]
- chore(deps): update dependency go to v1.25.0 [#&#8203;994](yorukot/superfile#994) by @&#8203;renovate[bot]
- fix(deps): update astro monorepo [#&#8203;995](yorukot/superfile#995) by @&#8203;renovate[bot]
- fix(deps): update dependency @&#8203;astrojs/starlight to ^0.35.0 [#&#8203;1000](yorukot/superfile#1000) by @&#8203;renovate[bot]
- fix(deps): update module github.com/urfave/cli/v3 to v3.4.1 [#&#8203;1001](yorukot/superfile#1001) by @&#8203;renovate[bot]
- fix(deps): update module golang.org/x/text to v0.28.0 [#&#8203;1003](yorukot/superfile#1003) by @&#8203;renovate[bot]

##### Misc
- chore: migrate from superfile.netlify.app to superfile.dev [#&#8203;1087](yorukot/superfile#1087) by @&#8203;yorukot
- refactor(filepanel): replace filePanelFocusType with isFocused boolean [#&#8203;1040](yorukot/superfile#1040) by @&#8203;faisal-990
- refactor(ansi): Migrate from github.com/charmbracelet/x/exp/term/ansi to github.com/charmbracelet/x/ansi [#&#8203;1044](yorukot/superfile#1044) by @&#8203;faisal-990
- refactor: common operation on pinned directory file using PinnedManager [#&#8203;1085](yorukot/superfile#1085) by @&#8203;Manaswa-S
- test: unit tests for pinned manager [#&#8203;1090](yorukot/superfile#1090) by @&#8203;Manaswa-S

</p>
</details> 

#### New Contributors
* @&#8203;hupender made their first contribution in yorukot/superfile#985
* @&#8203;ahmed-habbachi made their first contribution in yorukot/superfile#924
* @&#8203;iZarrios made their first contribution in yorukot/superfile#1011
* @&#8203;faisal-990 made their first contribution in yorukot/superfile#1033
* @&#8203;shree-xvi made their first contribution in yorukot/superfile#1049
* @&#8203;Simpaqt made their first contribution in yorukot/superfile#1078
* @&#8203;wleoncio made their first contribution in yorukot/superfile#1080
* @&#8203;guemidiborhane made their first contribution in yorukot/superfile#1084
* @&#8203;Manaswa-S made their first contribution in yorukot/superfile#1085
* @&#8203;xelavopelk made their first contribution in yorukot/superfile#1093
* @&#8203;snikoletopoulos made their first contribution in yorukot/superfile#1094
* @&#8203;SyedAsadK made their first contribution in yorukot/superfile#1112

**Full Changelog**: <yorukot/superfile@v1.3.3...v1.4.0>

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this MR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box

---

This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0MS4xNDYuMCIsInVwZGF0ZWRJblZlciI6IjQxLjE0Ni4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6WyJSZW5vdmF0ZSBCb3QiXX0=-->
@lazysegtree
lazysegtree deleted the select-icon branch January 3, 2026 05:04
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.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.