highlighter init delay

This commit is contained in:
Zira project 2020-12-14 17:20:07 +05:00
parent f26acb8482
commit 5a1cdae07c
1 changed files with 4 additions and 8 deletions

View File

@ -18,9 +18,7 @@
#include "fileiconprovider.h"
#include "settings.h"
#if defined(Q_OS_ANDROID)
const int ANDROID_INIT_HIGHLIGHTER_DELAY = 100;
#endif
const int INIT_HIGHLIGHTER_DELAY = 100;
EditorTabs::EditorTabs(QTabWidget * widget):
tabWidget(widget)
@ -135,14 +133,12 @@ void EditorTabs::createTab(QString filepath, bool initHighlight)
emit tabOpened(tabIndex);
if (initHighlight) {
#if defined(Q_OS_ANDROID)
//editor->initHighlighter();
// let it scroll to requested line first
Editor * currentEditor = editor;
QTimer::singleShot(ANDROID_INIT_HIGHLIGHTER_DELAY, currentEditor, ([currentEditor](){
QTimer::singleShot(INIT_HIGHLIGHTER_DELAY, currentEditor, ([currentEditor](){
currentEditor->initHighlighter();
}));
#else
editor->initHighlighter();
#endif
}
}