Skip to content

Bug: Command palette search field does not filter results (Cmd+P project switcher) #84

@willzhqiang

Description

@willzhqiang

Description

The Cmd+P project switcher (and the general command palette) does not filter results when typing in the search field. All items disappear immediately after entering any character.

Steps to Reproduce

  1. Have 2+ projects open in Mori
  2. Press Cmd+P to open the project switcher
  3. Observe that all projects are listed correctly (e.g. dotfiles, work)
  4. Type any character (e.g. d to filter for dotfiles)

Expected: The list filters to show matching projects (e.g. dotfiles for query d)
Actual: The list becomes empty — no results are shown

This also affects the full command palette (Cmd+Shift+P).

Screenshots

Before typing — projects listed correctly:

Image

After typing d — all results disappear:

Image

Analysis

The code path is:

  1. controlTextDidChangeupdateResults()dataSource?.search(query:)
  2. search() calls FuzzyMatcher.score(query:candidate:) on each item's title

FuzzyMatcher unit tests pass and the algorithm should return positive scores for valid matches (e.g. score(query: "d", candidate: "dotfiles") → 42 by manual trace). The issue is likely that controlTextDidChange is not firing, or searchField.stringValue is not synced with the field editor during editing.

Possible root cause: NSPanel configured with .nonactivatingPanel style mask + becomesKeyOnlyIfNeeded = true may interfere with the NSTextField delegate notification chain. In some macOS versions, the field editor inside a floating panel may not properly trigger controlTextDidChange, or stringValue may return stale content during active editing.

Relevant files

  • Sources/Mori/App/CommandPaletteController.swift — panel setup, controlTextDidChange, updateResults()
  • Sources/Mori/App/CommandPaletteDataSource.swiftsearch(query:) method
  • Packages/MoriCore/Sources/MoriCore/FuzzyMatcher.swift — scoring algorithm

Environment

  • Mori v0.4.1
  • macOS Tahoe 26.3.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions