From 94ae6e44ef8425c76aaa2127e3a804f229d96622 Mon Sep 17 00:00:00 2001 From: kerms Date: Sat, 15 Jun 2024 16:35:52 +0800 Subject: [PATCH] improve(UX) make \r\n default suffix default suffix and ignore \r instead of new line --- src/stores/dataViewerStore.ts | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/src/stores/dataViewerStore.ts b/src/stores/dataViewerStore.ts index 40e66c2..2735539 100644 --- a/src/stores/dataViewerStore.ts +++ b/src/stores/dataViewerStore.ts @@ -138,6 +138,7 @@ function u8toHexdump(buffer: Uint8Array) { function strToHTML(str: string) { return str.replace(/\n/g, '
') // Replace newline with
tag .replace(/\t/g, ' ') // Replace tab with spaces (or you could use ' ' for single spaces) + .replace(/\r/, '') .replace(/ /g, ' '); } @@ -425,8 +426,8 @@ export const useDataViewerStore = defineStore('text-viewer', () => { const forceToBottom = ref(true); const filterChanged = ref(false); - const textSuffixValue = ref("") const textPrefixValue = ref("") + const textSuffixValue = ref("\\r\\n") const uartBaud = ref(115200); const uartBaudReal = ref(115200); @@ -455,28 +456,6 @@ export const useDataViewerStore = defineStore('text-viewer', () => { return encoder.encode(str); }) - // debouncedWatch(() => frameBreakSequence.value, (newValue) => { - // const unescapedStr = unescapeString(newValue); - // const encoder = new TextEncoder(); - // frameBreakSequenceNormalized.value = encoder.encode(unescapedStr); - // }, {debounce: 300, immediate: true}); - // - // debouncedWatch(() => frameBreakDelay.value, (newValue) => { - // if (newValue < 0) { - // frameBreakReady = false; - // clearTimeout(frameBreakTimeoutID); - // } else if (newValue === 0) { - // frameBreakReady = true; - // clearTimeout(frameBreakTimeoutID); - // } else { - // refreshTimeout(); - // } - // }, {debounce: 300, immediate: true}); - - // let frameBreakReady = false; - // let frameBreakTimeoutID = setTimeout(() => { - // }, 0); - const dataArchive: IDataArchive[] = []; const dataBuf: IDataBuf[] = []; const dataBufLength = ref(0);