1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-01-04 03:48:07 +02:00
This commit is contained in:
Jesse Duffield 2023-07-10 12:09:32 +10:00
parent 6b9390409e
commit a0154dc525

View File

@ -186,8 +186,8 @@ func (self *ViewBufferManager) NewCmdTask(start func() (*exec.Cmd, io.Reader), p
go utils.Safe(func() {
isViewStale := true
writeToView := func(content []byte) {
_, _ = self.writer.Write(content)
isViewStale = true
_, _ = self.writer.Write(content)
}
refreshViewIfStale := func() {
if isViewStale {
@ -299,18 +299,18 @@ type TaskOpts struct {
}
func (self *ViewBufferManager) NewTask(f func(TaskOpts) error, key string) error {
task := self.newGocuiTask()
gocuiTask := self.newGocuiTask()
var completeTaskOnce sync.Once
completeTask := func() {
completeGocuiTask := func() {
completeTaskOnce.Do(func() {
task.Done()
gocuiTask.Done()
})
}
go utils.Safe(func() {
defer completeTask()
defer completeGocuiTask()
self.taskIDMutex.Lock()
self.newTaskID++
@ -350,7 +350,7 @@ func (self *ViewBufferManager) NewTask(f func(TaskOpts) error, key string) error
self.waitingMutex.Unlock()
if err := f(TaskOpts{Stop: stop, InitialContentLoaded: completeTask}); err != nil {
if err := f(TaskOpts{Stop: stop, InitialContentLoaded: completeGocuiTask}); err != nil {
self.Log.Error(err) // might need an onError callback
}