Bug 162 : Alternative cut/copy/paste commands do not work. Control-Insert, Shift-Insert, Shift-Delete
Last modified: 2010-06-05 09:59




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P5
Severity:
enhancement

 

Reporter:
22samurai
Assigned To:
fry

Attachment Type Created Size Actions
Patch for Windows shortcuts for cut, copy, paste patch 2010-02-15 13:12 1.50 KB

Description:   Opened: 2005-09-27 12:03
The older, alternative cut/copy/paste keyboard shortcuts do not work.

Please re-instate the functionality of these keys.
Ctrl-Ins ->Copy
Shift-Ins-> Paste
Shift-Del->Cut

Most text entry fields accept these key combinations as valid editing
commands. I use these keys habitually. I have deleted code more than once
in the pde because I pressed Shift-Delete to cut it and Processing
interprets the keypress just as "Delete," erasing my selection. "Modern"
cut/copy/paste work fine, and I use them, but I usually have to back up a
few steps with Undo because I forget that the alternatives don't work.
Additional Comment #1 From fry 2005-09-27 17:12
wow, i've never even heard of these (and have been using computers for > 20
yrs). are these dos leftovers? (or even x/unix?)

probably not too difficult to add, but we need to know which platforms need
it (i can't imagine that the mac ever supported this, for instance). just
needs a key mapping added in the processing.app.syntax classes.
Additional Comment #2 From 22samurai 2005-09-27 18:02
> wow, i've never even heard of these (and have been using computers
for > 20
> yrs). are these dos leftovers? (or even x/unix?)

I know they are related to DOS, because Borland Pascal, qBasic, and Edit
supported these keypresses. I remember using a really old version of Word
in DOS as well and these worked there, too. I suppose it was easier to
keep the keypresses so that workers wouldn't have to be retrained.

> probably not too difficult to add, but we need to know which platforms need
> it (i can't imagine that the mac ever supported this, for instance). just
> needs a key mapping added in the processing.app.syntax classes.

Don't know about this part, but I will look into macs / unix. Actually, I
know that it at least works in Firefox for Red Hat , because the last
message I wrote was from there... When I find more info, I'll post it.
Additional Comment #3 From 22samurai 2005-10-08 12:25
Update:

This most likely originated from DOS, but has migrated to UNIX/Linux as
well. Many people wanted a more "intuitive" way to cut/paste in emacs, as
well as other programs. This convention is also standard in several GUI's
as well. While it may not be present on 100% of Linux/Unix
programs/distros, the support is frequent enough to warrant these
keystrokes' inclusion into the config file.

Some links for your perusal:

- http://www.emacswiki.org/cgi-bin/wiki/CopyAndPaste - Alternatives to "yank"
- http://lists.freedesktop.org/archives/xdg/2003-August/002168.html -
Copy/paste issues, configuring Shift-Ins in Xterm
-
http://sourceforge.net/mailarchive/forum.php?thread_id=467428&forum_id=1180
- Shift-ins/del in pycrust
...many more, just google "linux control-insert" or somethign similar.

I tried these keystrokes on Mac OS X in several applications, and
naturally, nothing happened. A real Mac user should verify this, but
waiting to verify fucntionality for the Mac should not slow down
implementing this feature into the Windows and Linux/Unix versions of
Processing.

Verdict: supported on Windows, majority-supported on UNIX/Linux, no
support on Mac.
Additional Comment #4 From 22samurai 2005-10-22 22:34
I would be willing to do this myself if you could could point me in the
right direction. You said the processing.app.syntax classes need to be
modified. It appears that this would require two or three lines to
add/change. I'm obviously not as familiar as you are with the intricacies
of the code. From what I can gather, new definitions would have to be made
for the DefaultInputHandler class. But there is no definiton for cut,
copy or paste. However, methods for cutm copy, or paste are found in the
JEditTextArea. But how does one associate the former with the latter?
Could you explain this to me?
Additional Comment #5 From fry 2005-10-26 08:54
not sure offhand, i've not tried re-binding cut/copy/paste. my guess is
that there is probably a constant for it as well, just like the others
(even though it's not used by default), but i don't know offhand what it
would be.
Additional Comment #6 From qistoph 2010-02-15 13:12
edit]
Patch for Windows shortcuts for cut, copy, paste
Additional Comment #7 From qistoph 2010-02-15 13:12
I have posted a patch for Arduino, a Processing spin of, for this issue.

Someone suggested I post the solution here, because Arduino is still
updated based on Processing for the Processing related bugs.

The Arduino issue:
http://code.google.com/p/arduino/issues/detail?id=22

And the patch is attached, it's based on Arduino, but should work for
Processing too.
Additional Comment #8 From fry 2010-02-16 16:22
now implemented in svn, available with whatever release comes after 1.0.9.
Additional Comment #9 From qistoph 2010-04-06 12:13
After looking at some more Arduino code today I've found out my solution can be
improved in elegance.

The earlier attached solution isn't really in line with the current keyboard shortcuts.

A better solution would be the following.
Add in InputHandler

public static final ActionListener CLIPBOARD_CUT = new clipboard_cut();
public static final ActionListener CLIPBOARD_COPY = new clipboard_copy();
public static final ActionListener CLIPBOARD_PASTE = new clipboard_paste();

And in the static constructor
actions.put("clipboard-cut",CLIPBOARD_CUT);
actions.put("clipboard-copy",CLIPBOARD_COPY);
actions.put("clipboard-paste",CLIPBOARD_PASTE);

And at the end of the class:


public static class clipboard_cut implements ActionListener
{
public void actionPerformed(ActionEvent evt) {
JEditTextArea textArea = getTextArea(evt);
textArea.cut();
}
}

public static class clipboard_copy implements ActionListener
{
public void actionPerformed(ActionEvent evt) {
JEditTextArea textArea = getTextArea(evt);
textArea.copy();
}
}

public static class clipboard_paste implements ActionListener
{
public void actionPerformed(ActionEvent evt) {
JEditTextArea textArea = getTextArea(evt);
textArea.paste();
}
}

In PdeTextAreaDefaults, in the constructor. (I chose to add it in the else of
if(Base.isMacOS()))

inputHandler.addKeyBinding("S+INSERT",InputHandler.CLIPBOARD_PASTE);
inputHandler.addKeyBinding("C+INSERT",InputHandler.CLIPBOARD_COPY);
inputHandler.addKeyBinding("S+DELETE",InputHandler.CLIPBOARD_CUT);


Again, I'm not sure how much of Arduino is equal to Processing, but if there's
anything unclear, I'd be happy to help out.
Additional Comment #10 From fry 2010-04-06 12:16
it's simpler than that, because of how shortcuts are handled; but it's
already implemented in the recent releases, so no need to worry about it.
Additional Comment #11 From fry 2010-06-05 09:59
*** Bug 1340 has been marked as a duplicate of this bug. ***