Skip to content

Commit de65d2d

Browse files
committed
Minor fixes for process to get the maximum number of lines in a file
1 parent 1981682 commit de65d2d

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

editor/workspace.go

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,7 @@ func (w *Workspace) initGonvim() {
738738
aug GoneovimCore | au! | aug END
739739
au GoneovimCore VimEnter * call rpcnotify(0, "Gui", "gonvim_enter")
740740
au GoneovimCore UIEnter * call rpcnotify(0, "Gui", "gonvim_uienter")
741-
au GoneovimCore BufEnter * call rpcnotify(0, "Gui", "gonvim_bufenter", line("$"), win_getid())
741+
au GoneovimCore BufEnter * call rpcnotify(0, "Gui", "gonvim_bufenter", win_getid())
742742
au GoneovimCore WinEnter,FileType * call rpcnotify(0, "Gui", "gonvim_winenter_filetype", &ft, win_getid())
743743
au GoneovimCore OptionSet * if &ro != 1 | silent! call rpcnotify(0, "Gui", "gonvim_optionset", expand("<amatch>"), v:option_new, v:option_old, win_getid()) | endif
744744
au GoneovimCore TermEnter * call rpcnotify(0, "Gui", "gonvim_termenter")
@@ -755,11 +755,6 @@ func (w *Workspace) initGonvim() {
755755
`
756756
}
757757

758-
if editor.config.ScrollBar.Visible || editor.config.Editor.SmoothScroll {
759-
gonvimAutoCmds = gonvimAutoCmds + `
760-
au GoneovimCore TextChanged,TextChangedI * call rpcnotify(0, "Gui", "gonvim_textchanged", line("$"))
761-
`
762-
}
763758
if editor.config.Editor.Clipboard {
764759
gonvimAutoCmds = gonvimAutoCmds + `
765760
au GoneovimCore TextYankPost * call rpcnotify(0, "Gui", "gonvim_copy_clipboard")
@@ -1852,6 +1847,11 @@ func (w *Workspace) windowViewport(args []interface{}) {
18521847
w.viewportQue <- scrollvp
18531848
}
18541849

1850+
maxLine := 0
1851+
if len(arg) >= 7 {
1852+
maxLine = util.ReflectToInt(arg[6])
1853+
}
1854+
18551855
// Only the viewport of the buffer where the cursor is located is used internally.
18561856
grid := util.ReflectToInt(arg[0])
18571857
if grid == w.cursor.gridid {
@@ -1861,6 +1861,8 @@ func (w *Workspace) windowViewport(args []interface{}) {
18611861
w.viewport = viewport
18621862
w.viewportMutex.Unlock()
18631863
}
1864+
w.maxLineDelta = maxLine - w.maxLine
1865+
w.maxLine = maxLine
18641866
}
18651867
}
18661868
}
@@ -2145,9 +2147,9 @@ func (w *Workspace) handleRPCGui(updates []interface{}) {
21452147
w.terminalMode = false
21462148
w.cursor.update()
21472149
case "gonvim_bufenter":
2148-
w.maxLine = util.ReflectToInt(updates[1])
2150+
// w.maxLine = util.ReflectToInt(updates[1])
21492151
// w.setBuffname(updates[2], updates[3])
2150-
w.setBuffTS(util.ReflectToInt(updates[2]))
2152+
w.setBuffTS(util.ReflectToInt(updates[1]))
21512153
case "gonvim_winenter_filetype":
21522154
// w.setBuffname(updates[2], updates[3])
21532155
w.setBuffTS(util.ReflectToInt(updates[2]))
@@ -2161,8 +2163,8 @@ func (w *Workspace) handleRPCGui(updates []interface{}) {
21612163
}
21622164
win.doGetSnapshot = true
21632165
}
2164-
w.maxLineDelta = util.ReflectToInt(updates[1]) - w.maxLine
2165-
w.maxLine = util.ReflectToInt(updates[1])
2166+
// w.maxLineDelta = util.ReflectToInt(updates[1]) - w.maxLine
2167+
// w.maxLine = util.ReflectToInt(updates[1])
21662168

21672169
default:
21682170
fmt.Println("unhandled Gui event", event)

0 commit comments

Comments
 (0)