awesome-gocui / gocui

Minimalist Go package aimed at creating Console User Interfaces.
BSD 3-Clause "New" or "Revised" License
344 stars 39 forks source link

Feature/safety #39

Closed glvr182 closed 5 years ago

glvr182 commented 5 years ago

Some safety improvements

Once the reviews are in I'll merge it

mjarkk commented 5 years ago

Nice PR, I’ll review it later today

glvr182 commented 5 years ago

Updated to latest master

glvr182 commented 5 years ago

Interesting point, do you know of a more efficient way we could handle this?

mjarkk commented 5 years ago
v.writeMutex.Lock()
// Fill with empty cells, if writing outside current view buffer
v.makeWriteable(v.wx, v.wy)
v.writeRunes(bytes.Runes(p))
v.writeMutex.Unlock()

It's not really shorter but you don't need the defer, and it's easier to read because you can read from top to bottom

glvr182 commented 5 years ago

Fair enough, I shall refactor it

glvr182 commented 5 years ago

I have updated it according to your suggestions @mjarkk

skanehira commented 5 years ago

LGTM :)