mirror of
https://github.com/felixangell/phi.git
synced 2024-08-16 19:20:21 +03:00
fixed #78
This commit is contained in:
parent
97eeba791f
commit
6f893604ab
23
gui/view.go
23
gui/view.go
@ -97,21 +97,27 @@ func (n *View) removeBuffer(index int) {
|
||||
|
||||
buffPane.Resize(bufferWidth, n.h)
|
||||
buffPane.SetPosition(bufferWidth*idx, 0)
|
||||
|
||||
// set the focus buff, this will be set
|
||||
// to the last buffer.
|
||||
n.focusedBuff = buffPane.Buff.index
|
||||
}
|
||||
}
|
||||
|
||||
dir := -1
|
||||
if n.focusedBuff == 0 {
|
||||
dir = 1
|
||||
}
|
||||
|
||||
n.ChangeFocus(dir)
|
||||
}
|
||||
|
||||
// FIXME
|
||||
func (n *View) ChangeFocus(dir int) {
|
||||
prevBuff := n.getCurrentBuffPane()
|
||||
if prevBuff == nil {
|
||||
// what do?
|
||||
// we cant change focus if there are no
|
||||
// buffers to focus to
|
||||
if len(n.buffers) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
prevBuff := n.buffers[n.focusedBuff]
|
||||
|
||||
if dir == -1 {
|
||||
n.focusedBuff--
|
||||
} else if dir == 1 {
|
||||
@ -257,9 +263,10 @@ func (n *View) AddBuffer() *Buffer {
|
||||
var bufferWidth int
|
||||
bufferWidth = n.w / (c.index + 1)
|
||||
|
||||
n.buffers = append(n.buffers, NewBufferPane(c))
|
||||
n.focusedBuff = c.index
|
||||
|
||||
n.buffers = append(n.buffers, NewBufferPane(c))
|
||||
|
||||
// translate all the buffers accordingly.
|
||||
idx := 0
|
||||
for _, buffPane := range n.buffers {
|
||||
|
Loading…
Reference in New Issue
Block a user