Changeset View
Changeset View
Standalone View
Standalone View
src/vimode/appcommands.cpp
Show First 20 Lines • Show All 390 Lines • ▼ Show 20 Line(s) | 381 | { | |||
---|---|---|---|---|---|
391 | 391 | | |||
392 | if (idx > 0 && idx <= docs.size()) { | 392 | if (idx > 0 && idx <= docs.size()) { | ||
393 | // numerical argument: switch to the nth document | 393 | // numerical argument: switch to the nth document | ||
394 | activateDocument(view, docs.at(idx - 1)); | 394 | activateDocument(view, docs.at(idx - 1)); | ||
395 | } else { | 395 | } else { | ||
396 | // string argument: switch to the given file | 396 | // string argument: switch to the given file | ||
397 | KTextEditor::Document *doc = nullptr; | 397 | KTextEditor::Document *doc = nullptr; | ||
398 | 398 | | |||
399 | Q_FOREACH(KTextEditor::Document *it, docs) { | 399 | for (KTextEditor::Document *it : docs) { | ||
400 | if (it->documentName() == address) { | 400 | if (it->documentName() == address) { | ||
401 | doc = it; | 401 | doc = it; | ||
402 | break; | 402 | break; | ||
403 | } | 403 | } | ||
404 | } | 404 | } | ||
405 | 405 | | |||
406 | if (doc) { | 406 | if (doc) { | ||
407 | activateDocument(view, doc); | 407 | activateDocument(view, doc); | ||
408 | } | 408 | } | ||
409 | } | 409 | } | ||
410 | } | 410 | } | ||
411 | 411 | | |||
412 | void BufferCommands::prevBuffer(KTextEditor::View *view) | 412 | void BufferCommands::prevBuffer(KTextEditor::View *view) | ||
413 | { | 413 | { | ||
414 | QList<KTextEditor::Document *> docs = documents(); | 414 | const QList<KTextEditor::Document *> docs = documents(); | ||
415 | const int idx = docs.indexOf(view->document()); | 415 | const int idx = docs.indexOf(view->document()); | ||
416 | 416 | | |||
417 | if (idx > 0) { | 417 | if (idx > 0) { | ||
418 | activateDocument(view, docs.at(idx - 1)); | 418 | activateDocument(view, docs.at(idx - 1)); | ||
419 | } else if (!docs.isEmpty()) { // wrap | 419 | } else if (!docs.isEmpty()) { // wrap | ||
420 | activateDocument(view, docs.last()); | 420 | activateDocument(view, docs.last()); | ||
421 | } | 421 | } | ||
422 | } | 422 | } | ||
▲ Show 20 Lines • Show All 103 Lines • Show Last 20 Lines |