[Bf-funboard] Copy/Paste/Cut hotkeys, problems, use in textfields/numfields, pasting 3d text

Luke Wenke bf-funboard@blender.org
Fri, 10 Oct 2003 15:10:04 +1000


Hi,
(Sorry if this has already been discussed...)

Currently to cut, copy and paste text within Blender, you use the obvious
hotkeys: ctrl-x, ctrl-c, and ctrl-v.

But to copy and paste text between Blender and the windows clipboard, the
hotkeys are ctrl-shift-C and alt-shift-C for copy (2 different hotkeys) and
ctrl-shift-v for paste.

Besides being hard to remember, I think it is totally unnecessary to have
other hotkeys to copy from and paste to the windows clipboard....

Here's some pseudo-code for how I think the old hotkeys could be reused....

(while in the text editing mode in Blender)
switch (hotkey):
{
  case (ctrl-c):
    CopySelectedText();
    break;

  case (ctrl-x):
    CopySelectedText();
    DeleteSelectedText();
    break;

  case (ctrl-x):
    PasteText();
    break;

  case (ctrl-shift-c) <---- get rid if this
  case (alt-shift-c) <---- get rid if this
  case (ctrl-shift-v) <---- get rid if this
}

Of course, the actual code might be completely different to that, but you
get the general idea.

Now for the functions involved...  DeleteSelectedText() is pretty
self-explanatory.

CopySelectedText() {
  Copy text to Blender text memory.
  Copy text to Windows (or Mac/Linux/etc) clipboard.
}

PasteText() {
  if (Windows/Mac/Linux/etc clipboard has text) {
    paste Windows/Mac/Linux/etc clipboard text at cursor (caret?) position
  } else if (Blender text memory has text) {
    paste Blender text memory text at cursor (caret?) position.
  } else {
    do nothing
  }
}

BTW, as far as Windows is concerned, there are some technical problems
copying and pasting between windows programs and Blender. I hope those
problems can be eliminated.

The first one is that when you copy text from Blender and paste it into
Windows notepad (even the Windows XP version), there are squares instead of
newlines. So when copying to the Windows clipboard, blender could go through
the characters one at a time and replace the problematic newline characters
with the ones that Windows notepad likes. (Many other Windows programs, such
as Wordpad I think, can support either type of newline character, but I use
notepad since it loads up faster. I know I could use another small program,
but for the sake of convenience, it would be good if it worked with
notepad).
The other windows clipboard problem involves copying text from certain
webpages.
e.g.
http://www.elysiun.com/forum/viewtopic.php?t=14341
(BTW note I am using IE6 and WinXP) To see the problem, copy the first bit
of code from the webpage, then paste it into blender using ctrl-shift-v.
Then use alt-p to run the script. It will say "invalid syntax". Then delete
the parts where the newline characters would be and add new newline
characters (by pressing enter) Note that you need to have it laid out like
this:
for i in range(3):
  for j in range(4):
    print j
You can't have it like this:
for i in range(3):
for j in range(4):
 print j
Then it will work. So it is the newline characters from certain webpages
that caused the problem.
The solution would be to make sure when reading from the windows clipboard,
that any problematic characters (that cause python errors) to be removed.
================================================
A related suggestion:
You could copy/cut/paste text from and into textfields and number fields
using the standard hotkeys (ctrl-c, etc). That is if you have repetitively
named objects, etc, that you could name by typing "ctrl-c" "1" or "2", etc.
(to have the name plus a 1 or 2)
================================================
Pasting 3d text.
I think a recent version of Blender let you paste text from the Blender text
memory into the 3D window, as 3D text. I think the old hotkey should be
gotten rid of (I think it wasn't very logical) and replaced with ctrl-V,
since I think ctrl-V isn't used in the object selection mode. (It currently
toggles between vertexpaint mode, but that is because it is just taking the
"V" into account, and ignoring the "ctrl") Maybe ctrl-c and ctrl-x could be
used when in edit mode for 3d text. (Though in object mode ctrl-c and ctrl-x
are already used...)

- Luke.