diff --git a/QCodeEditor/src/internal/QCodeEditor.cpp b/QCodeEditor/src/internal/QCodeEditor.cpp
index 332e32bfd..f529938cf 100644
--- a/QCodeEditor/src/internal/QCodeEditor.cpp
+++ b/QCodeEditor/src/internal/QCodeEditor.cpp
@@ -616,6 +616,23 @@ void QCodeEditor::keyPressEvent(QKeyEvent* e) {
return;
}
+ // Duplicate line
+ if (e->key() == Qt::Key_D &&
+ (e->modifiers() & Qt::ControlModifier) &&
+ (e->modifiers() & Qt::ShiftModifier)) {
+ auto tc = textCursor();
+ auto linepos = tc.positionInBlock();
+ tc.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
+ tc.movePosition(QTextCursor::NextBlock, QTextCursor::KeepAnchor);
+ auto line = tc.selectedText();
+ tc.movePosition(QTextCursor::StartOfBlock, QTextCursor::MoveAnchor);
+ tc.insertText(line);
+ tc.movePosition(QTextCursor::PreviousBlock, QTextCursor::MoveAnchor);
+ tc.movePosition(QTextCursor::Right, QTextCursor::MoveAnchor, linepos);
+ setTextCursor(tc);
+ return;
+ }
+
bool doSave = false;
if (e->modifiers() == Qt::ControlModifier) {
diff --git a/pages/pagelisp.cpp b/pages/pagelisp.cpp
index 1c719bd16..de1e93802 100644
--- a/pages/pagelisp.cpp
+++ b/pages/pagelisp.cpp
@@ -703,19 +703,20 @@ void PageLisp::on_helpButton_clicked()
"in the lisp-scripting chat at
"
"https://discord.gg/JgvV5NwYts
"
"Keyboard Commands
"
- "Ctrl + '+' : Increase font size
"
- "Ctrl + '-' : Decrease font size
"
- "Ctrl + space : Show auto-complete suggestions
"
- "Ctrl + '/' : Toggle auto-comment on line or block
"
- "Ctrl + '#' : Toggle auto-comment on line or block
"
- "Ctrl + 'i' : Auto-indent selected lines
"
- "Ctrl + 'f' : Open search (and replace) bar
"
- "Ctrl + 'e' : Upload (and run if set) application
"
- "Ctrl + 'w' : Stream application
"
- "Ctrl + 'q' : Stop application
"
- "Ctrl + 'd' : Clear console
"
- "Ctrl + 's' : Save file
"
- "Ctrl + 'r' : Run selected block in REPL
";
+ "Ctrl + '+' : Increase font size
"
+ "Ctrl + '-' : Decrease font size
"
+ "Ctrl + space : Show auto-complete suggestions
"
+ "Ctrl + '/' : Toggle auto-comment on line or block
"
+ "Ctrl + '#' : Toggle auto-comment on line or block
"
+ "Ctrl + 'i' : Auto-indent selected lines
"
+ "Ctrl + 'f' : Open search (and replace) bar
"
+ "Ctrl + 'e' : Upload (and run if set) application
"
+ "Ctrl + 'w' : Stream application
"
+ "Ctrl + 'q' : Stop application
"
+ "Ctrl + 'd' : Clear console
"
+ "Ctrl + 's' : Save file
"
+ "Ctrl + 'r' : Run selected block in REPL
"
+ "Ctrl + Shift + 'd' : Duplicate current line
";
HelpDialog::showHelpMonospace(this, "VESC Tool Script Editor", html);
}
diff --git a/pages/pagescripting.cpp b/pages/pagescripting.cpp
index 60537fc3d..3f60ad253 100755
--- a/pages/pagescripting.cpp
+++ b/pages/pagescripting.cpp
@@ -712,20 +712,21 @@ bool PageScripting::eraseQml(int size, bool reload)
void PageScripting::on_helpButton_clicked()
{
QString html = "Keyboard Commands
"
- "Ctrl + '+' : Increase font size
"
- "Ctrl + '-' : Decrease font size
"
- "Ctrl + space : Show auto-complete suggestions
"
- "Ctrl + '/' : Toggle auto-comment on line or block
"
- "Ctrl + '#' : Toggle auto-comment on line or block
"
- "Ctrl + 'i' : Auto-indent selected line or block
"
- "Ctrl + 'f' : Open search (and replace) bar
"
- "Ctrl + 'e' : Run or restart embedded
"
- "Ctrl + 'w' : Run or restart window
"
- "Ctrl + 'q' : Stop code
"
- "Ctrl + 'd' : Clear console
"
- "Ctrl + 's' : Save file
";
-
- HelpDialog::showHelpMonospace(this, "VESC Tool Script Editor", html.replace(" "," "));
+ "Ctrl + '+' : Increase font size
"
+ "Ctrl + '-' : Decrease font size
"
+ "Ctrl + space : Show auto-complete suggestions
"
+ "Ctrl + '/' : Toggle auto-comment on line or block
"
+ "Ctrl + '#' : Toggle auto-comment on line or block
"
+ "Ctrl + 'i' : Auto-indent selected line or block
"
+ "Ctrl + 'f' : Open search (and replace) bar
"
+ "Ctrl + 'e' : Run or restart embedded
"
+ "Ctrl + 'w' : Run or restart window
"
+ "Ctrl + 'q' : Stop code
"
+ "Ctrl + 'd' : Clear console
"
+ "Ctrl + 's' : Save file
"
+ "Ctrl + Shift + 'd' : Duplicate current line
";
+
+ HelpDialog::showHelpMonospace(this, "VESC Tool Script Editor", html);
}
void PageScripting::on_exportCArrayHwButton_clicked()
diff --git a/res/CHANGELOG.md b/res/CHANGELOG.md
index 540dc71ae..991dfac26 100644
--- a/res/CHANGELOG.md
+++ b/res/CHANGELOG.md
@@ -2,6 +2,8 @@
#### Released TBD
* Auto-save UI-state on regular intervals.
* Movable lisp-tabs and better tab behavior in general.
+* Detect file system changes in script editor.
+* Duplicate line shortcut in script editor.
### 6.05
#### Released 2024-08-19