From 1179e3a0fc194c39b7fbae7bba85895c69e4e0c4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= <benoit.minisini@gambas-basic.org>
Date: Wed, 3 Aug 2022 12:57:00 +0200
Subject: [PATCH] FileView: Correctly set the item texts so that renaming works
 as expected in all cases.

[GB.FORM]
* BUG: FileView: Correctly set the item texts so that renaming works as expected in all cases.
---
 comp/src/gb.form/.src/File/FileView.class | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/comp/src/gb.form/.src/File/FileView.class b/comp/src/gb.form/.src/File/FileView.class
index 102406658..2f880039c 100644
--- a/comp/src/gb.form/.src/File/FileView.class
+++ b/comp/src/gb.form/.src/File/FileView.class
@@ -393,7 +393,7 @@ Private Sub RefreshView()
   Dim aDir As New String[]
   Dim I As Integer
   Dim sText As String
-  Dim bRichText As Boolean
+  Dim sRichText As String
   Dim hCache As DirCache
   Dim iHiddenFg As Integer
   Dim SX As Integer
@@ -495,17 +495,14 @@ Private Sub RefreshView()
           Endif
         Endif
         
-        bRichText = False
-        
         sText = Replace(sFile, "\n", "")
+        sRichText = ""
         
         If .Link Then
-          sText = "<i>" & sText & "</i>"
-          bRichText = True
+          sRichText = "<i>" & sText & "</i>"
         Endif
         If .Hidden Then
-          sText = "<font color=\"#" & Hex$(iHiddenFg, 6) & "\">" & sText & "</font>"
-          bRichText = True
+          sRichText = "<font color=\"#" & Hex$(iHiddenFg, 6) & "\">" & sText & "</font>"
         Endif
   
         If $hColumnView.Visible Then
@@ -524,7 +521,7 @@ Private Sub RefreshView()
             .[1] = Main.FormatSize(hInfo.Size)
             .[2] = Str(hInfo.Time)
             .[3] = hInfo.Auth
-            If bRichText Then .RichText = sText
+            If sRichText Then .RichText = sRichText
           End With
         Else
           If Not $hIconView.Exist(sKey) Then
@@ -537,7 +534,7 @@ Private Sub RefreshView()
               GoSub ADD_PREVIEW
             Endif
           Endif
-          If bRichText Then $hIconView[sKey].RichText = sText
+          If sRichText Then $hIconView[sKey].RichText = sRichText
         Endif
         
       End With