From 26d4f4c8879d50885128a69b84a229d2631b10f6 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Mon, 29 Mar 2021 23:55:02 +1100 Subject: [PATCH] more mutexes --- edit.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/edit.go b/edit.go index 62d46cf..c9828a7 100644 --- a/edit.go +++ b/edit.go @@ -395,6 +395,9 @@ func (v *View) writeRune(x, y int, ch rune) error { // position corresponding to the point (x, y). // returns the amount of columns that where removed. func (v *View) deleteRune(x, y int) (int, error) { + v.writeMutex.Lock() + defer v.writeMutex.Unlock() + v.tainted = true x, y, err := v.realPosition(x, y) @@ -422,6 +425,9 @@ func (v *View) deleteRune(x, y int) (int, error) { // mergeLines merges the lines "y" and "y+1" if possible. func (v *View) mergeLines(y int) error { + v.writeMutex.Lock() + defer v.writeMutex.Unlock() + v.tainted = true _, y, err := v.realPosition(0, y) @@ -443,6 +449,9 @@ func (v *View) mergeLines(y int) error { // breakLine breaks a line of the internal buffer at the position corresponding // to the point (x, y). func (v *View) breakLine(x, y int) error { + v.writeMutex.Lock() + defer v.writeMutex.Unlock() + v.tainted = true x, y, err := v.realPosition(x, y)