From 6ea5a5d22d10d9a783aa3b914092113f96a8a881 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 19 Feb 2023 15:22:36 -0800 Subject: [PATCH] macos: set ibeam cursor within terminal view --- macos/Sources/TerminalSurfaceView.swift | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/macos/Sources/TerminalSurfaceView.swift b/macos/Sources/TerminalSurfaceView.swift index 9acf38756..9ad7dffc7 100644 --- a/macos/Sources/TerminalSurfaceView.swift +++ b/macos/Sources/TerminalSurfaceView.swift @@ -268,12 +268,17 @@ class TerminalSurfaceView_Real: NSView, NSTextInputClient, ObservableObject { // It is possible this is incorrect when we have splits. This will make // mouse events only happen while the terminal is focused. Is that what // we want? - .activeWhenFirstResponder, + .activeWhenFirstResponder, ], owner: self, userInfo: nil)) } + override func resetCursorRects() { + discardCursorRects() + addCursorRect(frame, cursor: .iBeam) + } + override func viewDidChangeBackingProperties() { guard let surface = self.surface else { return } @@ -317,6 +322,8 @@ class TerminalSurfaceView_Real: NSView, NSTextInputClient, ObservableObject { } override func mouseMoved(with event: NSEvent) { + NSCursor.iBeam.set() + guard let surface = self.surface else { return } // Convert window position to view position. Note (0, 0) is bottom left.