stricklandrbls commented on code in PR #837:
URL: https://github.com/apache/daffodil-vscode/pull/837#discussion_r1323508205
##########
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:
That's correct. It's the most concrete calculated offset to base relational
offsets from but this will mostly likely be changed in #826 and then I intend
to implement some category of highlighting in the in-progress #784 issue.
--
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]