浏览代码

BUG: Enable Ctrl-C shortcut in Python console in the history area

Andras Lasso 10 年之前
父节点
当前提交
33845638e9
共有 1 个文件被更改,包括 7 次插入1 次删除
  1. 7 1
      Libs/Widgets/ctkConsole.cpp

+ 7 - 1
Libs/Widgets/ctkConsole.cpp

@@ -296,7 +296,13 @@ void ctkConsolePrivate::keyPressEvent(QKeyEvent* e)
     }
 
   // Force the cursor back to the interactive area if anything else than copy/paste or page up/down is done
-  if(history_area)
+  // but only when a "real" key is pressed, not just a modifier (otherwise we could not press Control-c in the
+  // history area because the cursor would jump to the interactive area immediately when Control is pressed)
+  if(history_area
+       && e->key() != Qt::Key_Control
+       && e->key() != Qt::Key_Meta
+       && e->key() != Qt::Key_Alt
+       && e->key() != Qt::Key_Shift)
     {
     text_cursor.setPosition(this->documentEnd());
     this->setTextCursor(text_cursor);