Skip to content

feat(format): make tab visualization opt-in via CLI_TAB_VISUALIZE#579

Merged
apstndb merged 2 commits intomainfrom
issue-577-tab-visualize-opt-in
Mar 22, 2026
Merged

feat(format): make tab visualization opt-in via CLI_TAB_VISUALIZE#579
apstndb merged 2 commits intomainfrom
issue-577-tab-visualize-opt-in

Conversation

@apstndb
Copy link
Owner

@apstndb apstndb commented Mar 22, 2026

Summary

Make tab visualization opt-in via CLI_TAB_VISUALIZE system variable (default FALSE). Tab visualization replaces tab characters with symbol in table output, but this affects copy-paste and text redirection — the symbol appears in copied/redirected text.

Key Changes

  • system_variables.go: Add TabVisualize bool to DisplayVars, wire to FormatConfig
  • config.go: Add TabVisualize bool to FormatConfig
  • streaming_table.go: Guard visualizeTabsInRow call with config.TabVisualize check
  • var_registry.go: Register CLI_TAB_VISUALIZE as boolean system variable
  • system_variables_test.go: Add CLI_TAB_VISUALIZE to boolean variable test list
  • tab_visualize_test.go: Set TabVisualize: true in TestWriteTable_WithTabs

Test Plan

  • make check passes
  • TestWriteTable_WithTabs passes with TabVisualize: true
  • TestSystemVariables_SetGetOperations includes CLI_TAB_VISUALIZE

Fixes #577

Tab visualization replaces tab characters with → symbol in table output,
but this affects copy-paste and text redirection. Make it opt-in by adding
CLI_TAB_VISUALIZE system variable (default FALSE).

- Add TabVisualize bool to DisplayVars and FormatConfig
- Register CLI_TAB_VISUALIZE as boolean system variable
- Guard visualizeTabsInRow call with config.TabVisualize check
- Update TestWriteTable_WithTabs to set TabVisualize: true

Fixes #577

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 22, 2026 20:25
@apstndb apstndb added the bug Something isn't working label Mar 22, 2026
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces an opt-in mechanism for tab visualization in the CLI's table output. Previously, tab characters were always replaced with symbols, which could lead to issues when copying or redirecting text. By making this feature controllable via a new CLI_TAB_VISUALIZE system variable, which is FALSE by default, users can now choose whether to see visualized tabs without affecting the underlying data for external operations.

Highlights

  • New System Variable: Introduced a new CLI_TAB_VISUALIZE system variable, defaulting to FALSE, to control the visualization of tab characters in table output.
  • Configuration Update: Added a TabVisualize boolean field to FormatConfig and DisplayVars to store and manage the state of tab visualization.
  • Conditional Tab Visualization: Modified streaming_table.go to conditionally call visualizeTabsInRow only when config.TabVisualize is enabled, preventing unwanted symbols in copied text.
  • Test Coverage: Updated existing test cases in tab_visualize_test.go to explicitly set TabVisualize: true when testing tab visualization functionality, and added CLI_TAB_VISUALIZE to the system variable test list.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions
Copy link

github-actions bot commented Mar 22, 2026

Code Metrics Report

📊 View detailed coverage report (available for 7 days)

main (f95515b) #579 (6301d80) +/-
Coverage 70.8% 70.8% +0.0%
Code to Test Ratio 1:1.3 1:1.3 +0.0
Test Execution Time 1m9s 1m6s -3s
Details
  |                     | main (f95515b) | #579 (6301d80) |  +/-  |
  |---------------------|----------------|----------------|-------|
+ | Coverage            |          70.8% |          70.8% | +0.0% |
  |   Files             |             75 |             75 |     0 |
  |   Lines             |           7025 |           7027 |    +2 |
+ |   Covered           |           4980 |           4982 |    +2 |
+ | Code to Test Ratio  |          1:1.3 |          1:1.3 |  +0.0 |
  |   Code              |          16299 |          16305 |    +6 |
+ |   Test              |          21212 |          21227 |   +15 |
+ | Test Execution Time |           1m9s |           1m6s |   -3s |

Code coverage of files in pull request scope (88.3% → 88.4%)

Files Coverage +/- Status
internal/mycli/format/config.go 100.0% 0.0% modified
internal/mycli/format/streaming_table.go 78.8% +0.2% modified
internal/mycli/system_variables.go 93.9% 0.0% modified
internal/mycli/var_registry.go 86.9% +0.0% modified

Reported by octocov

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new feature to visualize tab characters in table output. It adds a TabVisualize boolean field to FormatConfig and DisplayVars, enabling conditional tab visualization in streaming_table.go. The feature is exposed as a configurable CLI system variable, CLI_TAB_VISUALIZE, and includes updated tests to cover its functionality.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR makes table tab visualization opt-in via a new CLI_TAB_VISUALIZE system variable (default FALSE), so table output no longer replaces tab characters with unless explicitly enabled—improving copy/paste and redirected output fidelity.

