better lexer name handling
This commit is contained in:
@@ -111,6 +111,11 @@ void MainWindow::setupActions()
|
||||
connect(lexerNoneAction, &QAction::triggered, this, [this](){
|
||||
if (SciEdit *editor = m_tabWidget->currentEditor()) {
|
||||
editor->setLexer(nullptr);
|
||||
const int docId = m_tabWidget->currentDocumentId();
|
||||
if (docId >= 0) {
|
||||
m_documentManager->setDocumentLanguage(docId, QString());
|
||||
}
|
||||
updateStatusBar();
|
||||
}
|
||||
});
|
||||
|
||||
@@ -219,6 +224,11 @@ void MainWindow::applyLexer(const QString &lexerName)
|
||||
if (SciEdit *editor = m_tabWidget->currentEditor()) {
|
||||
Scintilla::ILexer5 * lexer = CreateLexer(lexerName.toStdString().c_str());
|
||||
editor->setLexer(lexer);
|
||||
const int docId = m_tabWidget->currentDocumentId();
|
||||
if (docId >= 0) {
|
||||
m_documentManager->setDocumentLanguage(docId, lexerName);
|
||||
}
|
||||
updateStatusBar();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,7 +336,8 @@ void MainWindow::updateStatusBar()
|
||||
int docId = m_tabWidget->currentDocumentId();
|
||||
if (docId >= 0) {
|
||||
QString encoding = m_documentManager->getDocumentEncoding(docId);
|
||||
QString language = m_documentManager->getDocumentLanguage(docId);
|
||||
const QString lexerName = m_documentManager->getDocumentLanguage(docId);
|
||||
const QString language = lexerName.isEmpty() ? QStringLiteral("Plain Text") : LexerGroupActionMenu::displayName(lexerName);
|
||||
|
||||
m_encodingStatusLabel->setText(encoding);
|
||||
m_languageStatusLabel->setText(language);
|
||||
|
||||
Reference in New Issue
Block a user