[code] Add EmptyChar in text for python event to position the cursor at

the right place after inserting text
This commit is contained in:
Émilie Feral
2018-06-11 15:37:23 +02:00
committed by LeaNumworks
parent 52065c26ed
commit 9e345014d2

View File

@@ -1,5 +1,6 @@
#include "helpers.h"
#include <string.h>
#include <ion.h>
namespace Code {
namespace Helpers {
@@ -14,24 +15,23 @@ private:
const char * m_text;
};
static constexpr const char k_exponential[7] = {'e', 'x', 'p', '(', Ion::Charset::Empty, ')', 0};
static constexpr const char k_logarithm[7] = {'l', 'o', 'g', '(', Ion::Charset::Empty, ')', 0};
static constexpr const char k_logarithm10[9] = {'l', 'o', 'g', '1', '0', '(', Ion::Charset::Empty, ')', 0};
static constexpr const char k_sqrt[8] = {'s', 'q', 'r', 't', '(', Ion::Charset::Empty, ')', 0};
static constexpr EventTextPair sEventTextMap[] = {
EventTextPair(Ion::Events::XNT, "x"),
EventTextPair(Ion::Events::Exp, "exp()"),
EventTextPair(Ion::Events::Ln, "log()"),
EventTextPair(Ion::Events::Log, "log10()"),
EventTextPair(Ion::Events::Sine, "sin()"),
EventTextPair(Ion::Events::Cosine, "cos()"),
EventTextPair(Ion::Events::Tangent, "tan()"),
EventTextPair(Ion::Events::Exp, k_exponential),
EventTextPair(Ion::Events::Ln, k_logarithm),
EventTextPair(Ion::Events::Log, k_logarithm10),
EventTextPair(Ion::Events::Imaginary, "1j"),
EventTextPair(Ion::Events::Power, "**"),
EventTextPair(Ion::Events::Pi, "pi"),
EventTextPair(Ion::Events::Sqrt, "sqrt()"),
EventTextPair(Ion::Events::Sqrt, k_sqrt),
EventTextPair(Ion::Events::Square, "**2"),
EventTextPair(Ion::Events::Multiplication, "*"),
EventTextPair(Ion::Events::EE, "e"),
EventTextPair(Ion::Events::Arcsine, "asin()"),
EventTextPair(Ion::Events::Arccosine, "acos()"),
EventTextPair(Ion::Events::Arctangent, "atan()")
};
const char * PythonTextForEvent(Ion::Events::Event event) {