}
+void KeySymbol::init(int key)
+{
+ key_ = key;
+ text_ = from_utf8(qkey_to_string(key));
+ LYXERR(Debug::KEY, "Init key to " << key_ << ", " << to_utf8(text_));
+}
+
+
bool KeySymbol::isOK() const
{
bool const ok = !(text_.empty() && qkey_to_string(key_).empty());
#include "Cursor.h"
#include "Font.h"
#include "FuncRequest.h"
+#include "KeyMap.h"
#include "KeySymbol.h"
+#include "KeySequence.h"
#include "LyX.h"
#include "LyXRC.h"
#include "LyXVC.h"
#include "frontends/Application.h"
#include "frontends/CaretGeometry.h"
-
#include "frontends/FontMetrics.h"
#include "frontends/WorkAreaManager.h"
LYXERR(Debug::KEY, "preeditString: " << e->preeditString()
<< " commitString: " << e->commitString());
- // insert the processed text in the document (handles undo)
if (!e->commitString().isEmpty()) {
- FuncRequest cmd(LFUN_SELF_INSERT,
- qstring_to_ucs4(e->commitString()),
- FuncRequest::KEYBOARD);
+ FuncRequest cmd;
+ // take care of commit string assigned to a shortcut
+ // e.g. quotation mark on international keyboard
+ KeySequence keyseq;
+ for (QChar const & ch : e->commitString()) {
+ KeySymbol keysym;
+ keysym.init(ch.unicode());
+ keyseq.addkey(keysym, NoModifier);
+ }
+ cmd = theTopLevelKeymap().getBinding(keyseq);
+
+ if (cmd == FuncRequest::noaction || cmd == FuncRequest::unknown
+ || cmd.action() == LFUN_SELF_INSERT)
+ // insert the processed text in the document (handles undo)
+ cmd = FuncRequest(LFUN_SELF_INSERT, qstring_to_ucs4(e->commitString()));
+
+ cmd.setOrigin(FuncRequest::KEYBOARD);
dispatch(cmd);
// FIXME: this is supposed to remove traces from preedit
// string. Can we avoid calling it explicitly?