fix: long string overflow in value page

fix: border radius show and hide logic incorrect on Windows
This commit is contained in:
tiny-craft 2023-10-30 21:54:20 +08:00
parent 0143e8f52a
commit ff8da4ca60
6 changed files with 41 additions and 18 deletions

View File

@ -1,9 +1,10 @@
package strutil
import "unicode/utf8"
import (
"unicode"
)
func containsBinary(str string) bool {
//buf := []byte(str)
//size := 0
//for start := 0; start < len(buf); start += size {
// var r rune
@ -11,9 +12,11 @@ func containsBinary(str string) bool {
// return true
// }
//}
if !utf8.ValidString(str) {
rs := []rune(str)
for _, r := range rs {
if !unicode.IsPrint(r) {
return true
}
}
return false
}

View File

@ -69,6 +69,16 @@ const wrapperStyle = computed(() => {
borderRadius: '10px',
}
})
const spinStyle = computed(() => {
return hideRadius.value
? {
backgroundColor: themeVars.value.bodyColor,
}
: {
backgroundColor: themeVars.value.bodyColor,
borderRadius: '10px',
}
})
const onToggleFullscreen = (fullscreen) => {
hideRadius.value = fullscreen
@ -82,10 +92,14 @@ const onToggleFullscreen = (fullscreen) => {
const onToggleMaximize = (isMaximised) => {
if (isMaximised) {
maximised.value = true
hideRadius.value = isMacOS()
if (!isMacOS()) {
hideRadius.value = true
}
} else {
maximised.value = false
hideRadius.value = !isMacOS()
if (!isMacOS()) {
hideRadius.value = false
}
}
}
@ -105,10 +119,7 @@ onMounted(async () => {
<template>
<!-- app content-->
<n-spin
:show="props.loading"
:style="{ backgroundColor: themeVars.bodyColor }"
:theme-overrides="{ opacitySpinning: 0 }">
<n-spin :show="props.loading" :style="spinStyle" :theme-overrides="{ opacitySpinning: 0 }">
<div id="app-content-wrapper" :style="wrapperStyle" class="flex-box-v">
<!-- title bar -->
<div
@ -156,7 +167,7 @@ onMounted(async () => {
style="--wails-draggable: none">
<nav-menu v-model:value="tabStore.nav" :width="data.navMenuWidth" />
<!-- browser page -->
<div v-show="tabStore.nav === 'browser'" class="flex-box-h flex-item-expand">
<div v-show="tabStore.nav === 'browser'" class="content-area flex-box-h flex-item-expand">
<resizeable-wrapper
v-model:size="prefStore.behavior.asideWidth"
:min-size="300"
@ -178,7 +189,7 @@ onMounted(async () => {
</div>
<!-- server list page -->
<div v-show="tabStore.nav === 'server'" class="flex-box-h flex-item-expand">
<div v-show="tabStore.nav === 'server'" class="content-area flex-box-h flex-item-expand">
<resizeable-wrapper
v-model:size="prefStore.behavior.asideWidth"
:min-size="300"
@ -191,7 +202,7 @@ onMounted(async () => {
</div>
<!-- log page -->
<div v-show="tabStore.nav === 'log'" class="flex-box-h flex-item-expand">
<div v-show="tabStore.nav === 'log'" class="content-area flex-box-h flex-item-expand">
<content-log-pane ref="logPaneRef" class="flex-item-expand" />
</div>
</div>
@ -229,6 +240,10 @@ onMounted(async () => {
#app-content {
height: calc(100% - 60px);
.content-area {
overflow: hidden;
}
}
.app-side {

View File

@ -183,7 +183,7 @@ const onSaveValue = async () => {
</div>
<div class="value-wrapper value-item-part flex-item-expand flex-box-v">
<n-scrollbar v-if="!inEdit" class="flex-item-expand">
<n-code :code="props.value" :language="viewLanguage" show-line-numbers style="cursor: text" word-wrap />
<n-code :code="props.value" :language="viewLanguage" style="cursor: text" word-wrap />
</n-scrollbar>
<n-input
v-else

View File

@ -5,6 +5,8 @@
export const formatTypes = {
PLAIN_TEXT: 'Plain Text',
JSON: 'JSON',
// XML: 'XML',
// YML: 'YML',
HEX: 'Hex',
BINARY: 'Binary',
}

3
go.mod
View File

@ -6,6 +6,7 @@ require (
github.com/adrg/sysfont v0.1.2
github.com/andybalholm/brotli v1.0.6
github.com/google/uuid v1.3.1
github.com/klauspost/compress v1.17.2
github.com/redis/go-redis/v9 v9.2.1
github.com/vrischmann/userdir v0.0.0-20151206171402-20f291cebd68
github.com/wailsapp/wails/v2 v2.6.0
@ -33,7 +34,7 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/samber/lo v1.38.1 // indirect
github.com/stretchr/testify v1.8.3 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/tkrajina/go-reflector v0.5.6 // indirect
github.com/valyala/bytebufferpool v1.0.0 // indirect
github.com/valyala/fasttemplate v1.2.2 // indirect

6
go.sum
View File

@ -27,6 +27,8 @@ github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4=
github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e h1:Q3+PugElBCf4PFpxhErSzU3/PY5sFL5Z6rfv4AbGAck=
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e/go.mod h1:alcuEEnZsY1WQsagKhZDsoPCRoOijYqhZvPwLG0kzVs=
github.com/klauspost/compress v1.17.2 h1:RlWWUY/Dr4fL8qk9YG7DTZ7PDgME2V4csBXA8L/ixi4=
github.com/klauspost/compress v1.17.2/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
@ -71,8 +73,8 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.3 h1:RP3t2pwF7cMEbC1dqtB6poj3niw/9gnV4Cjg5oW5gtY=
github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/tkrajina/go-reflector v0.5.6 h1:hKQ0gyocG7vgMD2M3dRlYN6WBBOmdoOzJ6njQSepKdE=
github.com/tkrajina/go-reflector v0.5.6/go.mod h1:ECbqLgccecY5kPmPmXg1MrHW585yMcDkVl6IvJe64T4=
github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=