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 endOffset := entity.Offset + entity.Length
if unicode.IsSpace(doubledRunes[entity.Offset]) { 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) { if !unicode.IsSpace(r) {
dirty = true dirty = true
entity.Offset += int32(j+1) entity.Offset += int32(j + 1)
entity.Length -= int32(j+1) entity.Length -= int32(j + 1)
break break
} }
} }
} }
if unicode.IsSpace(doubledRunes[endOffset-1]) { 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]) { if !unicode.IsSpace(doubledRunes[j]) {
dirty = true dirty = true
entity.Length = j+1-entity.Offset entity.Length = j + 1 - entity.Offset
break break
} }
} }

View file

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

View file

@ -33,6 +33,7 @@ const (
maxUint64 uint64 = (1 << 64) - 1 maxUint64 uint64 = (1 << 64) - 1
) )
var sizeRegex = regexp.MustCompile("\\A([0-9]+) ?([KMGTPE]?B?)\\z") var sizeRegex = regexp.MustCompile("\\A([0-9]+) ?([KMGTPE]?B?)\\z")
// NewComponent starts a new component and wraps it in // 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 // StorageQuota is a value from config parsed to bytes number
var StorageQuota uint64 var StorageQuota uint64
// CachedStorageSize estimates the storage size between full rescans // CachedStorageSize estimates the storage size between full rescans
var CachedStorageSize uint64 var CachedStorageSize uint64
var StorageLock = sync.Mutex{} var StorageLock = sync.Mutex{}