summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
Diffstat (limited to 'library')
-rw-r--r--library/ttk/notebook.tcl12
1 files changed, 7 insertions, 5 deletions
diff --git a/library/ttk/notebook.tcl b/library/ttk/notebook.tcl
index c5340a5..518c6f5 100644
--- a/library/ttk/notebook.tcl
+++ b/library/ttk/notebook.tcl
@@ -57,11 +57,13 @@ proc ttk::notebook::Press {w x y} {
# Select the next/previous tab in the list.
#
proc ttk::notebook::CycleTab {w dir} {
- if {[$w index end] != 0} {
- set current [$w index current]
- set select [expr {($current + $dir) % [$w index end]}]
- while {[$w tab $select -state] != "normal" && ($select != $current)} {
- set select [expr {($select + $dir) % [$w index end]}]
+ set current [$w index current]
+ if {$current >= 0} {
+ set tabCount [$w index end]
+ set select [expr {($current + $dir) % $tabCount}]
+ set step [expr {$dir > 0 ? 1 : -1}]
+ while {[$w tab $select -state] ne "normal" && ($select != $current)} {
+ set select [expr {($select + $step) % $tabCount}]
}
if {$select != $current} {
ActivateTab $w $select