This is an automated email from the ASF dual-hosted git repository.

rstrickland pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-vscode.git


The following commit(s) were added to refs/heads/main by this push:
     new 4d67afa  Fixes Editor Encoding Affecting Search Results
4d67afa is described below

commit 4d67afad079bdc4fa908a2ef0f8626b301af10aa
Author: Robert Strickland <[email protected]>
AuthorDate: Tue Aug 8 10:10:20 2023 -0500

    Fixes Editor Encoding Affecting Search Results
    
    Closes #742
---
 .../components/Header/fieldsets/SearchReplace.svelte | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/src/svelte/src/components/Header/fieldsets/SearchReplace.svelte 
b/src/svelte/src/components/Header/fieldsets/SearchReplace.svelte
index 02b6ebf..36251a7 100644
--- a/src/svelte/src/components/Header/fieldsets/SearchReplace.svelte
+++ b/src/svelte/src/components/Header/fieldsets/SearchReplace.svelte
@@ -71,7 +71,6 @@ limitations under the License.
   let direction: SearchDirection = 'Home'
   let preReplaceHasPrev: boolean = false
   let justReplaced: boolean = false
-  let searchInputByteLen: number = -1
   let searchReplaceButtonWidth = '85pt'
   let searchNavButtonWidth = '55pt'
   $: {
@@ -79,10 +78,15 @@ limitations under the License.
     inlineClass = CSSThemeClass('inline-container')
     inputClass = CSSThemeClass('actionable')
   }
+  $: clearOnEncodingChange($editorEncoding)
   $: searchErrDisplay = $searchErr.length > 0 && !$searchable
   $: replaceErrDisplay = $replaceErr.length > 0 && !$replaceable
   $: $seekErr = $seekable.seekErrMsg
 
+  function clearOnEncodingChange(encoding: string) {
+    cancel()
+  }
+
   function search(
     searchOffset: number,
     searchLength: number,
@@ -367,7 +371,7 @@ limitations under the License.
         <Button
           width={searchNavButtonWidth}
           fn={searchFirst}
-          disabledBy={!hasPrev}
+          disabledBy={!hasPrev || !$searchable}
           description="Seek to the first match"
         >
           <span slot="left" class="btn-icon material-symbols-outlined"
@@ -378,7 +382,7 @@ limitations under the License.
         <Button
           width={searchNavButtonWidth}
           fn={searchPrev}
-          disabledBy={!hasPrev}
+          disabledBy={!hasPrev || !$searchable}
           description="Seek to the previous match"
         >
           <span slot="left" class="btn-icon material-symbols-outlined"
@@ -387,7 +391,11 @@ limitations under the License.
           <span slot="default">&nbsp;Prev</span></Button
         >
         {#if showReplaceOptions}
-          <Button fn={replace} description="Replace the current match">
+          <Button
+            fn={replace}
+            description="Replace the current match"
+            disabledBy={!replaceable}
+          >
             <span slot="left" class="btn-icon material-symbols-outlined"
               >find_replace</span
             >
@@ -397,7 +405,7 @@ limitations under the License.
         <Button
           width={searchNavButtonWidth}
           fn={searchNext}
-          disabledBy={!hasNext}
+          disabledBy={!hasNext || !$searchable}
           description="Seek to the next match"
         >
           <span slot="default">Next&nbsp;</span>
@@ -408,7 +416,7 @@ limitations under the License.
         <Button
           width={searchNavButtonWidth}
           fn={searchLast}
-          disabledBy={!hasNext}
+          disabledBy={!hasNext || !$searchable}
           description="Seek to the last match"
         >
           <span slot="default">Last&nbsp;</span>

Reply via email to