commit a714f6cb76a37c73cad44a402196f67536e889f5
Author: Richard Heck <[email protected]>
Date:   Mon Apr 16 22:49:06 2018 -0400

    Move LFUN_UNICODE_INSERT to BufferView, per JMarc's suggestion.
---
 src/BufferView.cpp           |   28 ++++++++++++++++++++++++++++
 src/Text3.cpp                |   23 -----------------------
 src/mathed/InsetMathNest.cpp |   25 -------------------------
 3 files changed, 28 insertions(+), 48 deletions(-)

diff --git a/src/BufferView.cpp b/src/BufferView.cpp
index dafcc9d..27176b3 100644
--- a/src/BufferView.cpp
+++ b/src/BufferView.cpp
@@ -65,6 +65,7 @@
 #include "insets/InsetText.h"
 
 #include "mathed/MathData.h"
+#include "mathed/InsetMathNest.h"
 
 #include "frontends/alert.h"
 #include "frontends/Application.h"
@@ -1907,6 +1908,33 @@ void BufferView::dispatch(FuncRequest const & cmd, 
DispatchResult & dr)
        }
 
 
+       case LFUN_UNICODE_INSERT: {
+               if (cmd.argument().empty())
+                       break;
+
+               FuncCode code = cur.inset().currentMode() == Inset::MATH_MODE ?
+                       LFUN_MATH_INSERT : LFUN_SELF_INSERT;
+               int i = 0;
+               while (true) {
+                       docstring const arg = from_utf8(cmd.getArg(i));
+                       if (arg.empty())
+                               break;
+                       if (!isHex(arg)) {
+                               LYXERR0("Not a hexstring: " << arg);
+                               ++i;
+                               continue;
+                       }
+                       char_type c = hexToInt(arg);
+                       if (c >= 32 && c < 0x10ffff) {
+                               LYXERR(Debug::KEY, "Inserting c: " << c);
+                               lyx::dispatch(FuncRequest(code, docstring(1, 
c)));
+                       }
+                       ++i;
+               }
+               break;
+       }
+
+
        // This would be in Buffer class if only Cursor did not
        // require a bufferview
        case LFUN_INSET_FORALL: {
diff --git a/src/Text3.cpp b/src/Text3.cpp
index 833a7ed..e3e436b 100644
--- a/src/Text3.cpp
+++ b/src/Text3.cpp
@@ -1696,29 +1696,6 @@ void Text::dispatch(Cursor & cur, FuncRequest & cmd)
                bv->buffer().errors("Paste");
                break;
 
-       case LFUN_UNICODE_INSERT: {
-               if (cmd.argument().empty())
-                       break;
-               int i = 0;
-               while (true) {
-                       docstring const arg = from_utf8(cmd.getArg(i));
-                       if (arg.empty())
-                               break;
-                       if (!isHex(arg)) {
-                               LYXERR0("Not a hexstring: " << arg);
-                               ++i;
-                               continue;
-                       }
-                       char_type c = hexToInt(arg);
-                       if (c >= 32 && c < 0x10ffff) {
-                               LYXERR(Debug::KEY, "Inserting c: " << c);
-                               lyx::dispatch(FuncRequest(LFUN_SELF_INSERT, 
docstring(1, c)));
-                       }
-                       ++i;
-               }
-               break;
-       }
-
        case LFUN_QUOTE_INSERT: {
                cap::replaceSelection(cur);
                cur.recordUndo();
diff --git a/src/mathed/InsetMathNest.cpp b/src/mathed/InsetMathNest.cpp
index 6f41591..b026b88 100644
--- a/src/mathed/InsetMathNest.cpp
+++ b/src/mathed/InsetMathNest.cpp
@@ -1246,31 +1246,6 @@ void InsetMathNest::doDispatch(Cursor & cur, FuncRequest 
& cmd)
                break;
        }
 
-       case LFUN_UNICODE_INSERT: {
-               if (cmd.argument().empty())
-                       break;
-               int i = 0;
-               while (true) {
-                       docstring const arg = from_utf8(cmd.getArg(i));
-                       if (arg.empty())
-                               break;
-                       if (!isHex(arg)) {
-                               LYXERR0("Not a hexstring: " << arg);
-                               ++i;
-                               continue;
-                       }
-                       char_type c = hexToInt(arg);
-                       if (c >= 32 && c < 0x10ffff) {
-                               LYXERR(Debug::KEY, "Inserting c: " << c);
-                               FuncCode code = currentMode() == MATH_MODE ?
-                                       LFUN_MATH_INSERT : LFUN_SELF_INSERT;
-                               lyx::dispatch(FuncRequest(code, docstring(1, 
c)));
-                       }
-                       ++i;
-               }
-               break;
-       }
-
        case LFUN_DIALOG_SHOW_NEW_INSET: {
                docstring const & name = cmd.argument();
                string data;

Reply via email to