InsertMode insert the whole utf8 representation of a codepoint

This commit is contained in:
Maxime Coste 2012-10-09 14:31:00 +02:00
parent c0db3b81be
commit e1d4215159

View File

@ -393,6 +393,14 @@ private:
int m_current_completion = -1;
};
String codepoint_to_str(utf8::Codepoint cp)
{
std::string str;
auto it = back_inserter(str);
utf8::dump(it, cp);
return String(str);
}
class Insert : public ClientMode
{
public:
@ -440,7 +448,7 @@ public:
m_inserter.move_cursors({ 1, 0});
break;
default:
m_inserter.insert(String() + key.key);
m_inserter.insert(codepoint_to_str(key.key));
if (m_inserter.editor().selections().size() == 1 and
is_word(key.key))
{