mirror of
https://github.com/zyedidia/micro.git
synced 2026-03-19 23:37:13 +09:00
Make tab.CurView public
This commit is contained in:
@@ -1557,7 +1557,7 @@ func (v *View) Unsplit(usePlugin bool) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
curView := tabs[curTab].curView
|
||||
curView := tabs[curTab].CurView
|
||||
for i := len(tabs[curTab].views) - 1; i >= 0; i-- {
|
||||
view := tabs[curTab].views[i]
|
||||
if view != nil && view.Num != curView {
|
||||
@@ -1579,10 +1579,10 @@ func (v *View) NextSplit(usePlugin bool) bool {
|
||||
}
|
||||
|
||||
tab := tabs[curTab]
|
||||
if tab.curView < len(tab.views)-1 {
|
||||
tab.curView++
|
||||
if tab.CurView < len(tab.views)-1 {
|
||||
tab.CurView++
|
||||
} else {
|
||||
tab.curView = 0
|
||||
tab.CurView = 0
|
||||
}
|
||||
|
||||
if usePlugin {
|
||||
@@ -1598,10 +1598,10 @@ func (v *View) PreviousSplit(usePlugin bool) bool {
|
||||
}
|
||||
|
||||
tab := tabs[curTab]
|
||||
if tab.curView > 0 {
|
||||
tab.curView--
|
||||
if tab.CurView > 0 {
|
||||
tab.CurView--
|
||||
} else {
|
||||
tab.curView = len(tab.views) - 1
|
||||
tab.CurView = len(tab.views) - 1
|
||||
}
|
||||
|
||||
if usePlugin {
|
||||
|
||||
@@ -440,7 +440,7 @@ func main() {
|
||||
// is the one being clicked in
|
||||
for _, v := range tabs[curTab].views {
|
||||
if x >= v.x && x < v.x+v.Width && y >= v.y && y < v.y+v.Height {
|
||||
tabs[curTab].curView = v.Num
|
||||
tabs[curTab].CurView = v.Num
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ func (l *LeafNode) VSplit(buf *Buffer, splitIndex int) {
|
||||
copy(tab.views[splitIndex+1:], tab.views[splitIndex:])
|
||||
tab.views[splitIndex] = newView
|
||||
|
||||
tab.curView = splitIndex
|
||||
tab.CurView = splitIndex
|
||||
} else {
|
||||
if splitIndex > 1 {
|
||||
splitIndex = 1
|
||||
@@ -98,7 +98,7 @@ func (l *LeafNode) VSplit(buf *Buffer, splitIndex int) {
|
||||
copy(tab.views[splitIndex+1:], tab.views[splitIndex:])
|
||||
tab.views[splitIndex] = newView
|
||||
|
||||
tab.curView = splitIndex
|
||||
tab.CurView = splitIndex
|
||||
}
|
||||
|
||||
tab.Resize()
|
||||
@@ -127,7 +127,7 @@ func (l *LeafNode) HSplit(buf *Buffer, splitIndex int) {
|
||||
copy(tab.views[splitIndex+1:], tab.views[splitIndex:])
|
||||
tab.views[splitIndex] = newView
|
||||
|
||||
tab.curView = splitIndex
|
||||
tab.CurView = splitIndex
|
||||
} else {
|
||||
if splitIndex > 1 {
|
||||
splitIndex = 1
|
||||
@@ -152,7 +152,7 @@ func (l *LeafNode) HSplit(buf *Buffer, splitIndex int) {
|
||||
copy(tab.views[splitIndex+1:], tab.views[splitIndex:])
|
||||
tab.views[splitIndex] = newView
|
||||
|
||||
tab.curView = splitIndex
|
||||
tab.CurView = splitIndex
|
||||
}
|
||||
|
||||
tab.Resize()
|
||||
@@ -175,8 +175,8 @@ func (l *LeafNode) Delete() {
|
||||
for i, v := range tab.views {
|
||||
v.Num = i
|
||||
}
|
||||
if tab.curView > 0 {
|
||||
tab.curView--
|
||||
if tab.CurView > 0 {
|
||||
tab.CurView--
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ type Tab struct {
|
||||
// multiple views with splits
|
||||
views []*View
|
||||
// This is the current view for this tab
|
||||
curView int
|
||||
CurView int
|
||||
// Generally this is the name of the current view's buffer
|
||||
name string
|
||||
|
||||
@@ -73,7 +73,7 @@ func (t *Tab) Resize() {
|
||||
// CurView returns the current view
|
||||
func CurView() *View {
|
||||
curTab := tabs[curTab]
|
||||
return curTab.views[curTab.curView]
|
||||
return curTab.views[curTab.CurView]
|
||||
}
|
||||
|
||||
// TabbarString returns the string that should be displayed in the tabbar
|
||||
@@ -89,7 +89,7 @@ func TabbarString() (string, map[int]int) {
|
||||
} else {
|
||||
str += " "
|
||||
}
|
||||
str += t.views[t.curView].Buf.GetName()
|
||||
str += t.views[t.CurView].Buf.GetName()
|
||||
if i == curTab {
|
||||
str += "]"
|
||||
} else {
|
||||
|
||||
@@ -778,7 +778,7 @@ func (v *View) DisplayView() {
|
||||
lineNumStyle = style
|
||||
}
|
||||
if style, ok := colorscheme["current-line-number"]; ok {
|
||||
if curLineN == v.Cursor.Y && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() {
|
||||
if curLineN == v.Cursor.Y && tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() {
|
||||
lineNumStyle = style
|
||||
}
|
||||
}
|
||||
@@ -816,7 +816,7 @@ func (v *View) DisplayView() {
|
||||
}
|
||||
}
|
||||
|
||||
if tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN && colN == v.Cursor.X {
|
||||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN && colN == v.Cursor.X {
|
||||
v.DisplayCursor(screenX-v.leftCol, screenY)
|
||||
}
|
||||
|
||||
@@ -842,7 +842,7 @@ func (v *View) DisplayView() {
|
||||
|
||||
// We need to display the background of the linestyle with the correct color if cursorline is enabled
|
||||
// and this is the current view and there is no selection on this line and the cursor is on this line
|
||||
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
|
||||
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
|
||||
if style, ok := colorscheme["cursor-line"]; ok {
|
||||
fg, _, _ := style.Decompose()
|
||||
lineStyle = lineStyle.Background(fg)
|
||||
@@ -868,7 +868,7 @@ func (v *View) DisplayView() {
|
||||
lineIndentStyle = style
|
||||
}
|
||||
}
|
||||
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
|
||||
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
|
||||
if style, ok := colorscheme["cursor-line"]; ok {
|
||||
fg, _, _ := style.Decompose()
|
||||
lineIndentStyle = lineIndentStyle.Background(fg)
|
||||
@@ -910,7 +910,7 @@ func (v *View) DisplayView() {
|
||||
}
|
||||
// Here we are at a newline
|
||||
|
||||
if tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN && colN == v.Cursor.X {
|
||||
if tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN && colN == v.Cursor.X {
|
||||
v.DisplayCursor(screenX-v.leftCol, screenY)
|
||||
}
|
||||
|
||||
@@ -933,7 +933,7 @@ func (v *View) DisplayView() {
|
||||
|
||||
for i := 0; i < v.Width; i++ {
|
||||
lineStyle := defStyle
|
||||
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].curView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
|
||||
if v.Buf.Settings["cursorline"].(bool) && tabs[curTab].CurView == v.Num && !v.Cursor.HasSelection() && v.Cursor.Y == curLineN {
|
||||
if style, ok := colorscheme["cursor-line"]; ok {
|
||||
fg, _, _ := style.Decompose()
|
||||
lineStyle = lineStyle.Background(fg)
|
||||
|
||||
Reference in New Issue
Block a user