Skip to content

Commit

Permalink
Fix 2609; while we're at it, make the contextual help work again (kvi…
Browse files Browse the repository at this point in the history
  • Loading branch information
ctrlaltca authored Feb 27, 2024
1 parent 9e90496 commit dcba7a1
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions src/modules/editor/ScriptEditorImplementation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ static bool bCompleterReady = false;
ScriptEditorWidget::ScriptEditorWidget(QWidget * pParent)
: QTextEdit(pParent)
{
m_pStartTimer = nullptr;
m_pSyntaxHighlighter = nullptr;
setTabStopDistance(48);
setAcceptRichText(false);
Expand Down Expand Up @@ -148,17 +149,17 @@ void ScriptEditorWidget::checkReadyCompleter()
{
if(bCompleterReady)
{
m_pStartTimer->stop();
delete m_pStartTimer;
m_pStartTimer = nullptr;
if(m_pStartTimer) {
m_pStartTimer->stop();
m_pStartTimer->deleteLater();
m_pStartTimer = nullptr;
}
loadCompleterFromFile();
}
}

void ScriptEditorWidget::asyncCompleterCreation()
{
//static int iIndex = 0;
//static int iModulesCount = 0;
if(!iIndex)
{
m_pListCompletition = new QStringList();
Expand All @@ -179,9 +180,6 @@ void ScriptEditorWidget::asyncCompleterCreation()
iModulesCount = m_pListModulesNames->count();
}

if (iIndex <= m_pListModulesNames->size())
return;

QString szModuleName = m_pListModulesNames->at(iIndex);
iIndex++;

Expand All @@ -204,9 +202,11 @@ void ScriptEditorWidget::asyncCompleterCreation()

if(iIndex == iModulesCount)
{
m_pStartTimer->stop();
m_pStartTimer->deleteLater();
m_pStartTimer = nullptr;
if(m_pStartTimer) {
m_pStartTimer->stop();
m_pStartTimer->deleteLater();
m_pStartTimer = nullptr;
}
QString szTmp("kvscompleter.idx");
QString szPath;
g_pApp->getLocalKvircDirectory(szPath, KviApplication::ConfigPlugins, szTmp);
Expand Down Expand Up @@ -457,8 +457,9 @@ bool ScriptEditorWidget::contextSensitiveHelp() const
QTextCursor cur = cursorForPosition(QPoint(r.x(), r.y()));
cur.select(QTextCursor::WordUnderCursor);
QString szText = cur.selectedText();
QString szTmp = szText;

KviQString::escapeKvs(&szText);
QString szParse = QString("timer -s (help,0){ help.open %1; }").arg(szText);
KviKvsScript::run(szParse,(KviWindow*)g_pApp->activeConsole());
return true;
}

Expand Down

0 comments on commit dcba7a1

Please sign in to comment.