Commit 3b8d208
committed
feat(find-bar): close inline find bar on Escape even without focus
Previously, pressing Escape only closed the find bar when a text field
inside it had keyboard focus (handled via NSControlTextEditingDelegate).
If focus had moved back to the editor, Escape had no effect on the bar.
Install a local NSEvent monitor (NSEventMaskKeyDown) when the bar is
shown, and remove it when the bar closes or is deallocated. The monitor
intercepts keyCode 53 (Escape) app-wide and closes the bar regardless
of which view holds focus. The existing focused-field path is unchanged;
the hidden-guard in the monitor block prevents a double-close if both
paths fire for the same event.1 parent 1551d33 commit 3b8d208
1 file changed
Lines changed: 36 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
53 | 53 | | |
54 | 54 | | |
55 | 55 | | |
| 56 | + | |
56 | 57 | | |
57 | 58 | | |
58 | 59 | | |
| |||
183 | 184 | | |
184 | 185 | | |
185 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
| |||
192 | 196 | | |
193 | 197 | | |
194 | 198 | | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
195 | 204 | | |
196 | 205 | | |
197 | 206 | | |
| |||
222 | 231 | | |
223 | 232 | | |
224 | 233 | | |
| 234 | + | |
225 | 235 | | |
226 | 236 | | |
227 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
228 | 264 | | |
229 | 265 | | |
230 | 266 | | |
| |||
0 commit comments