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 select after rename; fix rename folder; disallow rename if unsaved edits #1386

Merged
merged 16 commits into from
Jan 24, 2024

Conversation

jeremypw
Copy link
Collaborator

@jeremypw jeremypw commented Dec 3, 2023

Fixes #1385

  • Instead of ignoring the next select when a fileitem is renamed, the renamed item is (closed) and reopened.
  • If a fileitem rename is cancelled, the item is deselected so it can be clicked on to open
  • The rename menu option is insensitive if the file has unsaved changes in any Code window
  • Code to rename folders was pre-existing but did not work. This PR also fixes that (needs checking for side-effects - should we allow renaming of folders at all?)

A Timeout had to be used to detect when renaming was cancelled as Granite Sourcelist does not produce any notification of this 😞 so to the editing property (read-only) had to be polled.

@jeremypw jeremypw changed the title Fix select after rename; fix rename folder Fix select after rename; fix rename folder; disallow rename if unsaved edits Dec 3, 2023
@colinkiama
Copy link
Member

Is this still a draft?

@jeremypw jeremypw marked this pull request as ready for review January 23, 2024 15:37
@jeremypw
Copy link
Collaborator Author

@colinkiama Oops, no - I forgot to change the status.

Copy link
Member

@colinkiama colinkiama left a comment

Choose a reason for hiding this comment

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

Seems like you fixed the issue with the files.

However, after you rename a folder, the first file you select doesn't open in the editor.

Maybe view.unselect_call () needs to be called again after you finish editing the folder name?

@jeremypw
Copy link
Collaborator Author

@colinkiama Thanks for the review! Your right that everything should be deselected after renaming - I'll check why a file may become selected after a folder rename.

@jeremypw
Copy link
Collaborator Author

@colinkiama Hopefully fixed now.

@colinkiama
Copy link
Member

Great! That issue has been fixed however, there's now another problem:
If you cancel a folder rename operation with the "Escape" key, you won't be able to select files. The files do not open the editor either.

@jeremypw
Copy link
Collaborator Author

@colinkiama Thanks for being thorough! This is puzzling as the item is set back to being unselectable after editing ends yet it appears still selected and stops the listbox selecting anything else for some reason. Investigating.

@jeremypw
Copy link
Collaborator Author

@colinkiama I think I fixed it - it was due to some bug in SourceList I think. Seems to work if you set "selectable" to false after unselecting all 🤷

@colinkiama colinkiama merged commit 1cc6b21 into master Jan 24, 2024
6 checks passed
@colinkiama colinkiama deleted the fix-rename-in-sidebar branch January 24, 2024 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Click on sidebar item after cancelled rename does not open document
2 participants