mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-30 06:37:14 +09:00
Handle same file open in multiple buffers
This commit is contained in:
@@ -1094,7 +1094,12 @@ func (h *BufHandler) Unsplit() bool {
|
||||
// NextSplit changes the view to the next split
|
||||
func (h *BufHandler) NextSplit() bool {
|
||||
a := MainTab().active
|
||||
a = util.Clamp(a+1, 0, len(MainTab().Panes))
|
||||
if a < len(MainTab().Panes)-1 {
|
||||
a++
|
||||
} else {
|
||||
a = 0
|
||||
}
|
||||
|
||||
MainTab().SetActive(a)
|
||||
|
||||
return false
|
||||
@@ -1103,7 +1108,11 @@ func (h *BufHandler) NextSplit() bool {
|
||||
// PreviousSplit changes the view to the previous split
|
||||
func (h *BufHandler) PreviousSplit() bool {
|
||||
a := MainTab().active
|
||||
a = util.Clamp(a-1, 0, len(MainTab().Panes))
|
||||
if a > 0 {
|
||||
a--
|
||||
} else {
|
||||
a = len(MainTab().Panes) - 1
|
||||
}
|
||||
MainTab().SetActive(a)
|
||||
|
||||
return false
|
||||
|
||||
@@ -57,8 +57,7 @@ type BufHandler struct {
|
||||
|
||||
Buf *buffer.Buffer
|
||||
|
||||
cursors []*buffer.Cursor
|
||||
Cursor *buffer.Cursor // the active cursor
|
||||
Cursor *buffer.Cursor // the active cursor
|
||||
|
||||
StartLine int // Vertical scrolling
|
||||
StartCol int // Horizontal scrolling
|
||||
@@ -104,11 +103,9 @@ func NewBufHandler(buf *buffer.Buffer, win display.Window) *BufHandler {
|
||||
h.Buf = buf
|
||||
h.Window = win
|
||||
|
||||
h.cursors = []*buffer.Cursor{buffer.NewCursor(buf, buf.StartCursor)}
|
||||
h.Cursor = h.cursors[0]
|
||||
h.Cursor = h.Buf.GetActiveCursor()
|
||||
h.mouseReleased = true
|
||||
|
||||
buf.SetCursors(h.cursors)
|
||||
return h
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user