diff --git a/tools/emacsmode/emacs_shortcut.cpp b/tools/emacsmode/emacs_shortcut.cpp index 5fec0d770f..cc6cefbb4a 100644 --- a/tools/emacsmode/emacs_shortcut.cpp +++ b/tools/emacsmode/emacs_shortcut.cpp @@ -32,8 +32,10 @@ namespace Emacs m_keys.push_back(Qt::Key_Underscore); else if (key == "") m_keys.push_back(Qt::Key_Escape); + else if (key == "") + m_keys.push_back(Qt::Key_Slash); else - m_keys.push_back(key.at(0).toAscii() - 'A' + Qt::Key_A); + m_keys.push_back(key.at(0).toAscii() - 'A' + Qt::Key_A); } } diff --git a/tools/emacsmode/emacsmodehandler.cpp b/tools/emacsmode/emacsmodehandler.cpp index 052adf7743..04cdf996c1 100644 --- a/tools/emacsmode/emacsmodehandler.cpp +++ b/tools/emacsmode/emacsmodehandler.cpp @@ -349,6 +349,10 @@ public: void moveDown(int n = 1) { m_tc.movePosition(Down, m_moveMode, n); } void moveRight(int n = 1) { m_tc.movePosition(Right, m_moveMode, n); } void moveLeft(int n = 1) { m_tc.movePosition(Left, m_moveMode, n); } + void newLine(){m_tc.insertBlock();} + void backspace(){m_tc.deletePreviousChar();} + void insertBackSlash(){m_tc.insertText("\\");} + void insertStraightDelim(){m_tc.insertText("|");} void setAnchor() { m_anchor = m_tc.position(); } void setAnchor(int position) { m_anchor = position; } void setPosition(int position) { m_tc.setPosition(position, MoveAnchor); } @@ -576,6 +580,12 @@ void EmacsModeHandler::Private::init() m_shortcuts.push_back(Emacs::Shortcut("|b") .addFn(boost::bind(&EmacsModeHandler::Private::moveLeft, this, 1)) .addFn(boost::bind(&EmacsModeHandler::Private::setKillBufferAppending, this, false))); + m_shortcuts.push_back(Emacs::Shortcut("|m") + .addFn(boost::bind(&EmacsModeHandler::Private::newLine, this)) + .addFn(boost::bind(&EmacsModeHandler::Private::setKillBufferAppending, this, false))); + m_shortcuts.push_back(Emacs::Shortcut("|j") + .addFn(boost::bind(&EmacsModeHandler::Private::backspace, this)) + .addFn(boost::bind(&EmacsModeHandler::Private::setKillBufferAppending, this, false))); m_shortcuts.push_back(Emacs::Shortcut("|e") .addFn(boost::bind(&EmacsModeHandler::Private::moveToEndOfLine, this)) .addFn(boost::bind(&EmacsModeHandler::Private::setKillBufferAppending, this, false))); @@ -597,6 +607,11 @@ void EmacsModeHandler::Private::init() m_shortcuts.push_back(Emacs::Shortcut("|w").addFn(boost::bind(&EmacsModeHandler::Private::killSelected, this))); m_shortcuts.push_back(Emacs::Shortcut("|w").addFn(boost::bind(&EmacsModeHandler::Private::copySelected, this))); + m_shortcuts.push_back(Emacs::Shortcut("|").addFn(boost::bind(&EmacsModeHandler::Private::insertBackSlash, this)) + .addFn(boost::bind(&EmacsModeHandler::Private::setKillBufferAppending, this, false))); + m_shortcuts.push_back(Emacs::Shortcut("|").addFn(boost::bind(&EmacsModeHandler::Private::insertStraightDelim, this)) + .addFn(boost::bind(&EmacsModeHandler::Private::setKillBufferAppending, this, false))); +// m_shortcuts.push_back(Emacs::Shortcut("|w").addFn(boost::bind(&EmacsModeHandler::Private::copySelected, this))); m_shortcuts.push_back(Emacs::Shortcut("|k").addFn(boost::bind(&EmacsModeHandler::Private::killLine, this))); m_shortcuts.push_back(Emacs::Shortcut("|y").addFn(boost::bind(&EmacsModeHandler::Private::yank, this))); m_shortcuts.push_back(Emacs::Shortcut("|x|s").addFn(boost::bind(&EmacsModeHandler::Private::saveCurrentFile, this)));