1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-08-24 19:39:16 +02:00
This commit is contained in:
Jesse Duffield
2021-04-03 15:56:11 +11:00
parent fafd5234bd
commit 0898a7bb57
36 changed files with 215 additions and 171 deletions

View File

@@ -5,6 +5,8 @@
package gocui
import (
"sync"
"github.com/gdamore/tcell/v2"
)
@@ -21,6 +23,7 @@ type oldStyle struct {
// we're using this cache to speed up rendering, because obtaining the tcell style
// from the old style is deterministic
var cellStyleCache map[oldStyle]tcell.Style = map[oldStyle]tcell.Style{}
var cacheMutex = sync.RWMutex{}
// tcellInit initializes tcell screen for use.
func tcellInit() error {
@@ -43,7 +46,10 @@ func tcellSetCell(x, y int, ch rune, fg, bg Attribute, outputMode OutputMode) {
// getTcellStyle creates tcell.Style from Attributes
func getTcellStyle(input oldStyle) tcell.Style {
if cachedResult, ok := cellStyleCache[input]; ok {
cacheMutex.RLock()
cachedResult, ok := cellStyleCache[input]
cacheMutex.RUnlock()
if ok {
return cachedResult
}
@@ -59,7 +65,9 @@ func getTcellStyle(input oldStyle) tcell.Style {
st = setTcellFontEffectStyle(st, input.bg)
}
cacheMutex.Lock()
cellStyleCache[input] = st
cacheMutex.Unlock()
return st
}

View File

@@ -1342,7 +1342,15 @@ func (selfRelativeSD *SECURITY_DESCRIPTOR) copySelfRelativeSecurityDescriptor()
h.Len = sdLen
h.Cap = sdLen
dst := make([]byte, sdLen)
const psize = int(unsafe.Sizeof(uintptr(0)))
var dst []byte
h = (*unsafeheader.Slice)(unsafe.Pointer(&dst))
alloc := make([]uintptr, (sdLen+psize-1)/psize)
h.Data = (*unsafeheader.Slice)(unsafe.Pointer(&alloc)).Data
h.Len = sdLen
h.Cap = sdLen
copy(dst, src)
return (*SECURITY_DESCRIPTOR)(unsafe.Pointer(&dst[0]))
}

4
vendor/modules.txt vendored
View File

@@ -149,7 +149,7 @@ github.com/jesseduffield/go-git/v5/utils/merkletrie/filesystem
github.com/jesseduffield/go-git/v5/utils/merkletrie/index
github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame
github.com/jesseduffield/go-git/v5/utils/merkletrie/noder
# github.com/jesseduffield/gocui v0.3.1-0.20210402113210-6fd7ef27ce76
# github.com/jesseduffield/gocui v0.3.1-0.20210403045716-a3be78c4ccf6
## explicit
github.com/jesseduffield/gocui
# github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe
@@ -235,7 +235,7 @@ golang.org/x/crypto/ssh/knownhosts
golang.org/x/net/context
golang.org/x/net/internal/socks
golang.org/x/net/proxy
# golang.org/x/sys v0.0.0-20210331175145-43e1dd70ce54
# golang.org/x/sys v0.0.0-20210402192133-700132347e07
## explicit
golang.org/x/sys/cpu
golang.org/x/sys/internal/unsafeheader