Skip to content

Commit 08d2bae

Browse files
committed
Use Ctrl-V instead of Tab to paste in input boxes.
Closes #2830.
1 parent b827f9e commit 08d2bae

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

lib/widget/editbox.cpp

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -391,14 +391,6 @@ void W_EDITBOX::run(W_CONTEXT *psContext)
391391
debug(LOG_INPUT, "EditBox cursor backspace");
392392
break;
393393
case INPBUF_TAB :
394-
{
395-
QClipboard *clipboard = QApplication::clipboard();
396-
aText = clipboard->text(QClipboard::Selection); // try X11 specific buffer first
397-
if (aText.isEmpty()) aText = clipboard->text(QClipboard::Clipboard); // if not, try generic clipboard
398-
}
399-
insPos = aText.length();
400-
/* Update the printable text */
401-
fitStringEnd();
402394
debug(LOG_INPUT, "EditBox cursor tab");
403395
break;
404396
case INPBUF_CR :
@@ -414,6 +406,26 @@ void W_EDITBOX::run(W_CONTEXT *psContext)
414406
break;
415407

416408
default:
409+
if (keyDown(KEY_LCTRL) || keyDown(KEY_RCTRL))
410+
{
411+
switch (key)
412+
{
413+
case KEY_V:
414+
{
415+
QClipboard *clipboard = QApplication::clipboard();
416+
aText = clipboard->text(QClipboard::Selection); // try X11 specific buffer first
417+
if (aText.isEmpty()) aText = clipboard->text(QClipboard::Clipboard); // if not, try generic clipboard
418+
}
419+
insPos = aText.length();
420+
/* Update the printable text */
421+
fitStringEnd();
422+
debug(LOG_INPUT, "EditBox paste");
423+
break;
424+
default:
425+
break;
426+
}
427+
break;
428+
}
417429
/* Dealt with everything else this must be a printable character */
418430
if (editState == WEDBS_INSERT)
419431
{

0 commit comments

Comments
 (0)