From bb969bfb896c0e2c18e0473c568b8596876caac2 Mon Sep 17 00:00:00 2001 From: Jeremy Wootten Date: Wed, 24 Jul 2024 16:03:49 +0000 Subject: [PATCH] Jeremypw/fix cancel folder creation (#1454) --- data/code.metainfo.xml.in | 1 + src/FolderManager/FolderItem.vala | 4 ++-- src/Utils.vala | 6 +++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/data/code.metainfo.xml.in b/data/code.metainfo.xml.in index 843994469..0cfee04c0 100644 --- a/data/code.metainfo.xml.in +++ b/data/code.metainfo.xml.in @@ -89,6 +89,7 @@ Code hangs when choosing active project when two project starting with the same string are loaded Duplicated items in "Find In Project Popover" Extensions dialogue MUST be resizable + Cancelling new folder creation in project causes parent folder to disappear from sidebar Draw Spaces On Current Line git branch not readable if dir name is too long Fix "go to line" behaviour when column number is not explicitly set diff --git a/src/FolderManager/FolderItem.vala b/src/FolderManager/FolderItem.vala index 5c9c9f6c8..ab4920573 100644 --- a/src/FolderManager/FolderItem.vala +++ b/src/FolderManager/FolderItem.vala @@ -252,8 +252,8 @@ namespace Scratch.FolderManager { view.ignore_next_select = true; ((Code.Widgets.SourceList.ExpandableItem)this).remove (item); - // Add back dummy if empty unless we are removing a rename item - if (!(item is RenameItem || has_dummy || n_children > 0)) { + // Add back dummy if empty + if (!(has_dummy || n_children > 0)) { ((Code.Widgets.SourceList.ExpandableItem)this).add (dummy); has_dummy = true; } diff --git a/src/Utils.vala b/src/Utils.vala index 3b09bfc74..035884c94 100644 --- a/src/Utils.vala +++ b/src/Utils.vala @@ -172,8 +172,12 @@ namespace Scratch.Utils { return false; } + var content_type = info.get_content_type (); if (info.get_file_type () == FileType.REGULAR && - ContentType.is_a (info.get_content_type (), "text/*")) { + ContentType.is_a (content_type, "text/*") || + ContentType.is_a (content_type, "application/x-zerosize") + ) { + return true; }