This commit is contained in:
Bohdan Horbeshko 2022-04-01 12:35:54 -04:00
parent 2f38af12a2
commit 86cbbcb8bd
4 changed files with 16 additions and 14 deletions

View file

@ -140,20 +140,20 @@ func ClaspDirectives(text string, entities []*client.TextEntity) []*client.TextE
endOffset := entity.Offset + entity.Length
if unicode.IsSpace(doubledRunes[entity.Offset]) {
for j, r := range doubledRunes[entity.Offset+1:endOffset] {
for j, r := range doubledRunes[entity.Offset+1 : endOffset] {
if !unicode.IsSpace(r) {
dirty = true
entity.Offset += int32(j+1)
entity.Length -= int32(j+1)
entity.Offset += int32(j + 1)
entity.Length -= int32(j + 1)
break
}
}
}
if unicode.IsSpace(doubledRunes[endOffset-1]) {
for j := endOffset-2; j >= entity.Offset; j-- {
for j := endOffset - 2; j >= entity.Offset; j-- {
if !unicode.IsSpace(doubledRunes[j]) {
dirty = true
entity.Length = j+1-entity.Offset
entity.Length = j + 1 - entity.Offset
break
}
}

View file

@ -375,7 +375,7 @@ func (c *Client) formatFile(file *client.File, compact bool) string {
return ""
}
size64:= uint64(file.Size)
size64 := uint64(file.Size)
c.prepareDiskSpace(size64)
basename := file.Remote.UniqueId + filepath.Ext(src)

View file

@ -33,6 +33,7 @@ const (
maxUint64 uint64 = (1 << 64) - 1
)
var sizeRegex = regexp.MustCompile("\\A([0-9]+) ?([KMGTPE]?B?)\\z")
// NewComponent starts a new component and wraps it in

View file

@ -11,6 +11,7 @@ import (
// StorageQuota is a value from config parsed to bytes number
var StorageQuota uint64
// CachedStorageSize estimates the storage size between full rescans
var CachedStorageSize uint64
var StorageLock = sync.Mutex{}