Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Pierre-Samuel Le Stang
poezio
Commits
115aee3d
Unverified
Commit
115aee3d
authored
Jun 30, 2018
by
mathieui
Browse files
new tabs: apply review
parent
2147efa4
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
11 deletions
+14
-11
poezio/core/core.py
poezio/core/core.py
+1
-1
poezio/core/tabs.py
poezio/core/tabs.py
+13
-10
No files found.
poezio/core/core.py
View file @
115aee3d
...
...
@@ -1098,7 +1098,7 @@ class Core:
for
state
in
states
:
for
tab
in
tab_refs
[
state
]:
if
(
tab
.
nb
<
self
.
tabs
.
current_tab_in
t
ex
and
if
(
tab
.
nb
<
self
.
tabs
.
current_tab_in
d
ex
and
tab_refs
[
state
][
-
1
].
nb
>
self
.
tabs
.
current_tab_index
):
continue
self
.
command
.
win
(
str
(
tab
.
nb
))
...
...
poezio/core/tabs.py
View file @
115aee3d
...
...
@@ -157,15 +157,11 @@ class Tabs:
self
.
_current_tab
=
self
.
_tabs
[
0
]
def
_inc_cursor
(
self
):
self
.
_current_index
+=
1
if
self
.
_current_index
>=
len
(
self
.
_tabs
):
self
.
_current_index
=
0
self
.
_current_index
=
(
self
.
_current_index
+
1
)
%
len
(
self
.
_tabs
)
self
.
_current_tab
=
self
.
_tabs
[
self
.
_current_index
]
def
_dec_cursor
(
self
):
self
.
_current_index
-=
1
if
self
.
_current_index
<
0
:
self
.
_current_index
=
len
(
self
.
_tabs
)
-
1
self
.
_current_index
=
(
self
.
_current_index
-
1
)
%
len
(
self
.
_tabs
)
self
.
_current_tab
=
self
.
_tabs
[
self
.
_current_index
]
def
_store_previous
(
self
):
...
...
@@ -212,18 +208,24 @@ class Tabs:
self
.
_tab_types
[
type
(
tab
)].
remove
(
tab
)
del
self
.
_tab_names
[
tab
.
name
]
self
.
_collect_trailing_gaptabs
()
self
.
_update_numbers
()
if
is_current
:
self
.
_restore_previous_tab
()
if
gap
:
self
.
_collect_trailing_gaptabs
()
else
:
self
.
_update_numbers
()
if
tab
is
self
.
_previous_tab
:
self
.
_previous_tab
=
None
if
is_current
:
self
.
_restore_previous_tab
()
self
.
_validate_current_index
()
def
_restore_previous_tab
(
self
):
if
self
.
_previous_tab
:
if
not
self
.
set_current_tab
(
self
.
_previous_tab
):
self
.
set_current_index
(
0
)
else
:
self
.
set_current_index
(
0
)
def
_validate_current_index
(
self
):
if
not
0
<=
self
.
_current_index
<
len
(
...
...
@@ -240,6 +242,7 @@ class Tabs:
def
_update_numbers
(
self
):
for
i
,
tab
in
enumerate
(
self
.
_tabs
):
tab
.
nb
=
i
self
.
_current_index
=
self
.
_current_tab
.
nb
# Moving tabs around #
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment