CodeEditApp / CodeEditApp/CodeEditSourceEditor

MinimapView hitTest ignores isHidden, intercepts clicks when minimap is hidden

オープン
#370 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Swift
スター
719
フォーク
160
PR マージ指標
30日以内にマージされた PR はありません

説明

## 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`:

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

Combined with the empty `mouseDown` override:
```swift
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`:

```swift
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

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。