mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-15 20:46:37 +08:00
CursesDialog: resolve clang-tidy warnings
Fixes: - unnecessary bool expression (cmCursesMainForm) - removes a duplicate if/else branch (RegexExplorer) - collapses redundant if/else branch logic (CMakeSetupDialog and cmCursesStringWidget)
This commit is contained in:
@@ -853,11 +853,7 @@ void cmCursesMainForm::HandleInput()
|
|||||||
}
|
}
|
||||||
// switch advanced on/off
|
// switch advanced on/off
|
||||||
else if (key == 't') {
|
else if (key == 't') {
|
||||||
if (this->AdvancedMode) {
|
this->AdvancedMode = !this->AdvancedMode;
|
||||||
this->AdvancedMode = false;
|
|
||||||
} else {
|
|
||||||
this->AdvancedMode = true;
|
|
||||||
}
|
|
||||||
getmaxyx(stdscr, y, x);
|
getmaxyx(stdscr, y, x);
|
||||||
this->RePost();
|
this->RePost();
|
||||||
this->Render(1, 1, x, y);
|
this->Render(1, 1, x, y);
|
||||||
|
@@ -105,12 +105,10 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
|
|||||||
if (!this->InEdit && (key != 10 && key != KEY_ENTER && key != 'i')) {
|
if (!this->InEdit && (key != 10 && key != KEY_ENTER && key != 'i')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// enter edit with return and i (vim binding)
|
// toggle edit with return
|
||||||
if (!this->InEdit && (key == 10 || key == KEY_ENTER || key == 'i')) {
|
if ((key == 10 || key == KEY_ENTER)
|
||||||
this->OnReturn(fm, w);
|
// enter edit with i (and not-edit mode)
|
||||||
}
|
|| (!this->InEdit && key == 'i')) {
|
||||||
// leave edit with return (but not i -- not a toggle)
|
|
||||||
else if (this->InEdit && (key == 10 || key == KEY_ENTER)) {
|
|
||||||
this->OnReturn(fm, w);
|
this->OnReturn(fm, w);
|
||||||
} else if (key == KEY_DOWN || key == ctrl('n') || key == KEY_UP ||
|
} else if (key == KEY_DOWN || key == ctrl('n') || key == KEY_UP ||
|
||||||
key == ctrl('p') || key == KEY_NPAGE || key == ctrl('d') ||
|
key == ctrl('p') || key == KEY_NPAGE || key == ctrl('d') ||
|
||||||
|
@@ -1060,14 +1060,7 @@ void CMakeSetupDialog::enterState(CMakeSetupDialog::State s)
|
|||||||
this->GenerateAction->setEnabled(false);
|
this->GenerateAction->setEnabled(false);
|
||||||
this->OpenProjectButton->setEnabled(false);
|
this->OpenProjectButton->setEnabled(false);
|
||||||
this->GenerateButton->setText(tr("&Stop"));
|
this->GenerateButton->setText(tr("&Stop"));
|
||||||
} else if (s == ReadyConfigure) {
|
} else if (s == ReadyConfigure || s == ReadyGenerate) {
|
||||||
this->setEnabledState(true);
|
|
||||||
this->GenerateButton->setEnabled(true);
|
|
||||||
this->GenerateAction->setEnabled(true);
|
|
||||||
this->ConfigureButton->setEnabled(true);
|
|
||||||
this->ConfigureButton->setText(tr("&Configure"));
|
|
||||||
this->GenerateButton->setText(tr("&Generate"));
|
|
||||||
} else if (s == ReadyGenerate) {
|
|
||||||
this->setEnabledState(true);
|
this->setEnabledState(true);
|
||||||
this->GenerateButton->setEnabled(true);
|
this->GenerateButton->setEnabled(true);
|
||||||
this->GenerateAction->setEnabled(true);
|
this->GenerateAction->setEnabled(true);
|
||||||
|
@@ -147,9 +147,6 @@ bool RegexExplorer::stripEscapes(std::string& source)
|
|||||||
} else if (nextc == 'n') {
|
} else if (nextc == 'n') {
|
||||||
result.append(1, '\n');
|
result.append(1, '\n');
|
||||||
in++;
|
in++;
|
||||||
} else if (nextc == 't') {
|
|
||||||
result.append(1, '\t');
|
|
||||||
in++;
|
|
||||||
} else if (isalnum(nextc) || nextc == '\0') {
|
} else if (isalnum(nextc) || nextc == '\0') {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user