优化段注释

This commit is contained in:
sonichy 2025-08-02 15:55:07 +08:00
parent 522da385d1
commit fbe03a8e5e
2 changed files with 1 additions and 1 deletions

BIN
HTYEdit

Binary file not shown.

View File

@ -173,7 +173,7 @@ void MdiChild::keyPressEvent(QKeyEvent *e)
} }
} else if ((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_Asterisk) { // Ctrl+* 注释选中段 } else if ((e->modifiers() & Qt::ControlModifier) && e->key() == Qt::Key_Asterisk) { // Ctrl+* 注释选中段
QString s = textCursor().selection().toPlainText(); QString s = textCursor().selection().toPlainText();
if (s.startsWith(QString("/*").trimmed()) && s.endsWith(QString("*/").trimmed())) { if (s.trimmed().startsWith(QString("/*")) && s.trimmed().endsWith(QString("*/"))) {
s = s.replace("/*", "").replace("*/", ""); s = s.replace("/*", "").replace("*/", "");
} else { } else {
if (s.contains("\n")) if (s.contains("\n"))