Skip to content

Conversation

@austinamorusoyardstick
Copy link
Owner

This pull request introduces a new feature that allows users to switch between tabs in reverse order using the Shift+Tab keybinding. The changes include updates to keybinding configurations, help text, and the implementation of the reverse tab-switching functionality.

Keybinding Updates:

  • Added a new keybinding, KeyShiftTab, for reverse tab switching in keys/keys.go. This includes updates to GlobalKeyStringsMap, GlobalkeyBindings, DefaultKeyBindings, getCommandToKeyNameMap, and getHelpText. ([[1]](https://github.com/austinamorusoyardstick/claude-squad/pull/36/files#diff-afc783802cd8fd9fdcbfcd151232a4edeea3c7e7620b1633239feb287d9ee3fbR26), [[2]](https://github.com/austinamorusoyardstick/claude-squad/pull/36/files#diff-afc783802cd8fd9fdcbfcd151232a4edeea3c7e7620b1633239feb287d9ee3fbR99), [[3]](https://github.com/austinamorusoyardstick/claude-squad/pull/36/files#diff-afc783802cd8fd9fdcbfcd151232a4edeea3c7e7620b1633239feb287d9ee3fbR228-R231), [[4]](https://github.com/austinamorusoyardstick/claude-squad/pull/36/files#diff-afc783802cd8fd9fdcbfcd151232a4edeea3c7e7620b1633239feb287d9ee3fbR373), [[5]](https://github.com/austinamorusoyardstick/claude-squad/pull/36/files#diff-afc783802cd8fd9fdcbfcd151232a4edeea3c7e7620b1633239feb287d9ee3fbR524), [[6]](https://github.com/austinamorusoyardstick/claude-squad/pull/36/files#diff-afc783802cd8fd9fdcbfcd151232a4edeea3c7e7620b1633239feb287d9ee3fbR582))

Reverse Tab-Switching Implementation:

  • Implemented a ToggleReverse method in the TabbedWindow class to cycle through tabs in reverse order. ([ui/tabbed_window.goR113-R117](https://github.com/austinamorusoyardstick/claude-squad/pull/36/files#diff-6252955ebc5793fedbe5f4277cf22867afa4025846142ff6fe1d65377c711860R113-R117))
  • Integrated the ToggleReverse method into the handleKeyPress function in app/app.go to handle the Shift+Tab keybinding. ([app/app.goR888-R891](https://github.com/austinamorusoyardstick/claude-squad/pull/36/files#diff-0f1d2976054440336a576d47a44a37b80cdf6701dd9113012bce0e3c425819b7R888-R891))

Copy link

@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.

Summary of Changes

Hello @austinamorusoyardstick, 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 significantly enhances the application's navigation capabilities by introducing a Shift+Tab keybinding. This new feature allows users to cycle through open tabs in reverse, providing a more complete and intuitive tab management experience alongside the existing forward tab switching.

Highlights

  • New Keybinding for Reverse Tab Switching: I've identified that this PR introduces Shift+Tab as a new keybinding, enabling users to navigate through tabs in reverse order, complementing the existing Tab key for forward navigation.
  • Core Logic for Reverse Tab Navigation: A new ToggleReverse method has been implemented within the TabbedWindow class, which contains the core logic for cycling through tabs backwards, ensuring correct index wrapping.
  • Keybinding Configuration and Help Text Updates: The necessary keybinding configurations across keys/keys.go have been updated to register Shift+Tab, map it to the new functionality, and provide appropriate help text for user guidance.
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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.

Copy link

@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 Shift+Tab functionality for reverse tab navigation, which is a nice usability improvement. The implementation is straightforward and correct. I've added a couple of suggestions to improve maintainability and robustness: one to prevent a potential panic in ToggleReverse and another to refactor duplicated code in the key press handler. Overall, great work!

app/app.go Outdated
Comment on lines 888 to 891
case keys.KeyShiftTab:
m.tabbedWindow.ToggleReverse()
m.menu.SetInDiffTab(m.tabbedWindow.IsInDiffTab())
return m, m.instanceChanged()

Choose a reason for hiding this comment

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

medium

The logic inside this case block is almost identical to the one for keys.KeyTab (lines 885-887). This introduces code duplication. To improve maintainability, consider refactoring this into a shared helper function.

func (m *home) handleTabSwitch(reverse bool) (tea.Model, tea.Cmd) {
    if reverse {
        m.tabbedWindow.ToggleReverse()
    } else {
        m.tabbedWindow.Toggle()
    }
    m.menu.SetInDiffTab(m.tabbedWindow.IsInDiffTab())
    return m, m.instanceChanged()
}

case keys.KeyTab:
    return m.handleTabSwitch(false)
case keys.KeyShiftTab:
    return m.handleTabSwitch(true)

Comment on lines 114 to 125
func (w *TabbedWindow) ToggleReverse() {
w.activeTab = (w.activeTab - 1 + len(w.tabs)) % len(w.tabs)
}

Choose a reason for hiding this comment

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

medium

For robustness, it's good practice to guard against a potential division by zero if w.tabs were ever an empty slice. While it's currently initialized with a fixed size, adding a check will make the code more resilient to future changes. The existing Toggle() method has the same potential issue and would benefit from a similar guard.

if len(w.tabs) == 0 {
		return
	}
	w.activeTab = (w.activeTab - 1 + len(w.tabs)) % len(w.tabs)

@austinamorusoyardstick
Copy link
Owner Author

/gemini review

Copy link

@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 successfully introduces the Shift+Tab keybinding for reverse tab navigation. The changes are well-structured, with updates to keybindings, application logic, and UI components. The new handleTabSwitch function in app/app.go is a good refactoring that centralizes tab switching logic.

I've included one suggestion to further improve maintainability in ui/tabbed_window.go by reducing code duplication between the Toggle and ToggleReverse functions.

Overall, this is a solid contribution that enhances user experience.

Comment on lines 109 to 125
func (w *TabbedWindow) Toggle() {
if len(w.tabs) == 0 {
return
}
w.activeTab = (w.activeTab + 1) % len(w.tabs)
}

// ToggleReverse cycles through tabs in reverse order
func (w *TabbedWindow) ToggleReverse() {
if len(w.tabs) == 0 {
return
}
w.activeTab = (w.activeTab - 1 + len(w.tabs)) % len(w.tabs)
}

Choose a reason for hiding this comment

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

medium

While the implementation is correct, there's an opportunity to reduce code duplication between Toggle() and ToggleReverse(). You can extract the common logic into a private helper method. This improves maintainability by centralizing the tab cycling logic.

func (w *TabbedWindow) Toggle() {
	w.cycleTabs(1)
}

// ToggleReverse cycles through tabs in reverse order
func (w *TabbedWindow) ToggleReverse() {
	w.cycleTabs(-1)
}

// cycleTabs handles cycling through tabs in a given direction.
func (w *TabbedWindow) cycleTabs(direction int) {
	if len(w.tabs) == 0 {
		return
	}
	numTabs := len(w.tabs)
	w.activeTab = (w.activeTab + direction + numTabs) % numTabs
}

@austinamorusoyardstick
Copy link
Owner Author

/gemini review

Copy link

@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 successfully introduces reverse tab-switching with Shift+Tab. The implementation is clean, with good refactoring in app/app.go and ui/tabbed_window.go to support both forward and reverse cycling. The new logic in cycleTabs is robust and correctly handles edge cases like an empty tab list and negative direction for reverse cycling. My suggestions focus on improving UI consistency for the new keybinding's help text.

),
KeyShiftTab: key.NewBinding(
key.WithKeys("shift+tab"),
key.WithHelp("shift+tab", "switch tab (reverse)"),

Choose a reason for hiding this comment

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

medium

For UI consistency in the help menu, consider using the tab symbol for the key display. The application uses symbols for other special keys like arrows (, , , ) and enter (), and using a symbol for tab would align with this convention.

Suggested change
key.WithHelp("shift+tab", "switch tab (reverse)"),
key.WithHelp("shift+", "switch tab (reverse)"),

// Actions
{Command: "enter", Keys: []string{"enter", "o"}, Help: "↵/o"},
{Command: "tab", Keys: []string{"tab"}, Help: "tab"},
{Command: "shift_tab", Keys: []string{"shift+tab"}, Help: "shift+tab"},

Choose a reason for hiding this comment

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

medium

For UI consistency in the keybinding editor, consider using the tab symbol for the help text. This would align with the use of symbols for other special keys like arrows and enter in the keybinding configuration.

Suggested change
{Command: "shift_tab", Keys: []string{"shift+tab"}, Help: "shift+tab"},
{Command: "shift_tab", Keys: []string{"shift+tab"}, Help: "shift+"},

@austinamorusoyardstick
Copy link
Owner Author

/gemini review

@austinamorusoyardstick austinamorusoyardstick merged commit 7776e89 into main Jul 28, 2025
1 check passed
Copy link

@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 switch tabs in reverse using Shift+Tab. The implementation is well-done, with a good refactoring in app/app.go to handle both forward and reverse tab switching, and a robust implementation in ui/tabbed_window.go that also prevents a potential panic when no tabs are present. I've added one comment regarding the visibility of the new keybinding in the UI.

KeyPRReview

KeyTab // Tab is a special keybinding for switching between panes.
KeyShiftTab // ShiftTab is a special keybinding for switching between panes in reverse.

Choose a reason for hiding this comment

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

medium

While the keybinding is implemented correctly, it's not visible in the help menu, which makes it undiscoverable to users. Please add keys.KeyShiftTab to the menu options in ui/menu.go to ensure users are aware of this new feature.

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.

1 participant