MinimapView hitTest ignores isHidden, intercepts clicks when minimap is hidden

Đang mở Phù hợp với người mới
#370 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
1/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
68/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Đình trệ
Công nghệ
swift
Lĩnh vực
desktop

Hướng nghiên cứu

Bắt đầu tại MinimapView.hitTest(_:) và phần override mouseDown(with:) trong trình soạn thảo mã nguồn. Tái hiện với SourceEditorConfiguration được đặt thành showMinimap: false, sau đó xác minh rằng các lần nhấp trong frame trước đây của minimap đi tới text view bên dưới và tương tác bình thường với minimap vẫn không bị ảnh hưởng.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Description

When showMinimap is set to false in SourceEditorConfiguration, the MinimapView is hidden via isHidden = true. However, clicks on the right ~140px of the editor are still intercepted by the hidden minimap, preventing cursor placement in that area.

Root Cause

MinimapView.hitTest(_:) overrides NSView.hitTest but does not check isHidden:

override public func hitTest(_ point: NSPoint) -> NSView? {
    guard let point = superview?.convert(point, to: self) else { return nil }
    // ...
}

Combined with the empty mouseDown override:

override public func mouseDown(with event: NSEvent) { }

This means the hidden minimap silently swallows all click events in its frame area.

Steps to Reproduce

  1. Create a SourceEditor with peripherals: .init(showMinimap: false)
  2. Open any text file
  3. Try to click on the right portion of the editor (where the minimap would normally be)
  4. The cursor does not move — the click is eaten by the hidden minimap

Expected Behavior

When showMinimap: false, clicks should pass through to the underlying text view.

Suggested Fix

Add an isHidden guard at the top of hitTest:

override public func hitTest(_ point: NSPoint) -> NSView? {
    guard !isHidden else { return nil }
    guard let point = superview?.convert(point, to: self) else { return nil }
    // ...
}

Environment

  • CodeEditSourceEditor v0.15.2
  • macOS 15.5, Apple Silicon
Ngôn ngữ chính
Swift
Star
720
Fork
162
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của CodeEditApp/CodeEditSourceEditor

Tất cả issue của CodeEditApp/CodeEditSourceEditor

Issue tương tự

Thêm issue về Swift

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.