Skip to content

Fix Find selection with RichEdit native search - #38

Open
HaruLerrz wants to merge 1 commit into
forloopcodes:mainfrom
HaruLerrz:pr-fix-find-richedit-search
Open

Fix Find selection with RichEdit native search#38
HaruLerrz wants to merge 1 commit into
forloopcodes:mainfrom
HaruLerrz:pr-fix-find-richedit-search

Conversation

@HaruLerrz

Copy link
Copy Markdown

This fixes Find selection positioning by using RichEdit's native search API.

Previously, Find searched through text returned by GetEditorText() and then passed the resulting std::wstring index to EM_SETSEL. In some cases, that index can differ from RichEdit's internal character positions, causing the wrong text to be selected.

This change uses EM_FINDTEXTEXW and then applies the cpMin / cpMax range returned by RichEdit directly.

Tested locally:

  • Find Next
  • Find Previous
  • repeated matches
  • not-found message

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant