scholarsmate commented on code in PR #837:
URL: https://github.com/apache/daffodil-vscode/pull/837#discussion_r1323494808


##########
src/svelte/src/stores/index.ts:
##########
@@ -218,14 +232,38 @@ export const selectionSize = derived(
   }
 )
 
+// How to handle the offset given in the input field for seek
+export const seekOffsetSearchType = derived(
+  seekOffsetInput,
+  ($seekOffsetInput) => {
+    const sign = $seekOffsetInput.substring(0, 1)
+    return sign === '+' || sign === '-'
+      ? OffsetSearchType.RELATIVE
+      : OffsetSearchType.ABSOLUTE
+  },
+  OffsetSearchType.ABSOLUTE
+)
+
 // derived from the seek offset input and the current address radix
 export const seekOffset = derived(
-  [seekOffsetInput, addressRadix],
-  ([$seekOffsetInput, $addressRadix]) => {
-    return $seekOffsetInput.length > 0
-      ? Math.max(0, parseInt($seekOffsetInput, $addressRadix))
-      : 0
-  }
+  [seekOffsetInput, seekOffsetSearchType, dataFeedLineTopOffset, addressRadix],
+  ([
+    $seekOffsetInput,
+    $seekOffsetSearchType,
+    $dataFeedLineTopOffset,
+    $addressRadix,
+  ]) => {
+    if ($seekOffsetSearchType === OffsetSearchType.ABSOLUTE) {
+      return $seekOffsetInput.length > 0
+        ? Math.max(0, parseInt($seekOffsetInput, $addressRadix))
+        : 0
+    } else
+      return (
+        Math.max(0, $dataFeedLineTopOffset) +
+        parseInt($seekOffsetInput, $addressRadix)

Review Comment:
   So the relative offsets are relative to the top left offset?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to