You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by sh...@apache.org on 2023/03/28 19:33:57 UTC

[daffodil-vscode] branch main updated: Updated byte symbol for undefinedCharStandIn

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

shanedell 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 63cc397  Updated byte symbol for undefinedCharStandIn
63cc397 is described below

commit 63cc397e796e866d7485df4923bb3224cc281fa8
Author: Robert Strickland <st...@gmail.com>
AuthorDate: Mon Mar 27 11:09:14 2023 -0500

    Updated byte symbol for undefinedCharStandIn
    
    - The current committed symbol is not a monospace symbol which was
      causing logical viewport display issues. Changed symbol to ░.
    
    Closes #531
---
 src/omega_edit/utils.ts | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/omega_edit/utils.ts b/src/omega_edit/utils.ts
index 47d53af..ae66879 100644
--- a/src/omega_edit/utils.ts
+++ b/src/omega_edit/utils.ts
@@ -72,7 +72,11 @@ export async function viewportSubscribe(
     })
     .on('error', (err) => {
       // Call cancelled thrown sometimes when server is shutdown
-      if (!err.message.includes('Call cancelled')) throw err
+      if (
+        !err.message.includes('Call cancelled') &&
+        !err.message.includes('UNAVAILABLE')
+      )
+        throw err
     })
 }
 
@@ -94,7 +98,7 @@ export function logicalDisplay(
   bytes: ArrayBuffer,
   bytesPerRow: number
 ): string {
-  const undefinedCharStandIn = '�'
+  const undefinedCharStandIn = 9617
   let result = ''
   if (bytes.byteLength > 0) {
     // TODO: How does this affect the simple editor?
@@ -104,7 +108,9 @@ export function logicalDisplay(
     while (true) {
       for (let col = 0; i < data.length && col < bytesPerRow; ++col) {
         const c = data.charAt(i++)
-        result += (latin1Undefined(c) ? undefinedCharStandIn : c) + ' '
+        result +=
+          (latin1Undefined(c) ? String.fromCharCode(undefinedCharStandIn) : c) +
+          ' '
       }
       result = result.slice(0, result.length - 1)
       if (i === data.length) {