replace char: fix unicode handling
This commit is contained in:
parent
44ca4d23de
commit
9c2bbe218b
|
@ -61,14 +61,6 @@ private:
|
||||||
int m_count = 0;
|
int m_count = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
String codepoint_to_str(Codepoint cp)
|
|
||||||
{
|
|
||||||
std::string str;
|
|
||||||
auto it = back_inserter(str);
|
|
||||||
utf8::dump(it, cp);
|
|
||||||
return String(str);
|
|
||||||
}
|
|
||||||
|
|
||||||
class LineEditor
|
class LineEditor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -102,7 +102,7 @@ void do_replace_with_char(Context& context)
|
||||||
SelectionList sels = editor.selections();
|
SelectionList sels = editor.selections();
|
||||||
auto restore_sels = on_scope_end([&]{ editor.select(std::move(sels)); });
|
auto restore_sels = on_scope_end([&]{ editor.select(std::move(sels)); });
|
||||||
editor.multi_select(std::bind(select_all_matches, _1, "."));
|
editor.multi_select(std::bind(select_all_matches, _1, "."));
|
||||||
editor.insert(String() + key.key, InsertMode::Replace);
|
editor.insert(codepoint_to_str(key.key), InsertMode::Replace);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,14 @@ inline String operator"" _str(const char* str, size_t)
|
||||||
return String(str);
|
return String(str);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline String codepoint_to_str(Codepoint cp)
|
||||||
|
{
|
||||||
|
std::string str;
|
||||||
|
auto it = back_inserter(str);
|
||||||
|
utf8::dump(it, cp);
|
||||||
|
return String(str);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace std
|
namespace std
|
||||||
|
|
Loading…
Reference in New Issue
Block a user