cursor
This commit is contained in:
@@ -10,6 +10,7 @@ final class HelderTerminalView: LocalProcessTerminalView, TerminalSessionHandle,
|
||||
var appliedSettings: HelderConfig.Terminal?
|
||||
var appliedScale = 1.0
|
||||
private var closeObserver: NSObjectProtocol?
|
||||
private lazy var pointerTracker = PointerTracker(view: self)
|
||||
private let events = ProcessEvents()
|
||||
|
||||
init(kind: TerminalKind, store: TerminalStore) {
|
||||
@@ -116,12 +117,21 @@ final class HelderTerminalView: LocalProcessTerminalView, TerminalSessionHandle,
|
||||
/// The first click in an inactive window already places the selection or reaches the program.
|
||||
override func acceptsFirstMouse(for event: NSEvent?) -> Bool { true }
|
||||
|
||||
/// SwiftTerm's own tracking area has no cursor updates, so entering the grid would not re-read the pointer.
|
||||
override func updateTrackingAreas() {
|
||||
super.updateTrackingAreas()
|
||||
pointerTracker.update()
|
||||
}
|
||||
|
||||
/// SwiftTerm's `resetCursorRects` is not open, so its I-beam rect is filtered here and leaves out the scroller.
|
||||
override func addCursorRect(_ rect: NSRect, cursor object: NSCursor) {
|
||||
guard rect.isUsableCursorRect else { return }
|
||||
guard object == .iBeam else { return super.addCursorRect(rect, cursor: object) }
|
||||
guard allowsIBeamRect else { return }
|
||||
let scroller = subviews.first { $0 is NSScroller && !$0.isHidden }
|
||||
super.addCursorRect(scroller.map { rect.removing($0.frame) } ?? rect, cursor: object)
|
||||
let area = scroller.map { rect.removing($0.frame) } ?? rect
|
||||
guard area.isUsableCursorRect else { return }
|
||||
super.addCursorRect(area, cursor: object)
|
||||
}
|
||||
|
||||
/// Gives this class its own `cursorUpdate:` that asks the policy; Swift cannot override SwiftTerm's I-beam one,
|
||||
@@ -134,7 +144,7 @@ final class HelderTerminalView: LocalProcessTerminalView, TerminalSessionHandle,
|
||||
if PointerPolicy.isSelecting || view.isTopmost(atWindowPoint: point) {
|
||||
view.updatePointer(atWindowPoint: point)
|
||||
} else {
|
||||
PointerPolicy.updateCursor(in: window)
|
||||
PointerPolicy.scheduleUpdate(in: window)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user