freon4dsl / Freon4dsl

Web Native language Workbench with Projectional Web Editor
https://www.freon4dsl.dev
MIT License
67 stars 8 forks source link

adding a binary operator to expression doesn't work correctly #329

Closed globallyunique closed 3 months ago

globallyunique commented 5 months ago

If you've entered 1 + 2 and your cursor position is at or after the '2', you can't just press '+' and have the expression extended to be '1 + 2 + '.

joswarmer commented 5 months ago

As long as you are in the '2' box, it won't work, but if you go to the box right of the '2' box (using the right arrow key) you should be able to add it. However, it seems that even when you can add the operator, the re-rendering of the expression is not happening.

joswarmer commented 5 months ago

The problems in the Example language appears to come from the fact that the expressions in the editor are not shown in the startup projection. After changing the projection they are shown but don't work. If you remove the .edit files for projections 'second' and 'third' from the def folder and run npm run example again, the expressions show at startup and work ok.

Doing this you can work around the problem while I am looking into the underlying problem.

joswarmer commented 5 months ago

Now also works when first projection hides the expression, so forget about the previous comment.

globallyunique commented 5 months ago

What are the right gestures to fluidly enter an expression like '1 + 2 + 5' without using the mouse. When you initially enter '1', pressing return or right arrow goes to the next field following the expression. It seems like it should move you to being able to enter the next part of the binary expression. After '1' is added, clicking on it and then pressing return allows you to added the '+'. Clicking next to it also allows you to enter the '+'.

joswarmer commented 3 months ago

I usually use type '1', TAB , type '+'

globallyunique commented 3 months ago

Could special characters like '+' behave like a tab so you could fluidly enter the simpler parts of an expression?

joswarmer commented 3 months ago

Yes they could (they dis so in the past), will make this change.

joswarmer commented 3 months ago

Binary expressions do work again, including re-rendering. The fluent '+' also, but ... only from the number in the custom projection. Need to discuss further how this should work best. Like to do that in another issue as that is not a bug, but a usability question.