MCPcopy Create free account
hub / github.com/Predelnik/DSpellCheck / process_replace

Method process_replace

src/ui/ContextMenuHandler.cpp:123–133  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

121}
122
123void ContextMenuHandler::process_replace(WPARAM result) {
124 std::string encoded_str;
125 auto &suggestion = m_last_suggestions[result - 1];
126 if (m_editor.get_encoding() == EditorCodepage::ansi)
127 encoded_str = to_string(suggestion.c_str());
128 else
129 encoded_str = to_utf8_string(suggestion);
130
131 m_editor.replace_text(m_word_under_cursor_pos, m_word_under_cursor_pos + m_word_under_cursor_length, encoded_str.c_str());
132 m_editor.set_cursor_pos(m_word_under_cursor_pos + suggestion.length ());
133}
134
135void ContextMenuHandler::process_replace_all(WPARAM result) {
136 const auto misspelled_text = m_editor.selected_text();

Callers

nothing calls this directly

Calls 6

to_utf8_stringFunction · 0.85
c_strMethod · 0.80
set_cursor_posMethod · 0.80
to_stringFunction · 0.50
get_encodingMethod · 0.45
replace_textMethod · 0.45

Tested by

no test coverage detected