fakevim: distinquish :q and :q!

javascripteditor: compile fix Linux, compile fix namespaces
This commit is contained in:
hjk
2009-03-31 11:53:42 +02:00
parent aedeadf01b
commit c3b3bd121a
5 changed files with 14 additions and 23 deletions

View File

@@ -296,7 +296,6 @@ private:
void notImplementedYet();
void updateMiniBuffer();
void updateSelection();
void quit();
QWidget *editor() const;
QChar characterAtCursor() const
{ return m_tc.document()->characterAt(m_tc.position()); }
@@ -479,7 +478,6 @@ EventResult FakeVimHandler::Private::handleEvent(QKeyEvent *ev)
KEY_DEBUG("PASSING PLAIN KEY..." << ev->key() << ev->text());
//if (key == ',') { // use ',,' to leave, too.
// qDebug() << "FINISHED...";
// quit();
// return EventHandled;
//}
m_passing = false;
@@ -1696,7 +1694,7 @@ void FakeVimHandler::Private::handleExCommand(const QString &cmd0)
enterCommandMode();
} else if (cmd == "q!" || cmd == "q") { // :q
showBlackMessage(QString());
quit();
q->quitRequested(cmd == "q!");
} else if (reDelete.indexIn(cmd) != -1) { // :d
selectRange(beginLine, endLine);
QString reg = reDelete.cap(2);
@@ -2454,13 +2452,6 @@ void FakeVimHandler::Private::enterExMode()
m_mode = ExMode;
}
void FakeVimHandler::Private::quit()
{
EDITOR(setCursorWidth(m_cursorWidth));
EDITOR(setOverwriteMode(false));
q->quitRequested();
}
void FakeVimHandler::Private::recordJump()
{
m_jumpListUndo.append(position());
@@ -2533,11 +2524,6 @@ void FakeVimHandler::handleCommand(const QString &cmd)
d->handleExCommand(cmd);
}
void FakeVimHandler::quit()
{
d->quit();
}
void FakeVimHandler::setCurrentFileName(const QString &fileName)
{
d->m_currentFileName = fileName;

View File

@@ -54,7 +54,6 @@ public slots:
// This executes an "ex" style command taking context
// information from widget;
void handleCommand(const QString &cmd);
void quit();
void installEventFilter();
@@ -66,7 +65,7 @@ signals:
void commandBufferChanged(const QString &msg);
void statusDataChanged(const QString &msg);
void extraInformationChanged(const QString &msg);
void quitRequested();
void quitRequested(bool force);
void selectionChanged(const QList<QTextEdit::ExtraSelection> &selection);
void writeFileRequested(bool *handled,
const QString &fileName, const QString &contents);

View File

@@ -237,7 +237,7 @@ private slots:
void showExtraInformation(const QString &msg);
void changeSelection(const QList<QTextEdit::ExtraSelection> &selections);
void writeFile(bool *handled, const QString &fileName, const QString &contents);
void quitFile();
void quitFile(bool forced);
void moveToMatchingParenthesis(bool *moved, bool *forward, QTextCursor *cursor);
void indentRegion(int *amount, int beginLine, int endLine, QChar typedChar);
@@ -332,8 +332,8 @@ void FakeVimPluginPrivate::editorOpened(Core::IEditor *editor)
this, SLOT(showExtraInformation(QString)));
connect(handler, SIGNAL(commandBufferChanged(QString)),
this, SLOT(showCommandBuffer(QString)));
connect(handler, SIGNAL(quitRequested()),
this, SLOT(quitFile()), Qt::QueuedConnection);
connect(handler, SIGNAL(quitRequested(bool)),
this, SLOT(quitFile(bool)), Qt::QueuedConnection);
connect(handler, SIGNAL(writeFileRequested(bool*,QString,QString)),
this, SLOT(writeFile(bool*,QString,QString)));
connect(handler, SIGNAL(selectionChanged(QList<QTextEdit::ExtraSelection>)),
@@ -389,14 +389,14 @@ void FakeVimPluginPrivate::triggerCompletions()
// bt->triggerCompletions();
}
void FakeVimPluginPrivate::quitFile()
void FakeVimPluginPrivate::quitFile(bool forced)
{
FakeVimHandler *handler = qobject_cast<FakeVimHandler *>(sender());
if (!handler)
return;
QList<Core::IEditor *> editors;
editors.append(m_editorToHandler.key(handler));
Core::EditorManager::instance()->closeEditors(editors, true);
Core::EditorManager::instance()->closeEditors(editors, !forced);
}
void FakeVimPluginPrivate::writeFile(bool *handled,

View File

@@ -4,6 +4,8 @@
#include <qnumeric.h>
#include <QHash>
QT_BEGIN_NAMESPACE
namespace JavaScript {
int Ecma::RegExp::flagFromChar(const QChar &ch)
@@ -109,3 +111,4 @@ qjsreal integerFromString(const QString &str, int radix)
} // end of namespace JavaScript
QT_END_NAMESPACE

View File

@@ -5,6 +5,8 @@
#include <QString>
#include <QSet>
QT_BEGIN_NAMESPACE
namespace JavaScript {
class Node;
@@ -75,7 +77,7 @@ public:
: _lexer(0), _nodePool(0), _ast(0)
{ }
JavaScriptNameIdImpl *JavaScriptEnginePrivate::intern(const QChar *u, int s)
JavaScriptNameIdImpl *intern(const QChar *u, int s)
{ return const_cast<JavaScriptNameIdImpl *>(&*_literals.insert(JavaScriptNameIdImpl(u, s))); }
JavaScript::Lexer *lexer() const
@@ -101,5 +103,6 @@ public:
}
};
QT_END_NAMESPACE
#endif // JAVASCRIPTENGINE_P_H