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 hang when one project name is a prefix of another #1417

Merged
merged 1 commit into from
Jan 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MainWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ namespace Scratch {
private void close_project_docs (string project_path, bool make_restorable) {
unowned var docs = document_view.docs;
docs.foreach ((doc) => {
if (doc.file.get_path ().has_prefix (project_path)) {
if (doc.file.get_path ().has_prefix (project_path + Path.DIR_SEPARATOR_S)) {
document_view.close_document (doc);
if (make_restorable) {
document_manager.make_restorable (doc);
Expand Down
7 changes: 4 additions & 3 deletions src/Widgets/ChooseProjectButton.vala
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,13 @@ public class Code.ChooseProjectButton : Gtk.MenuButton {
}

private void set_active_path (string active_path) {
project_listbox.get_children ().foreach ((child) => {
foreach (var child in project_listbox.get_children ()) {
var project_entry = ((ProjectRow) child);
if (active_path.has_prefix (project_entry.project_path)) {
if (active_path.has_prefix (project_entry.project_path + Path.DIR_SEPARATOR_S)) {
project_listbox.row_activated (project_entry);
break;
}
});
}
}

private Gtk.Widget create_project_row (Scratch.FolderManager.ProjectFolderItem project_folder) {
Expand Down