Commit a9f32a28 authored by Waqar Ahmed's avatar Waqar Ahmed Committed by Christoph Cullmann
Browse files

Save position when using quick-open


Signed-off-by: Waqar Ahmed's avatarWaqar Ahmed <waqar.17a@gmail.com>
parent 53a21fb0
......@@ -341,12 +341,29 @@ void KateQuickOpen::update(KateMainWindow *mainWindow)
void KateQuickOpen::slotReturnPressed()
{
const auto index = m_listView->model()->index(m_listView->currentIndex().row(), 0);
auto url = index.data(Qt::UserRole).toUrl();
m_mainWindow->wrapper()->openUrl(url);
const QModelIndex index = m_listView->model()->index(m_listView->currentIndex().row(), 0);
const QUrl url = index.data(Qt::UserRole).toUrl();
if (!url.isValid()) {
return;
}
// save current position before opening new url for location history
KateViewManager *vm = m_mainWindow->viewManager();
if (vm) {
if (KTextEditor::View *v = vm->activeView()) {
vm->savePosition(v->document()->url(), v->cursorPosition());
}
}
KTextEditor::View *v = m_mainWindow->wrapper()->openUrl(url);
hide();
m_mainWindow->slotWindowActivated();
if (v) {
vm->savePosition(v->document()->url(), v->cursorPosition());
}
// block signals for input line so that we dont trigger filtering again
const QSignalBlocker blocker(m_inputLine);
m_inputLine->clear();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment