mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-29 22:27:13 +09:00
Simplify UpdateDiff() interface
The callback passed to UpdateDiff() is superfluous: in the synchronous case screen.Redraw() is not needed anyway (since the screen is redrawn at every iteration of the main loop), and in the asynchronous case UpdateDiff() can just call screen.Redraw() directly.
This commit is contained in:
@@ -384,18 +384,7 @@ func (w *BufWindow) displayBuffer() {
|
||||
|
||||
if b.ModifiedThisFrame {
|
||||
if b.Settings["diffgutter"].(bool) {
|
||||
b.UpdateDiff(func(synchronous bool) {
|
||||
// If the diff was updated asynchronously, the outer call to
|
||||
// displayBuffer might already be completed and we need to
|
||||
// schedule a redraw in order to display the new diff.
|
||||
// Note that this cannot lead to an infinite recursion
|
||||
// because the modifications were cleared above so there won't
|
||||
// be another call to UpdateDiff when displayBuffer is called
|
||||
// during the redraw.
|
||||
if !synchronous {
|
||||
screen.Redraw()
|
||||
}
|
||||
})
|
||||
b.UpdateDiff()
|
||||
}
|
||||
b.ModifiedThisFrame = false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user