mirror of
https://github.com/rizinorg/cutter.git
synced 2025-01-19 02:48:49 +00:00
Remove isForbidden()
This commit is contained in:
parent
2105b1fba2
commit
bd600ee737
@ -60,33 +60,11 @@ static const QStringList radareArgs( {
|
||||
"#!pipe"
|
||||
});
|
||||
|
||||
static const QStringList forbiddenArgs({"e", "et", "e-", "e*", "e!", "e?", "env"});
|
||||
|
||||
|
||||
static const int invalidHistoryPos = -1;
|
||||
|
||||
|
||||
|
||||
static bool isForbidden(const QString &input)
|
||||
{
|
||||
static const QRegExp delimiters("[;&]");
|
||||
|
||||
|
||||
const QStringList &commands = input.split(delimiters, QString::SkipEmptyParts);
|
||||
|
||||
for (const QString &command : commands) {
|
||||
const QString &trimmedCommand = command.trimmed();
|
||||
|
||||
if (forbiddenArgs.contains(trimmedCommand)) return true;
|
||||
|
||||
for (const QString &arg : forbiddenArgs) {
|
||||
if (trimmedCommand.startsWith(arg + " ")) return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
ConsoleWidget::ConsoleWidget(MainWindow *main, QAction *action) :
|
||||
CutterDockWidget(main, action),
|
||||
ui(new Ui::ConsoleWidget),
|
||||
@ -218,15 +196,11 @@ void ConsoleWidget::executeCommand(const QString &command)
|
||||
void ConsoleWidget::on_inputLineEdit_returnPressed()
|
||||
{
|
||||
QString input = ui->inputLineEdit->text();
|
||||
if (!input.isEmpty()) {
|
||||
if (!isForbidden(input)) {
|
||||
executeCommand(input);
|
||||
} else {
|
||||
addDebugOutput(tr("command forbidden: ") + input);
|
||||
}
|
||||
|
||||
ui->inputLineEdit->clear();
|
||||
if (input.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
executeCommand(input);
|
||||
ui->inputLineEdit->clear();
|
||||
}
|
||||
|
||||
void ConsoleWidget::on_execButton_clicked()
|
||||
|
Loading…
Reference in New Issue
Block a user