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

PR: Update custom button tab index when removing intermediate tabs without changing current selected tab (Widgets) #22292

Merged
merged 1 commit into from
Jul 26, 2024

Conversation

dalthviz
Copy link
Member

Description of Changes

A tab removal makes the following ones to change their index (<new index> = <old index> - 1). Following that, there is a need to update the index attribute that the custom close button instances have. Otherwise, a IndexError (in the case of the Editor) can be raised. This fix also prevents raising an AttributeError when doing a similar interaction with IPython Console client tabs:

Traceback (most recent call last):
  File "E:\Acer\Documentos\Spyder\spyder\spyder\plugins\ipythonconsole\widgets\main_widget.py", line 1970, in close_client
    if not client.can_close:
AttributeError: 'NoneType' object has no attribute 'can_close'

Issue(s) Resolved

Fixes #22033

Affirmation

By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.

I certify the above statement is true and correct: dalthviz

@dalthviz dalthviz added this to the v6.0rc1 milestone Jul 26, 2024
@dalthviz dalthviz self-assigned this Jul 26, 2024
Copy link
Member

@ccordoba12 ccordoba12 left a comment

Choose a reason for hiding this comment

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

Looks good to me, thanks @dalthviz!

@ccordoba12 ccordoba12 changed the title PR: Update custom button tab index when removing intermediate tabs without changing current tab selected (Widgets) PR: Update custom button tab index when removing intermediate tabs without changing current selected tab (Widgets) Jul 26, 2024
@ccordoba12 ccordoba12 merged commit 8ef7e27 into spyder-ide:master Jul 26, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Closing last unfocused document tab causes IndexError
2 participants