Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

MinimapView hitTest ignores isHidden, intercepts clicks when minimap is hidden

未關閉 適合新手
#370 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
1/5
預估耗時
1-3 小時
新手友好度
68/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
停滯
技術堆疊
swift
領域
desktop

研究方向

從原始碼編輯器中的 MinimapView.hitTest(_:) 及其 mouseDown(with:) override 開始。將 SourceEditorConfiguration 設定為 showMinimap: false 進行重現,然後確認在 minimap 原有 frame 中的點擊能到達下方的文字檢視區,且正常的 minimap 互動不受影響。

由索引模型根據 Issue 內容生成。

描述

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
主要語言
Swift
星號
720
分支
162
PR 合併指標
30 天內沒有已合併 PR

貢獻指南

這個儲存庫沒有索引到貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

CodeEditApp/CodeEditSourceEditor 的其他 Issue

查看 CodeEditApp/CodeEditSourceEditor 的全部 Issue

相似的 Issue

更多 Swift Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。