Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cycle tabs with Ctrl+Tab #836

Merged
merged 5 commits into from
Jan 5, 2025
Merged

Cycle tabs with Ctrl+Tab #836

merged 5 commits into from
Jan 5, 2025

Conversation

jeremypw
Copy link
Collaborator

@jeremypw jeremypw commented Dec 31, 2024

Fixes #834

Rather than use the native Hdy.TabView select_next_page () and select_previous_page () functions, which do not cycle, a custom function is used.

src/Widgets/TerminalView.vala Outdated Show resolved Hide resolved
src/Widgets/TerminalView.vala Outdated Show resolved Hide resolved
@jeremypw jeremypw requested a review from ryonakano January 1, 2025 14:28
Copy link
Contributor

@ryonakano ryonakano left a comment

Choose a reason for hiding this comment

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

If we remove the unnecessary cast against n_pages here, we can remove the following places too , excepting the cast against the result of focus.clamp () :

[ryo@b760m ~/work/tmp/terminal (jeremypw/cycle-tabs =)]$ git grep -n n_pages | grep -F '(int)'
src/MainWindow.vala:485:                        notebook.selected_page = notebook.tab_view.get_nth_page ((int)notebook.n_pages - 1);
src/MainWindow.vala:718:                var tab = notebook.tab_view.get_nth_page ((int)(focus.clamp (0, notebook.n_pages - 1)));
src/MainWindow.vala:727:            int pos = (int)notebook.n_pages
[ryo@b760m ~/work/tmp/terminal (jeremypw/cycle-tabs =)]$

@jeremypw jeremypw requested a review from ryonakano January 3, 2025 12:35
@jeremypw
Copy link
Collaborator Author

jeremypw commented Jan 3, 2025

Nice use of git grep - I was not familiar with that.

Copy link
Contributor

@ryonakano ryonakano left a comment

Choose a reason for hiding this comment

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

LGTM and works as expected. Thank you for your fix!

@jeremypw jeremypw merged commit abe23ae into master Jan 5, 2025
4 checks passed
@jeremypw jeremypw deleted the jeremypw/cycle-tabs branch January 5, 2025 10:20
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.

Tab cycling is not cyclical
2 participants