diff options
author | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-12 23:05:52 +1000 |
---|---|---|
committer | Jesse Duffield <jessedduffield@gmail.com> | 2021-04-12 23:40:20 +1000 |
commit | 730a03a3b245047f502581b1d1b2df8bce2b2310 (patch) | |
tree | b921906cf93c50d2f388a8cfa4843cd5acbf7894 /vendor | |
parent | 7d195b97c2b3a575884c474610c9f7ed66e26400 (diff) |
fix race condition
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/github.com/jesseduffield/gocui/edit.go | 15 | ||||
-rw-r--r-- | vendor/modules.txt | 2 |
2 files changed, 7 insertions, 10 deletions
diff --git a/vendor/github.com/jesseduffield/gocui/edit.go b/vendor/github.com/jesseduffield/gocui/edit.go index 1e98468c4..ee6d7f604 100644 --- a/vendor/github.com/jesseduffield/gocui/edit.go +++ b/vendor/github.com/jesseduffield/gocui/edit.go @@ -131,6 +131,9 @@ func (v *View) EditGotoToEndOfLine() { // EditDelete deletes a rune at the cursor position. back determines the // direction. func (v *View) EditDelete(back bool) { + v.writeMutex.Lock() + defer v.writeMutex.Unlock() + x, y := v.ox+v.cx, v.oy+v.cy if y < 0 { return @@ -177,6 +180,9 @@ func (v *View) EditDelete(back bool) { // EditNewLine inserts a new line under the cursor. func (v *View) EditNewLine() { + v.writeMutex.Lock() + defer v.writeMutex.Unlock() + v.breakLine(v.cx, v.cy) v.ox = 0 v.cy = v.cy + 1 @@ -397,9 +403,6 @@ 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) @@ -427,9 +430,6 @@ 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.clearViewLines() _, y, err := v.realPosition(0, y) @@ -451,9 +451,6 @@ 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) diff --git a/vendor/modules.txt b/vendor/modules.txt index a458811c9..68c377230 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -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.20210412113212-ee65bd542c08 +# github.com/jesseduffield/gocui v0.3.1-0.20210412130453-de7bb5079f9f ## explicit github.com/jesseduffield/gocui # github.com/jesseduffield/termbox-go v0.0.0-20200823212418-a2289ed6aafe |