elementary / code

Code editor designed for elementary OS
https://elementary.io
GNU General Public License v3.0
476 stars 113 forks source link

Sidebar: First select fails to open document after branch change which removes a sidebar item #1403

Closed jeremypw closed 6 days ago

jeremypw commented 10 months ago

What Happened?

After changing branches (which causes some of the loaded documents to change, selecting another document in the foldermanager failed to open it.

Steps to Reproduce

  1. Open a git project
  2. Prepare (if necessary) a branch that contains a file not existing in another branch and switch to that branch
  3. Change the branch so that the file is removed from the sidebar
  4. Try to open another doc from the sidebar.

An easier way to demonstrate the problem is to create a temporary file item in the sidebar and then delete it. The next select then fails to open a document.

Expected Behavior

Selecting a document in the sidebar should open it under these circumstances

OS Version

7.x (Horus)

Software Version

Latest release (I have run all updates)

Log Output

No response

Hardware Info

No response

jeremypw commented 10 months ago

This issue is an unfortunate side-effect of the ignore_next_select property of the foldermanager introduced to prevent unwanted docs opening after an item was renamed or removed.

zeebok commented 1 month ago

When I change branches on OS8 stable, it does not change what docs are open so I can't reproduce. In fact the radio button doesn't even update: image

jeremypw commented 1 month ago

@zeebok Thanks for having a look at this. Changing branches does not usually change which docs are open but may change which items are present in the sidebar. The issue is about opening another document from the sidebar after changing branch which results in a sidebar item being removed or renamed. I'll rewrite the steps to reproduce.

I can confirm the issue about which branch is selected in the Branch context menu on OS8 but this also occurs in master so will have to be fixed in a separate PR.

jeremypw commented 1 month ago

@zeebok I have revised the instructions. It seems a bit of a corner case but this was happening to me annoyingly often during development so there may be another way of triggering it.