plugdata icon indicating copy to clipboard operation
plugdata copied to clipboard

improvements for code objects

Open tomara-x opened this issue 2 years ago • 3 comments

for things like [expr]/[expr~]/[fexpr~] and ofelia objects, inserting a new line using the enter key is important (this is making my ofelia learning experience.. difficult)

but i'm lost, you think it's better to add a new line only if the last character is a semicolon? otherwise we exit the editor? it avoids conflict with the suggestions and also doesn't need modifiers. i tried making it insert a new line with shift+enter, but it didn't work. i don't know why ReturnKeyPressed doesn't get called when shift is held, that's outside my skill set.

the annoying thing is that this only works for after the object has became a TextObject, not while adding a new object. is it possible to have a class that's immediately switched to when the new object text starts with one of those words? maybe even with a CodeEditorComponent for extra cuteness? 🥺

another thing, there's escaping for commas and semicolons in new objects:

https://github.com/plugdata-team/plugdata/assets/86204514/9ed576a8-6ce2-48a7-96c4-a562ecd4f720

sorry about the scattered thoughts

tomara-x avatar Jun 14 '23 18:06 tomara-x

I agree, writing any actual code into objects is hell right now, we need to improve this. I'll examine how Max and Pd do this soon, to see if they have it figured out.

timothyschoen avatar Jun 14 '23 20:06 timothyschoen

image This is how it looks in "MAX", I think the ideal option would be just a large block with code that could be expanded or collapsed.

KPY7030P avatar Sep 17 '23 10:09 KPY7030P

I've made a small improvement to this now, it no longer erroneously puts space for an extra line behind objects that have multiple lines. It can still be better thought!

I'm not sure if we can do it like in Max, where you can expand a text editor from an object. We could maybe do that, if we wrote custom wrappers for the ofelia and circuit~ objects, but I think at first, the normal text object needs to be more workable with code too.

timothyschoen avatar Sep 24 '23 19:09 timothyschoen