Open pidgeon777 opened 2 years ago
This is still one selection. But it is multiline. In this case you need to use ; separator at the end of each line. All lines will be evaluated aby you'll get result from last evaluation. See "Example 2"
Perfect.
But I was discussing the case with three single selections (one per row).
For example, when you hold Ctrl
and click with left mouse button to add a selection.
In that case, it would be extremely helpful to consider all of the selections as independent and calculate the associated expression.
In the end, the clipboard should contain something like the following:
result1
result2
ERROR
result3
...
ERROR
could be associated with an erroneous expression result, for the corresponding selection.
@PlanetCNC do you think my proposal could be integrated?
I'll think of something
In next version this will be possible: print(2+3*5); print(0x0004+2); print(sin(3.141)); print("Hooray");
Thanks for the new info, I'm just wondering if it will be necessary to add all of those prints to enable multiple selection supports.
I imagine it would be enough to do something like this, e.g. with this text:
Let `22and
0xc+9,
ACand finally
sin(3.14)`.
Those are our four selections:
a. 2*2
b. 0xc+9
c. A*C
d. sin(3.14)
We trigger the Expression
command.
The plugin detects all of our selections and calculates their expressions separately.
We obtain:
Let 4
and 21
, ERROR
and finally 0.00159
.
So, no need to use the print(expression)
format.
Or did you mean to use it for something else?
Let's consider this example with multiple selections:
When executing the
Expression
command, this happens:Ideally, the expression should be simultaneously calculated for each selection, and the result saved to the clipboard.
As a result, the original selections should be replaced with the corresponding expression results when pasting.
If an expression is not recognized, the ERROR string could be output instead, for the corresponding selection.