Skip to content

Commit

Permalink
Update commandpalette.cpp
Browse files Browse the repository at this point in the history
Only support append if src and dst is a command.
  • Loading branch information
rodlie committed Jul 30, 2024
1 parent c7d0f29 commit 4b5af7f
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/ui/dialogs/commandpalette.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,11 +356,13 @@ void CommandPalette::updateToolTip(const QString &input)

void CommandPalette::getHistory(const bool append)
{
if (append && !isCmd(mUserInput->text())) { return; }
const auto history = eSettings::instance().fCommandHistory;
if (history.count() < 1) { return; }
if (mHistoryCounter < 0 ||
mHistoryCounter >= history.count()) { mHistoryCounter = history.count() - 1; }
const QString cmd = history.at(mHistoryCounter);
if (append && !isCmd(cmd)) { return; }
mUserInput->setText(append ? QString("%1 && %2").arg(mUserInput->text(), cmd) : cmd);
mUserInput->setCursorPosition(mUserInput->text().length());
mHistoryCounter--;
Expand Down

0 comments on commit 4b5af7f

Please sign in to comment.