Changes:

  • Add TabVisualize to display/system variables and propagate it into format.FormatConfig.
  • Register CLI_TAB_VISUALIZE as a boolean system variable and include it in system variable set/get tests.
  • Guard tab visualization in the table formatter and update tab visualization table tests to enable the new flag.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/mycli/var_registry.go Registers CLI_TAB_VISUALIZE in the system variable registry.
internal/mycli/system_variables_test.go Adds CLI_TAB_VISUALIZE to the boolean variables set/get test list.
internal/mycli/system_variables.go Adds TabVisualize to DisplayVars and wires it into FormatConfig.
internal/mycli/format/config.go Extends FormatConfig with the TabVisualize flag.
internal/mycli/format/streaming_table.go Makes visualizeTabsInRow conditional on config.TabVisualize.
internal/mycli/format/tab_visualize_test.go Updates WriteTable tab tests to explicitly enable visualization.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Address review feedback:
- Move CLI_TAB_VISUALIZE registration from integer section to boolean
  section in var_registry.go
- Add disabled_by_default test case verifying no arrow symbol when
  TabVisualize is false (default)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@apstndb
Copy link
Owner Author

apstndb commented Mar 22, 2026

/gemini review

@gemini-code-assist
Copy link
Contributor

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@apstndb
Copy link
Owner Author

apstndb commented Mar 22, 2026

/gemini review

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request makes tab character visualization in table output an opt-in feature controlled by the new CLI_TAB_VISUALIZE system variable. This change addresses potential issues with copy-pasting or redirecting output. The implementation involves adding a TabVisualize flag to FormatConfig, which is used to conditionally apply tab visualization. The new system variable is registered and wired into the configuration, and the associated tests have been updated to reflect the new opt-in behavior. The changes are correct and well-implemented.

@apstndb
Copy link
Owner Author

apstndb commented Mar 22, 2026

/gemini summary

@gemini-code-assist
Copy link
Contributor

Summary of Changes

This pull request addresses a usability concern where automatic tab visualization in table output, while visually helpful, interfered with copy-paste and text redirection by embedding arrow symbols. The change introduces a new system variable, CLI_TAB_VISUALIZE, making this feature opt-in and disabled by default. This allows users to control when tabs are visually represented, ensuring data integrity for external operations while retaining the option for visual clarity.

Highlights

  • New System Variable: Introduced a new CLI_TAB_VISUALIZE system variable, defaulting to FALSE, to control the visualization of tab characters in table output.
  • Configuration Update: Added a TabVisualize boolean field to FormatConfig and DisplayVars to store and manage the state of tab visualization.
  • Conditional Tab Visualization: Modified streaming_table.go to conditionally call visualizeTabsInRow only when config.TabVisualize is enabled, preventing unwanted symbols in copied text.
  • Test Coverage: Updated existing test cases in tab_visualize_test.go to explicitly set TabVisualize: true when testing tab visualization functionality, and added CLI_TAB_VISUALIZE to the system variable test list.
Changelog
  • internal/mycli/format/config.go
    • Added TabVisualize boolean field to FormatConfig struct.
  • internal/mycli/format/streaming_table.go
    • Wrapped the visualizeTabsInRow function call with a conditional check for f.config.TabVisualize.
  • internal/mycli/format/tab_visualize_test.go
    • Renamed an existing test case from 'unstyled' to 'disabled_by_default'.
    • Added a new test case to verify that tab visualization is off by default.
    • Updated the 'unstyled' test case to explicitly enable TabVisualize.
  • internal/mycli/system_variables.go
    • Added TabVisualize boolean field to DisplayVars struct.
    • Mapped sv.Display.TabVisualize to format.FormatConfig.TabVisualize in toFormatConfig.
  • internal/mycli/system_variables_test.go
    • Included CLI_TAB_VISUALIZE in the list of boolean system variables for testing.
  • internal/mycli/var_registry.go
    • Registered CLI_TAB_VISUALIZE as a boolean system variable with a description.
Activity
  • gemini-code-assist[bot] provided an initial summary of the changes.
  • github-actions[bot] posted a code metrics report, showing stable coverage and improved test execution time.
  • Copilot suggested moving the CLI_TAB_VISUALIZE registration to the correct boolean section in var_registry.go.
  • apstndb confirmed that the CLI_TAB_VISUALIZE registration was moved to the boolean section.
  • Copilot recommended adding a test case to ensure the default (visualization off) behavior is covered.
  • apstndb confirmed that a disabled_by_default test case was added to verify WriteTable does not produce arrow symbols when TabVisualize is false.
  • apstndb invoked /gemini review and /gemini summary commands.

@apstndb apstndb merged commit e4101d8 into main Mar 22, 2026
2 checks passed
@apstndb apstndb deleted the issue-577-tab-visualize-opt-in branch March 22, 2026 20:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tab visualization should be opt-in or respect output context

2 participants