If I have nested function calls, the expression ends with a sequence of close parentheses. E.g.:
When I do this, I cannot select an inner subexpression (for example, rocket(vec2(100,100)) in the code above). The selection either grows to the end of all the close parentheses or shrinks to the start of all the close parentheses.
Parenthesis make it really tricky to form selections, you have to drag the handles very slowly, which is quite annoying. This seems to be due to Apple’s text view behaviour not being designed for code.
I am thinking about some sort of “shift” key that you can use with the caret movement keys to select regions.
Thinking about it, I almost never want to move the insertion point to a specific character location or select a region of text in terms of character locations. I want to select some program fragment (expression or statement) and then do something with it, such as wrap it in a function call, extract it into a local variable, or whatever.
So, I’d rather the editor behaved more like a LISP editor or modern IDE, and was language aware. Some ideas:
If I touch the screen within some code I’d like to select the smallest sub-expression within the statement. That might be a single number or an identifier if I touch within an arithmetic expression. But it might be something much wider. If I touch a function keyword, select the entire function. If I touch an else keyword, select the entire else block.
Let me widen/shrink the selection (like the Control-W/Control-Shift-W in IntelliJ or Control-Shift-Up/Control-Shift-Down in Eclipse), or widen the selection to the left or right if that makes sense (e.g. within an arithmetic expression).
Offer editing options that make sense depending on what is selected. For example, if I have selected a function call, offer editing actions to add/remove parameters. If I have selected any expression, offer editing actions to wrap the expression in a function call. If I have selected an identifier, let me rename the identifier. And so on.
Offer text editing as a fallback option, for when there are no language-aware actions to do what I want.
Bonus Points - let me write new editing actions in Lua!