From 9c19ba0a7a451a72d7d95e1567a9ead82b7f8567 Mon Sep 17 00:00:00 2001 From: gambas Date: Sat, 25 Jul 2020 10:54:56 +0200 Subject: [PATCH] Fix compression of void files. [DEVELOPMENT ENVIRONMENT] * BUG: Compressing or uncompressing a file now marks the project as modified. * BUG: Compressing a void file does not crash anymore. --- .../gambas3/.src/Editor/Code/FTextEditor.class | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/app/src/gambas3/.src/Editor/Code/FTextEditor.class b/app/src/gambas3/.src/Editor/Code/FTextEditor.class index a9c91dd82..cb7423429 100644 --- a/app/src/gambas3/.src/Editor/Code/FTextEditor.class +++ b/app/src/gambas3/.src/Editor/Code/FTextEditor.class @@ -1538,7 +1538,10 @@ Public Sub Action_Activate((Key) As String) As Boolean UpdateDiffMode Case ".compress" - If Not $bIgnoreCompress Then Save(True) + If Not $bIgnoreCompress Then + Modify() + Save(True) + Endif Case Else Return True @@ -1877,6 +1880,8 @@ End Private Sub UpdateCompressAction() Dim sPath As String + Dim iSize As Long + Dim sComp As String If Not $bShowCompress Then Return @@ -1885,7 +1890,13 @@ Private Sub UpdateCompressAction() Action[".compress", Me].Value = Exist(sPath) $bIgnoreCompress = False If Exist(sPath) Then - btnCompress.Tooltip = Subst(("Compressed at &1"), Format(Stat(Path).Size / Stat(sPath).Size, "0%")) + iSize = Stat(sPath).Size + If iSize Then + sComp = Format(Stat(Path).Size / Stat(sPath).Size, "0%") + Else + sComp = "100%" + Endif + btnCompress.Tooltip = Subst(("Compressed at &1"), sComp) Else btnCompress.Tooltip = "" Endif