mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-07-05 00:59:19 +02:00
remove caching of styles in gocui
This commit is contained in:
17
vendor/github.com/jesseduffield/gocui/tcell_driver.go
generated
vendored
17
vendor/github.com/jesseduffield/gocui/tcell_driver.go
generated
vendored
@ -5,7 +5,6 @@
|
||||
package gocui
|
||||
|
||||
import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/gdamore/tcell/v2"
|
||||
@ -21,11 +20,6 @@ type oldStyle struct {
|
||||
outputMode OutputMode
|
||||
}
|
||||
|
||||
// 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 {
|
||||
if s, e := tcell.NewScreen(); e != nil {
|
||||
@ -58,13 +52,6 @@ func tcellSetCell(x, y int, ch rune, fg, bg Attribute, outputMode OutputMode) {
|
||||
|
||||
// getTcellStyle creates tcell.Style from Attributes
|
||||
func getTcellStyle(input oldStyle) tcell.Style {
|
||||
cacheMutex.RLock()
|
||||
cachedResult, ok := cellStyleCache[input]
|
||||
cacheMutex.RUnlock()
|
||||
if ok {
|
||||
return cachedResult
|
||||
}
|
||||
|
||||
st := tcell.StyleDefault
|
||||
|
||||
// extract colors and attributes
|
||||
@ -77,10 +64,6 @@ func getTcellStyle(input oldStyle) tcell.Style {
|
||||
st = setTcellFontEffectStyle(st, input.bg)
|
||||
}
|
||||
|
||||
cacheMutex.Lock()
|
||||
cellStyleCache[input] = st
|
||||
cacheMutex.Unlock()
|
||||
|
||||
return st
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user