Hello, I have a quick simple question. On Mac, in most applications, when you hold the option key + the left or right arrow, you can quickly skip words in a block of text, and command + left or right arrow jumps to the start or end of the text. Holding shift along with these shortcuts highlights the text so you can quickly delete/copy/cut/paste blocks of text. (I'm sure there's an equivalent on Windows). For some reason in Pd none of this works so I have to tap through one charatcer at a time with the left/right arrows, or use the mouse to position the cursor exactly where I need, or to highlight a block of text, which is all much slower than the keyboard commands I'm used to. Is this something with my particular installation or is it like this for everyone? Has anyone got these keyboard commands working in Pd?
-
Navigating text in Pd
-
@soundproofskin Pd's built in text editor seems a low priority and just a convienence that is not meant to replace a proper editor. I have an abstraction which you use in place of [text define] and instead of opening the internal editor it opens the text in an external editor and reloads the text anytime it is saved, I will upload it later this week after I get some computer stuff sorted out.
-
I haven't actually used the text editor (I'm pretty new to Pd), so I was referring to things like message boxes, comments, objects, etc. If you duplicate a message box for example, then want to hop around in the text within it and highlight a chunk of text to replace, the usual keyboard shortcuts don't work. It doesn't sound like a big deal, but I'm so used to using those shortcuts in other programs, when doing a bit of programming, etc, that I find it trips me up constantly. I just had a quick look at the text editor in Pure Data and that seems fine, the shortcuts work as I would expect, it's just the objects and stuff on the actual canvas where it isn't working.
-
@soundproofskin Pd specific shortcut key bindings are in pd_bindings.tcl in the Pd/tcl folder.
You can change them (carefully) to have what you need, or better still write a pd-plugin file.
I don't know (as yet) how to do that correctly.OS standard bindings seem to be in tk.tcl in the same folder and are set according to the the window system detected.
I am running windows on a Mac so a Mac keyboard. Key identifiers seem to be wrong for some modifying keys.
For me Fn+left and Fn+right jump to the beginning and end of the selected text. But I find no mention of Fn as a modifier anywhere in the .tcl files..... so...?
And the up and down arrows do the same.... jump to the beginning and end.Sorry... not much help..
David. -
@soundproofskin That makes sense since pd's text editor is the Tk text widget and it has those features, have not used the editor since I made my abstraction to get around other issues with the text editor.
I am not sure if we can add this in with a plugin, the binding is not an issue but we also need to retrieve the text of the object currently being edited so we can find that next space to navigate too when shift-right is pressed, and I have not found a way to do that, only the last object clicked on, which means this would not play well with autopatching. If we can get the current object these features would be simple to implement, maybe @seb-harmonik.ar knows of a variable holding the value of the current object being edited or an array holding the text currently being edited? I have a vague memory of once finding such an array, but it is not in my notes and the one time I tried to find it again I came up empty.
You could easily bind it to move the insertion cursor a fixed number of characters, shift-right moves the cursor 4 or 5 characters to the right, but I don't think that would be much use since to get good with it you would have to constantly count characters. One of the other flavors of pd (plugdata, purrdata, pd-ceammc, pd-l2ork) might provide this if using one of them is an option but as you progress and get better with pd, i am not sure you will find much utility in navigating text this way; years ago I also used to try and shit-arrow my way through objects but as I became more familiar with pd it became rare there was a need, anytime I want the cursor somewhere other than at the end is when I am editing an object which is not currently selected so I have to use the mouse anyways and putting the cursor where I need it is less work than keyboard navigation.