@@ -78,6 +78,8 @@ and GridViewModel(_gridid: int, ?_parent: GridViewModel, ?_gridsize: GridSize) a
7878 let mutable m_is_external = false
7979 let mutable m_is_float = false
8080 let mutable m_is_msg = false
81+ let mutable _m_msg_win_row = 0
82+ let mutable _m_is_msg_root = false
8183 let mutable m_msg_scrolled = false
8284 let mutable m_msg_sepchar = " "
8385 let mutable m_z = - 100
@@ -372,6 +374,8 @@ and GridViewModel(_gridid: int, ?_parent: GridViewModel, ?_gridsize: GridSize) a
372374 m_ msg_ scrolled <- scrolled
373375 m_ msg_ sepchar <- sep_ char
374376 m_ z <- 9999 // always put msg window on the top
377+ let r , _ = this.AbsAnchor
378+ getRootGrid() .SetMsgWinRow r // notify root about our position
375379
376380 // example:
377381 // editorvm #5: setWinFloatPos: r = 51.000000 c = 0.000000 z = 50 anchor = SouthWest anchor_grid = 1
@@ -622,29 +626,36 @@ and GridViewModel(_gridid: int, ?_parent: GridViewModel, ?_gridsize: GridSize) a
622626 if id = _ gridid then
623627 m_ cursor_ vm.row <- row
624628 m_ cursor_ vm.col <- col
629+ // do not move to msg window 1st character
625630 // translation back to parent
626631 if m_ parent.IsSome then
627- #if DEBUG
628- trace _ gridid " CursorGoto parent"
629- #endif
632+ #if DEBUG
633+ trace _ gridid " CursorGoto: %d %d %d -> parent" id row col
634+ #endif
630635 let rr , rc = this.RelAnchor
631636 m_ parent.Value.CursorGoto m_ parent.Value.GridId ( row + rr) ( col + rc)
632- // goto me
637+ // goto me (a top-level grid)
633638 else
634- #if DEBUG
635- trace _ gridid " CursorGoto me"
636- #endif
637- m_ cursor_ vm.focused <- true
638- this.IsFocused <- true
639- this.CursorConfig()
639+ if _ m_ is_ msg_ root && row = _ m_ msg_ win_ row && col = 0 then
640+ #if DEBUG
641+ trace _ gridid " CursorGoto: %d %d %d -> root msg ignore" id row col
642+ #endif
643+ ()
644+ else
645+ #if DEBUG
646+ trace _ gridid " CursorGoto: %d %d %d -> me" id row col
647+ #endif
648+ m_ cursor_ vm.focused <- true
649+ this.IsFocused <- true
650+ this.CursorConfig()
640651 // goto my child
641652 elif m_ child_ grids.FindIndex( fun x -> x.GridId = id) > - 1 then
642653 ()
643654 // was me, but not anymore
644655 elif m_ cursor_ vm.focused then
645- #if DEBUG
646- trace _ gridid " CursorGoto notme"
647- #endif
656+ #if DEBUG
657+ trace _ gridid " CursorGoto: %d %d %d notme" id row col
658+ #endif
648659 m_ cursor_ vm.focused <- false
649660 m_ cursor_ vm.RenderTick <- m_ cursor_ vm.RenderTick + 1
650661
@@ -843,6 +854,9 @@ and GridViewModel(_gridid: int, ?_parent: GridViewModel, ?_gridsize: GridSize) a
843854 member __.ScrollbarData = m_ scrollbar_ top, m_ scrollbar_ bot, m_ scrollbar_ row, m_ scrollbar_ col, m_ scrollbar_ linecount
844855 member __.IsFloat = m_ is_ float
845856 member __.IsMsg = m_ is_ msg
857+ member __.SetMsgWinRow x =
858+ _ m_ msg_ win_ row <- x
859+ _ m_ is_ msg_ root <- true
846860 member __.BufNr = m_ bufnr
847861 member __.Extmarks = m_ extmarks
848862 member __.ExtmarksOob = m_ extmarks_ oob
0 commit comments