Skip to content

editor::SelectNext and editor::SelectPrevious behaviour inconsistent #27258

@jakcharvat

Description

@jakcharvat

Summary

editor::SelectNext only searches for next occurrences, where the occurrence is a whole word. editor::SelectPrevious allows occurrences which are subwords too.

In a state like this (syntax the same as in gpui tests):

«abcˇ»
abcdef
abc

invoking editor::SelectNext will skip the abcdef and result in.

«abcˇ»
abcdef
«abcˇ»

On the other hand, when in a state like this

abc
abcdef
«abcˇ»

invoking editor::SelectPrevious will not skip the abcdef and will result in

abc
«abcˇ»def
«abcˇ»

test_select_next and test_select_previous_with_single_selection seem to suggest this is intended behaviour, is that so? If so, is there a documented justification for the inconsistency? Could we add an option to both the editor actions that would allow to choose whether to require full-word matches?

As they only delegate to the editor actions, their vim counterparts have the same inconsistency.

Zed Version and System Specs

Zed: v0.179.1 (Zed Preview)
OS: macOS 15.3.2
Memory: 32 GiB
Architecture: aarch64

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions