Commit 1a55b57e authored by Marcell Fülöp's avatar Marcell Fülöp
Browse files

When a session is opened withe a remote file being the active document, wait...

When a session is opened withe a remote file being the active document, wait with readSessionConfig() until the remote's local is initialised. Otherwise, saved session settings (cursor position, word wrap, folding state) are attempted to be applied on an empty document.
parent a574db41
......@@ -611,7 +611,17 @@ void KateViewSpace::restoreConfig(KateViewManager *viewMan, const KConfigBase *c
auto view = viewMan->createView(doc, this);
if (view) {
view->readSessionConfig(configGroup);
// When a session is opened with a remote file being active, we need to wait
// with applying saved session settings until the remote's temp file is initialised.
if (!view->document()->url().isLocalFile()) {
auto *connCtx = new QObject(this); // use a dummy object as signal receiver
connect(doc, &KTextEditor::Document::textChanged, connCtx, [connCtx, view, configGroup](KTextEditor::Document *doc){
connCtx->deleteLater(); // destroying context also destroys connection
view->readSessionConfig(configGroup);
});
} else {
view->readSessionConfig(configGroup);
}
m_tabBar->setCurrentDocument(doc);
}
}
......
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