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

fix: incorrect editor widget key calculation #1969

Merged
merged 1 commit into from
Mar 28, 2023
Merged

fix: incorrect editor widget key calculation #1969

merged 1 commit into from
Mar 28, 2023

Conversation

kittaakos
Copy link
Contributor

@kittaakos kittaakos commented Mar 20, 2023

Reviewers, please also see #1970 and #1971 before checking this PR.

Motivation

Avoid duplicate editor tabs when opening a sketch with no previously saved workbench layout.

Change description

This PR fixes the incorrect widget key calculation. Two different widget keys have been calculated for the same resource. For example, this forum post contains the log files and the widget layout. This is an extract that contains the relevant part:

"mainPanel": {
    "main": {
        "type": "tab-area",
        "widgets": [
            {
                "constructionOptions": {
                    "factoryId": "code-editor-opener",
                    "options": {
                        "counter": 0,
                        "kind": "navigatable",
                        "uri": "file:///c%3A/Users/Wim/Documents/Arduino/MaxMSP/double2float/double2float.0.1/double2float.0.1.ino"
                    }
                },
                "innerWidgetState": "{\"cursorState\":[{\"inSelectionMode\":false,\"selectionStart\":{\"lineNumber\":1,\"column\":1},\"position\":{\"lineNumber\":1,\"column\":1}}],\"viewState\":{\"scrollLeft\":0,\"firstPosition\":{\"lineNumber\":1,\"column\":1},\"firstPositionDeltaTop\":0},\"contributionsState\":{\"editor.contrib.folding\":{\"lineCount\":213,\"provider\":\"indent\",\"foldedImports\":false},\"editor.contrib.wordHighlighter\":false}}"
            },
            {
                "constructionOptions": {
                    "factoryId": "code-editor-opener",
                    "options": {
                        "counter": 1,
                        "kind": "navigatable",
                        "uri": "file:///c%3A/Users/Wim/Documents/Arduino/MaxMSP/double2float/double2float.0.1/double2float.0.1.ino"
                    }
                },
                "innerWidgetState": "{\"cursorState\":[{\"inSelectionMode\":false,\"selectionStart\":{\"lineNumber\":54,\"column\":3},\"position\":{\"lineNumber\":54,\"column\":3}}],\"viewState\":{\"scrollLeft\":0,\"firstPosition\":{\"lineNumber\":41,\"column\":1},\"firstPositionDeltaTop\":-9},\"contributionsState\":{\"editor.contrib.folding\":{\"lineCount\":213,\"provider\":\"indent\",\"foldedImports\":false},\"editor.contrib.wordHighlighter\":true}}"
            }
        ],
        "currentIndex": 1
    }
},

Two code editor widget IDs exist for the same resource: file:///c%3A/Users/Wim/Documents/Arduino/MaxMSP/double2float/double2float.0.1/double2float.0.1.ino, but the counter which is unused by IDE2, are different.

Other information

Closes #1791

Reviewer checklist

  • PR addresses a single concern.
  • The PR has no duplicates (please search among the Pull Requests before creating one)
  • PR title and description are properly filled.
  • Docs have been added / updated (for bug fixes / features)

to avoid duplicate editor tabs when opening a sketch with no previously
saved workbench layout

Closes #1791

Signed-off-by: Akos Kitta <a.kitta@arduino.cc>
@kittaakos kittaakos added topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project labels Mar 20, 2023
@kittaakos kittaakos self-assigned this Mar 20, 2023
Copy link
Contributor

@per1234 per1234 left a comment

Choose a reason for hiding this comment

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

Thanks Akos!

I really appreciate your excellent explanation of the problem and the setup you did to enable verification of the fix.

@kittaakos kittaakos merged commit e4beb03 into main Mar 28, 2023
@kittaakos kittaakos deleted the #1791 branch March 28, 2023 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: code Related to content of the project itself type: imperfection Perceived defect in any part of project
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Two tabs open for same file and won't close
2 participants