diff --git a/Views/Grid.xaml.fs b/Views/Grid.xaml.fs index 34b748c..53e94b8 100644 --- a/Views/Grid.xaml.fs +++ b/Views/Grid.xaml.fs @@ -45,6 +45,7 @@ type Grid() as this = let mutable grid_vm: GridViewModel = Unchecked.defaultof<_> let mutable m_debug = states.ui_multigrid + let mutable m_cursor: FVim.Cursor = Unchecked.defaultof<_> let ev_cursor_rect_changed = Event() let ev_text_view_visual_changed = Event() @@ -398,6 +399,14 @@ type Grid() as this = vm.SetMeasuredSize sz sz) + override this.OnInitialized() = + m_cursor <- this.FindControl("cursor") + this.Watch [ + m_cursor.ObservableForProperty(fun c -> c.Bounds) + |> Observable.subscribe(fun _ -> + ev_cursor_rect_changed.Trigger(this, EventArgs.Empty)) + ] + interface IViewFor with member this.ViewModel @@ -417,10 +426,8 @@ type Grid() as this = member _.TextBeforeCursor: string = raise (NotSupportedException()) [] member _.SurroundingTextChanged: IEvent = raise (NotSupportedException()) - member _.CursorRectangle: Rect = - Rect() - member _.TextViewVisual: IVisual = - this.FindControl("cursor") :> IVisual + member _.CursorRectangle: Rect = m_cursor.Bounds + member _.TextViewVisual: IVisual = this :> IVisual [] member _.CursorRectangleChanged: IEvent = ev_cursor_rect_changed.Publish [] member _.TextViewVisualChanged: IEvent = ev_text_view_visual_changed.Publish diff --git a/fvim_avalonia.fsproj b/fvim_avalonia.fsproj new file mode 100644 index 0000000..2250b91 --- /dev/null +++ b/fvim_avalonia.fsproj @@ -0,0 +1,107 @@ + + + + netcoreapp3.1 + FVim + false + fvim.ico + Exe + + + + WinExe + true + true + link + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + %(Filename) + + + + + Designer + + + + + + + + + + + + + + + + runtime; build; native; contentfiles; analyzers + all + + + + + + + + + + + + + + + + + + + +