Skip to content

Commit

Permalink
Match complete directory name for prefix in two places (#1417)
Browse files Browse the repository at this point in the history
* Ensure set active path only activates one row
  • Loading branch information
jeremypw authored Jan 25, 2024
1 parent 1cbc271 commit 5aff3f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
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

0 comments on commit 5aff3f7

Please sign in to comment.