Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keyword autocompletion #2975

Merged
merged 20 commits into from Aug 2, 2019
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Ctrl+Insert shows templates

  • Loading branch information...
RomitKumar committed Jun 24, 2019
commit 10bfc3f8278278b6efd67870c9f55c9ee629ba63
@@ -51,6 +51,7 @@ public slots:
virtual void copy() = 0;
virtual void paste() = 0;
virtual void initFont(const QString&, uint) = 0;
virtual void displayTemplates() = 0;

private:
QSize initialSizeHint;
@@ -308,3 +308,7 @@ QStringList LegacyEditor::colorSchemes()

return colorSchemes;
}

void LegacyEditor::displayTemplates()
{
}
@@ -41,6 +41,7 @@ public slots:
void copy() override;
void paste() override;
void initFont(const QString&, uint) override;
void displayTemplates() override;
private:
class QTextEdit *textedit;
class Highlighter *highlighter;
@@ -97,6 +97,7 @@
#include <QSettings> //Include QSettings for direct operations on settings arrays
#include "QSettingsCached.h"
#include <QSound>
#include <QShortcut>

#if (QT_VERSION < QT_VERSION_CHECK(5, 0, 0))
#include <QTextDocument>
@@ -631,6 +632,10 @@ MainWindow::MainWindow(const QString &filename)
clearCurrentOutput();

this->console->setMaximumBlockCount(5000);

QShortcut *viewTemplates = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Insert), this);
viewTemplates->setAutoRepeat(false);
connect(viewTemplates, SIGNAL(activated()), editor, SLOT(displayTemplates()));
}

void MainWindow::initActionIcon(QAction *action, const char *darkResource, const char *lightResource)
@@ -139,6 +139,9 @@ ScintillaEditor::ScintillaEditor(QWidget *parent) : EditorInterface(parent)
c = qsci->standardCommands()->find(QsciCommand::Redo);
c->setKey(Qt::Key_Z | Qt::CTRL | Qt::SHIFT);
c->setAlternateKey(Qt::Key_Y | Qt::CTRL);
// Ctrl-Ins displays templates
c = qsci->standardCommands()->boundTo(Qt::Key_Insert | Qt::CTRL);
c->setAlternateKey(0);

scintillaLayout->setContentsMargins(0, 0, 0, 0);
scintillaLayout->addWidget(qsci);
@@ -183,6 +186,11 @@ void ScintillaEditor::addTemplate(const QString key, const QString text, const i
userList.append(key);
}

void ScintillaEditor::displayTemplates()
{
qsci->showUserList(1, userList);
}

/**
* Apply the settings that are changeable in the preferences. This is also
* called in the event handler from the preferences.
@@ -100,6 +100,7 @@ public slots:
void copy() override;
void paste() override;
void initFont(const QString&, uint) override;
void displayTemplates() override;

private slots:
void onTextChanged();
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.