Changeset View
Changeset View
Standalone View
Standalone View
src/vimode/appcommands.cpp
Show All 13 Lines | 1 | /* This file is part of the KDE libraries | |||
---|---|---|---|---|---|
14 | 14 | | |||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License | ||
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to | ||
17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 17 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
18 | Boston, MA 02110-1301, USA. | 18 | Boston, MA 02110-1301, USA. | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #include <QDir> | 21 | #include <QDir> | ||
22 | #include <QRegularExpression> | ||||
22 | #include <QTimer> | 23 | #include <QTimer> | ||
23 | 24 | | |||
24 | #include <KLocalizedString> | 25 | #include <KLocalizedString> | ||
25 | #include <KTextEditor/Application> | 26 | #include <KTextEditor/Application> | ||
26 | #include <KTextEditor/Document> | 27 | #include <KTextEditor/Document> | ||
27 | #include <KTextEditor/Editor> | 28 | #include <KTextEditor/Editor> | ||
28 | #include <KTextEditor/MainWindow> | 29 | #include <KTextEditor/MainWindow> | ||
29 | #include <KTextEditor/View> | 30 | #include <KTextEditor/View> | ||
30 | 31 | | |||
31 | #include <vimode/appcommands.h> | 32 | #include <vimode/appcommands.h> | ||
32 | 33 | | |||
33 | using namespace KateVi; | 34 | using namespace KateVi; | ||
34 | 35 | | |||
35 | //BEGIN AppCommands | 36 | //BEGIN AppCommands | ||
36 | AppCommands *AppCommands::m_instance = nullptr; | 37 | AppCommands *AppCommands::m_instance = nullptr; | ||
37 | 38 | | |||
38 | AppCommands::AppCommands() | 39 | AppCommands::AppCommands() | ||
39 | : KTextEditor::Command({ QStringLiteral("q"), QStringLiteral("qa"), QStringLiteral("qall"), QStringLiteral("q!"), QStringLiteral("qa!"), QStringLiteral("qall!") | 40 | : KTextEditor::Command({ QStringLiteral("q"), QStringLiteral("qa"), QStringLiteral("qall"), QStringLiteral("q!"), QStringLiteral("qa!"), QStringLiteral("qall!") | ||
40 | , QStringLiteral("w"), QStringLiteral("wq"), QStringLiteral("wa"), QStringLiteral("wqa"), QStringLiteral("x"), QStringLiteral("xa"), QStringLiteral("new") | 41 | , QStringLiteral("w"), QStringLiteral("wq"), QStringLiteral("wa"), QStringLiteral("wqa"), QStringLiteral("x"), QStringLiteral("xa"), QStringLiteral("new") | ||
41 | , QStringLiteral("vnew"), QStringLiteral("e"), QStringLiteral("edit"), QStringLiteral("enew"), QStringLiteral("sp"), QStringLiteral("split"), QStringLiteral("vs") | 42 | , QStringLiteral("vnew"), QStringLiteral("e"), QStringLiteral("edit"), QStringLiteral("enew"), QStringLiteral("sp"), QStringLiteral("split"), QStringLiteral("vs") | ||
42 | , QStringLiteral("vsplit"), QStringLiteral("only"), QStringLiteral("tabe"), QStringLiteral("tabedit"), QStringLiteral("tabnew"), QStringLiteral("bd") | 43 | , QStringLiteral("vsplit"), QStringLiteral("only"), QStringLiteral("tabe"), QStringLiteral("tabedit"), QStringLiteral("tabnew"), QStringLiteral("bd") | ||
43 | , QStringLiteral("bdelete"), QStringLiteral("tabc"), QStringLiteral("tabclose"), QStringLiteral("clo"), QStringLiteral("close") }) | 44 | , QStringLiteral("bdelete"), QStringLiteral("tabc"), QStringLiteral("tabclose"), QStringLiteral("clo"), QStringLiteral("close") }) | ||
45 | , re_write(QStringLiteral("^w(a)?$")) | ||||
46 | , re_close(QStringLiteral("^bd(elete)?|tabc(lose)?$")) | ||||
47 | , re_quit(QStringLiteral("^(w)?q(a|all)?(!)?$")) | ||||
48 | , re_exit(QStringLiteral("^x(a)?$")) | ||||
49 | , re_edit(QStringLiteral("^e(dit)?|tabe(dit)?|tabnew$")) | ||||
50 | , re_tabedit(QStringLiteral("^tabe(dit)?|tabnew$")) | ||||
51 | , re_new(QStringLiteral("^(v)?new$")) | ||||
52 | , re_split(QStringLiteral("^sp(lit)?$")) | ||||
53 | , re_vsplit(QStringLiteral("^vs(plit)?$")) | ||||
54 | , re_vclose(QStringLiteral("^clo(se)?$")) | ||||
55 | , re_only(QStringLiteral("^on(ly)?$")) | ||||
44 | { | 56 | { | ||
45 | re_write.setPattern(QStringLiteral("w(a)?")); | | |||
46 | re_close.setPattern(QStringLiteral("bd(elete)?|tabc(lose)?")); | | |||
47 | re_quit.setPattern(QStringLiteral("(w)?q(a|all)?(!)?")); | | |||
48 | re_exit.setPattern(QStringLiteral("x(a)?")); | | |||
49 | re_edit.setPattern(QStringLiteral("e(dit)?|tabe(dit)?|tabnew")); | | |||
50 | re_tabedit.setPattern(QStringLiteral("tabe(dit)?|tabnew")); | | |||
51 | re_new.setPattern(QStringLiteral("(v)?new")); | | |||
52 | re_split.setPattern(QStringLiteral("sp(lit)?")); | | |||
53 | re_vsplit.setPattern(QStringLiteral("vs(plit)?")); | | |||
54 | re_vclose.setPattern(QStringLiteral("clo(se)?")); | | |||
55 | re_only.setPattern(QStringLiteral("on(ly)?")); | | |||
56 | } | 57 | } | ||
57 | 58 | | |||
58 | AppCommands::~AppCommands() | 59 | AppCommands::~AppCommands() | ||
59 | { | 60 | { | ||
60 | m_instance = nullptr; | 61 | m_instance = nullptr; | ||
61 | } | 62 | } | ||
62 | 63 | | |||
63 | bool AppCommands::exec(KTextEditor::View *view, const QString &cmd, QString &msg, const KTextEditor::Range &) | 64 | bool AppCommands::exec(KTextEditor::View *view, const QString &cmd, QString &msg, const KTextEditor::Range &) | ||
64 | { | 65 | { | ||
65 | QStringList args(cmd.split(QRegExp(QLatin1String("\\s+")), QString::SkipEmptyParts)) ; | 66 | QStringList args(cmd.split(QRegularExpression(QLatin1String("\\s+")), QString::SkipEmptyParts)) ; | ||
66 | QString command(args.takeFirst()); | 67 | QString command(args.takeFirst()); | ||
67 | 68 | | |||
68 | KTextEditor::MainWindow *mainWin = view->mainWindow(); | 69 | KTextEditor::MainWindow *mainWin = view->mainWindow(); | ||
69 | KTextEditor::Application *app = KTextEditor::Editor::instance()->application(); | 70 | KTextEditor::Application *app = KTextEditor::Editor::instance()->application(); | ||
70 | 71 | | |||
71 | if (re_write.exactMatch(command)) { //TODO: handle writing to specific file | 72 | QRegularExpressionMatch match; | ||
72 | if (!re_write.cap(1).isEmpty()) { // [a]ll | 73 | if ((match = re_write.match(command)).hasMatch()) { //TODO: handle writing to specific file | ||
74 | if (!match.captured(1).isEmpty()) { // [a]ll | ||||
73 | Q_FOREACH(KTextEditor::Document *doc, app->documents()) { | 75 | Q_FOREACH(KTextEditor::Document *doc, app->documents()) { | ||
74 | doc->save(); | 76 | doc->save(); | ||
75 | } | 77 | } | ||
76 | msg = i18n("All documents written to disk"); | 78 | msg = i18n("All documents written to disk"); | ||
77 | } else { | 79 | } else { | ||
78 | view->document()->documentSave(); | 80 | view->document()->documentSave(); | ||
79 | msg = i18n("Document written to disk"); | 81 | msg = i18n("Document written to disk"); | ||
80 | } | 82 | } | ||
81 | } | 83 | } | ||
82 | // Other buffer commands are implemented by the KateFileTree plugin | 84 | // Other buffer commands are implemented by the KateFileTree plugin | ||
83 | else if (re_close.exactMatch(command)) { | 85 | else if ((match = re_close.match(command)).hasMatch()) { | ||
84 | QTimer::singleShot(0, [app, view](){ app->closeDocument(view->document()); }); | 86 | QTimer::singleShot(0, [app, view](){ app->closeDocument(view->document()); }); | ||
85 | } else if (re_quit.exactMatch(command)) { | 87 | } else if ((match = re_quit.match(command)).hasMatch()) { | ||
86 | const bool save = !re_quit.cap(1).isEmpty(); // :[w]q | 88 | const bool save = !match.captured(1).isEmpty(); // :[w]q | ||
87 | const bool allDocuments = !re_quit.cap(2).isEmpty(); // :q[all] | 89 | const bool allDocuments = !match.captured(2).isEmpty(); // :q[all] | ||
88 | const bool doNotPromptForSave = !re_quit.cap(3).isEmpty(); // :q[!] | 90 | const bool doNotPromptForSave = !match.captured(3).isEmpty(); // :q[!] | ||
89 | 91 | | |||
90 | if (allDocuments) { | 92 | if (allDocuments) { | ||
91 | if (save) { | 93 | if (save) { | ||
92 | Q_FOREACH(KTextEditor::Document *doc, app->documents()) { | 94 | Q_FOREACH(KTextEditor::Document *doc, app->documents()) { | ||
93 | doc->save(); | 95 | doc->save(); | ||
94 | } | 96 | } | ||
95 | } | 97 | } | ||
96 | 98 | | |||
Show All 20 Lines | 108 | } else { | |||
117 | } else { | 119 | } else { | ||
118 | if (app->documents().size() > 1) { | 120 | if (app->documents().size() > 1) { | ||
119 | QTimer::singleShot(0, this, SLOT(closeCurrentDocument())); | 121 | QTimer::singleShot(0, this, SLOT(closeCurrentDocument())); | ||
120 | } else { | 122 | } else { | ||
121 | QTimer::singleShot(0, this, SLOT(quit())); | 123 | QTimer::singleShot(0, this, SLOT(quit())); | ||
122 | } | 124 | } | ||
123 | } | 125 | } | ||
124 | } | 126 | } | ||
125 | } else if (re_exit.exactMatch(command)) { | 127 | } else if ((match = re_exit.match(command)).hasMatch()) { | ||
126 | if (!re_exit.cap(1).isEmpty()) { // a[ll] | 128 | if (!match.captured(1).isEmpty()) { // a[ll] | ||
127 | Q_FOREACH(KTextEditor::Document *doc, app->documents()) { | 129 | Q_FOREACH(KTextEditor::Document *doc, app->documents()) { | ||
128 | doc->save(); | 130 | doc->save(); | ||
129 | } | 131 | } | ||
130 | QTimer::singleShot(0, this, SLOT(quit())); | 132 | QTimer::singleShot(0, this, SLOT(quit())); | ||
131 | } else { | 133 | } else { | ||
132 | if (view->document()->isModified()) { | 134 | if (view->document()->isModified()) { | ||
133 | view->document()->documentSave(); | 135 | view->document()->documentSave(); | ||
134 | } | 136 | } | ||
135 | 137 | | |||
136 | if (app->documents().size() > 1) { | 138 | if (app->documents().size() > 1) { | ||
137 | QTimer::singleShot(0, this, SLOT(closeCurrentDocument())); | 139 | QTimer::singleShot(0, this, SLOT(closeCurrentDocument())); | ||
138 | } else { | 140 | } else { | ||
139 | QTimer::singleShot(0, this, SLOT(quit())); | 141 | QTimer::singleShot(0, this, SLOT(quit())); | ||
140 | } | 142 | } | ||
141 | } | 143 | } | ||
142 | } else if (re_edit.exactMatch(command)) { | 144 | } else if ((match = re_edit.match(command)).hasMatch()) { | ||
143 | QString argument = args.join(QLatin1Char(' ')); | 145 | QString argument = args.join(QLatin1Char(' ')); | ||
144 | if (argument.isEmpty() || argument == QLatin1String("!")) { | 146 | if (argument.isEmpty() || argument == QLatin1String("!")) { | ||
145 | if (re_tabedit.exactMatch(command)) { | 147 | if ((match = re_tabedit.match(command)).hasMatch()) { | ||
146 | if (auto doc = app->openUrl(QUrl())) { | 148 | if (auto doc = app->openUrl(QUrl())) { | ||
147 | QTimer::singleShot(0, [mainWin, doc](){ mainWin->activateView(doc); }); | 149 | QTimer::singleShot(0, [mainWin, doc](){ mainWin->activateView(doc); }); | ||
148 | } | 150 | } | ||
149 | } else { | 151 | } else { | ||
150 | view->document()->documentReload(); | 152 | view->document()->documentReload(); | ||
151 | } | 153 | } | ||
152 | } else { | 154 | } else { | ||
153 | QUrl base = view->document()->url(); | 155 | QUrl base = view->document()->url(); | ||
Show All 18 Lines | 167 | if (!doc) { | |||
172 | } | 174 | } | ||
173 | } | 175 | } | ||
174 | if (doc) { | 176 | if (doc) { | ||
175 | QTimer::singleShot(0, [mainWin, doc](){ mainWin->activateView(doc); }); | 177 | QTimer::singleShot(0, [mainWin, doc](){ mainWin->activateView(doc); }); | ||
176 | } | 178 | } | ||
177 | } | 179 | } | ||
178 | // splitView() orientations are reversed from the usual editor convention. | 180 | // splitView() orientations are reversed from the usual editor convention. | ||
179 | // 'vsplit' and 'vnew' use Qt::Horizontal to match vi and the Kate UI actions. | 181 | // 'vsplit' and 'vnew' use Qt::Horizontal to match vi and the Kate UI actions. | ||
180 | } else if (re_new.exactMatch(command)) { | 182 | } else if ((match = re_new.match(command)).hasMatch()) { | ||
181 | if (re_new.cap(1) == QLatin1String("v")) { // vertical split | 183 | if (match.captured(1) == QLatin1String("v")) { // vertical split | ||
182 | mainWin->splitView(Qt::Horizontal); | 184 | mainWin->splitView(Qt::Horizontal); | ||
183 | } else { // horizontal split | 185 | } else { // horizontal split | ||
184 | mainWin->splitView(Qt::Vertical); | 186 | mainWin->splitView(Qt::Vertical); | ||
185 | } | 187 | } | ||
186 | mainWin->openUrl(QUrl()); | 188 | mainWin->openUrl(QUrl()); | ||
187 | } else if (command == QLatin1String("enew")) { | 189 | } else if (command == QLatin1String("enew")) { | ||
188 | mainWin->openUrl(QUrl()); | 190 | mainWin->openUrl(QUrl()); | ||
189 | } else if (re_split.exactMatch(command)) { | 191 | } else if ((match = re_split.match(command)).hasMatch()) { | ||
190 | mainWin->splitView(Qt::Vertical); // see above | 192 | mainWin->splitView(Qt::Vertical); // see above | ||
191 | } else if (re_vsplit.exactMatch(command)) { | 193 | } else if ((match = re_vsplit.match(command)).hasMatch()) { | ||
192 | mainWin->splitView(Qt::Horizontal); | 194 | mainWin->splitView(Qt::Horizontal); | ||
193 | } else if (re_vclose.exactMatch(command)) { | 195 | } else if ((match = re_vclose.match(command)).hasMatch()) { | ||
194 | QTimer::singleShot(0, this, SLOT(closeCurrentSplitView())); | 196 | QTimer::singleShot(0, this, SLOT(closeCurrentSplitView())); | ||
195 | } else if (re_only.exactMatch(command)) { | 197 | } else if ((match = re_only.match(command)).hasMatch()) { | ||
196 | QTimer::singleShot(0, this, SLOT(closeOtherSplitViews())); | 198 | QTimer::singleShot(0, this, SLOT(closeOtherSplitViews())); | ||
197 | } | 199 | } | ||
198 | 200 | | |||
199 | return true; | 201 | return true; | ||
200 | } | 202 | } | ||
201 | 203 | | |||
202 | bool AppCommands::help(KTextEditor::View *view, const QString &cmd, QString &msg) | 204 | bool AppCommands::help(KTextEditor::View *view, const QString &cmd, QString &msg) | ||
203 | { | 205 | { | ||
204 | Q_UNUSED(view); | 206 | Q_UNUSED(view); | ||
205 | 207 | | |||
206 | if (re_write.exactMatch(cmd)) { | 208 | if (re_write.match(cmd).hasMatch()) { | ||
207 | msg = i18n("<p><b>w/wa — write document(s) to disk</b></p>" | 209 | msg = i18n("<p><b>w/wa — write document(s) to disk</b></p>" | ||
208 | "<p>Usage: <tt><b>w[a]</b></tt></p>" | 210 | "<p>Usage: <tt><b>w[a]</b></tt></p>" | ||
209 | "<p>Writes the current document(s) to disk. " | 211 | "<p>Writes the current document(s) to disk. " | ||
210 | "It can be called in two ways:<br />" | 212 | "It can be called in two ways:<br />" | ||
211 | " <tt>w</tt> — writes the current document to disk<br />" | 213 | " <tt>w</tt> — writes the current document to disk<br />" | ||
212 | " <tt>wa</tt> — writes all documents to disk.</p>" | 214 | " <tt>wa</tt> — writes all documents to disk.</p>" | ||
213 | "<p>If no file name is associated with the document, " | 215 | "<p>If no file name is associated with the document, " | ||
214 | "a file dialog will be shown.</p>"); | 216 | "a file dialog will be shown.</p>"); | ||
215 | return true; | 217 | return true; | ||
216 | } else if (re_quit.exactMatch(cmd)) { | 218 | } else if (re_quit.match(cmd).hasMatch()) { | ||
217 | msg = i18n("<p><b>q/qa/wq/wqa — [write and] quit</b></p>" | 219 | msg = i18n("<p><b>q/qa/wq/wqa — [write and] quit</b></p>" | ||
218 | "<p>Usage: <tt><b>[w]q[a]</b></tt></p>" | 220 | "<p>Usage: <tt><b>[w]q[a]</b></tt></p>" | ||
219 | "<p>Quits the application. If <tt>w</tt> is prepended, it also writes" | 221 | "<p>Quits the application. If <tt>w</tt> is prepended, it also writes" | ||
220 | " the document(s) to disk. This command " | 222 | " the document(s) to disk. This command " | ||
221 | "can be called in several ways:<br />" | 223 | "can be called in several ways:<br />" | ||
222 | " <tt>q</tt> — closes the current view.<br />" | 224 | " <tt>q</tt> — closes the current view.<br />" | ||
223 | " <tt>qa</tt> — closes all views, effectively quitting the application.<br />" | 225 | " <tt>qa</tt> — closes all views, effectively quitting the application.<br />" | ||
224 | " <tt>wq</tt> — writes the current document to disk and closes its view.<br />" | 226 | " <tt>wq</tt> — writes the current document to disk and closes its view.<br />" | ||
225 | " <tt>wqa</tt> — writes all documents to disk and quits.</p>" | 227 | " <tt>wqa</tt> — writes all documents to disk and quits.</p>" | ||
226 | "<p>In all cases, if the view being closed is the last view, the application quits. " | 228 | "<p>In all cases, if the view being closed is the last view, the application quits. " | ||
227 | "If no file name is associated with the document and it should be written to disk, " | 229 | "If no file name is associated with the document and it should be written to disk, " | ||
228 | "a file dialog will be shown.</p>"); | 230 | "a file dialog will be shown.</p>"); | ||
229 | return true; | 231 | return true; | ||
230 | } else if (re_exit.exactMatch(cmd)) { | 232 | } else if (re_exit.match(cmd).hasMatch()) { | ||
231 | msg = i18n("<p><b>x/xa — write and quit</b></p>" | 233 | msg = i18n("<p><b>x/xa — write and quit</b></p>" | ||
232 | "<p>Usage: <tt><b>x[a]</b></tt></p>" | 234 | "<p>Usage: <tt><b>x[a]</b></tt></p>" | ||
233 | "<p>Saves document(s) and quits (e<b>x</b>its). This command " | 235 | "<p>Saves document(s) and quits (e<b>x</b>its). This command " | ||
234 | "can be called in two ways:<br />" | 236 | "can be called in two ways:<br />" | ||
235 | " <tt>x</tt> — closes the current view.<br />" | 237 | " <tt>x</tt> — closes the current view.<br />" | ||
236 | " <tt>xa</tt> — closes all views, effectively quitting the application.</p>" | 238 | " <tt>xa</tt> — closes all views, effectively quitting the application.</p>" | ||
237 | "<p>In all cases, if the view being closed is the last view, the application quits. " | 239 | "<p>In all cases, if the view being closed is the last view, the application quits. " | ||
238 | "If no file name is associated with the document and it should be written to disk, " | 240 | "If no file name is associated with the document and it should be written to disk, " | ||
239 | "a file dialog will be shown.</p>" | 241 | "a file dialog will be shown.</p>" | ||
240 | "<p>Unlike the 'w' commands, this command only writes the document if it is modified." | 242 | "<p>Unlike the 'w' commands, this command only writes the document if it is modified." | ||
241 | "</p>"); | 243 | "</p>"); | ||
242 | return true; | 244 | return true; | ||
243 | } else if (re_split.exactMatch(cmd)) { | 245 | } else if (re_split.match(cmd).hasMatch()) { | ||
244 | msg = i18n("<p><b>sp,split— Split horizontally the current view into two</b></p>" | 246 | msg = i18n("<p><b>sp,split— Split horizontally the current view into two</b></p>" | ||
245 | "<p>Usage: <tt><b>sp[lit]</b></tt></p>" | 247 | "<p>Usage: <tt><b>sp[lit]</b></tt></p>" | ||
246 | "<p>The result is two views on the same document.</p>"); | 248 | "<p>The result is two views on the same document.</p>"); | ||
247 | return true; | 249 | return true; | ||
248 | } else if (re_vsplit.exactMatch(cmd)) { | 250 | } else if (re_vsplit.match(cmd).hasMatch()) { | ||
249 | msg = i18n("<p><b>vs,vsplit— Split vertically the current view into two</b></p>" | 251 | msg = i18n("<p><b>vs,vsplit— Split vertically the current view into two</b></p>" | ||
250 | "<p>Usage: <tt><b>vs[plit]</b></tt></p>" | 252 | "<p>Usage: <tt><b>vs[plit]</b></tt></p>" | ||
251 | "<p>The result is two views on the same document.</p>"); | 253 | "<p>The result is two views on the same document.</p>"); | ||
252 | return true; | 254 | return true; | ||
253 | } else if (re_vclose.exactMatch(cmd)) { | 255 | } else if (re_vclose.match(cmd).hasMatch()) { | ||
254 | msg = i18n("<p><b>clo[se]— Close the current view</b></p>" | 256 | msg = i18n("<p><b>clo[se]— Close the current view</b></p>" | ||
255 | "<p>Usage: <tt><b>clo[se]</b></tt></p>" | 257 | "<p>Usage: <tt><b>clo[se]</b></tt></p>" | ||
256 | "<p>After executing it, the current view will be closed.</p>"); | 258 | "<p>After executing it, the current view will be closed.</p>"); | ||
257 | return true; | 259 | return true; | ||
258 | } else if (re_new.exactMatch(cmd)) { | 260 | } else if (re_new.match(cmd).hasMatch()) { | ||
259 | msg = i18n("<p><b>[v]new — split view and create new document</b></p>" | 261 | msg = i18n("<p><b>[v]new — split view and create new document</b></p>" | ||
260 | "<p>Usage: <tt><b>[v]new</b></tt></p>" | 262 | "<p>Usage: <tt><b>[v]new</b></tt></p>" | ||
261 | "<p>Splits the current view and opens a new document in the new view." | 263 | "<p>Splits the current view and opens a new document in the new view." | ||
262 | " This command can be called in two ways:<br />" | 264 | " This command can be called in two ways:<br />" | ||
263 | " <tt>new</tt> — splits the view horizontally and opens a new document.<br />" | 265 | " <tt>new</tt> — splits the view horizontally and opens a new document.<br />" | ||
264 | " <tt>vnew</tt> — splits the view vertically and opens a new document.<br />" | 266 | " <tt>vnew</tt> — splits the view vertically and opens a new document.<br />" | ||
265 | "</p>"); | 267 | "</p>"); | ||
266 | return true; | 268 | return true; | ||
267 | } else if (re_edit.exactMatch(cmd)) { | 269 | } else if (re_edit.match(cmd).hasMatch()) { | ||
268 | msg = i18n("<p><b>e[dit] — reload current document</b></p>" | 270 | msg = i18n("<p><b>e[dit] — reload current document</b></p>" | ||
269 | "<p>Usage: <tt><b>e[dit]</b></tt></p>" | 271 | "<p>Usage: <tt><b>e[dit]</b></tt></p>" | ||
270 | "<p>Starts <b>e</b>diting the current document again. This is useful to re-edit" | 272 | "<p>Starts <b>e</b>diting the current document again. This is useful to re-edit" | ||
271 | " the current file, when it has been changed by another program.</p>"); | 273 | " the current file, when it has been changed by another program.</p>"); | ||
272 | return true; | 274 | return true; | ||
273 | } | 275 | } | ||
274 | 276 | | |||
275 | return false; | 277 | return false; | ||
▲ Show 20 Lines • Show All 248 Lines • Show Last 20 Lines |