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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1005,11 +1005,11 @@ namespace Terminal {
}

private void action_next_tab () {
notebook.tab_view.select_next_page ();
notebook.cycle_tabs (FORWARD);
}

private void action_previous_tab () {
notebook.tab_view.select_previous_page ();
notebook.cycle_tabs (BACK);
}

void action_move_tab_right () {
Expand Down
12 changes: 12 additions & 0 deletions src/Widgets/TerminalView.vala
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,18 @@ public class Terminal.TerminalView : Gtk.Box {
tab_view.selected_page = target;
}

public void cycle_tabs (Hdy.NavigationDirection direction) {
var pos = (int) tab_view.get_page_position (selected_page);
jeremypw marked this conversation as resolved.
Show resolved Hide resolved
pos = direction == FORWARD ? pos + 1 : pos - 1;
if (pos == n_pages) {
pos = 0;
} else if (pos < 0) {
pos = (int) n_pages - 1;
}
jeremypw marked this conversation as resolved.
Show resolved Hide resolved

selected_page = tab_view.get_nth_page (pos);
}

public void transfer_tab_to_new_window () {
var target = tab_menu_target ?? tab_view.selected_page;

Expand Down
Loading