kalk icon indicating copy to clipboard operation
kalk copied to clipboard

Wish: When syntax error happens, put cursor at the end of broken expression

Open zvirja opened this issue 3 years ago • 1 comments

Wish

First of all, thank you very much for the excellent tool you created! I used basics of it only, but already found it amazing.

One thing which immediately hit me, is that in case of error the cursor is put at the beginning of the error expression, not the end. For example if you type

bin something

the cursor is put at the beginning of something:

image

That feels "unexpected" to me. It's a bit unusual to use "delete" button to correct the error, not the "backspace" one. It's very difficult for me though to explain why exactly I feel the current behavior non-natural. Like I would naturally have an intent to look for an error left to the cursor, not right. And also I have intuition to fix error to the left, not to the right. Could be because in IDE you would usually have the whole error selected with the cursor at the end - so that's where I got used to that.

I do not have strong arguments in favor of suggested behavior change and I did not test how it would feel if that would be different. But decided to drop an issue in case I'm not the only one or you yourself thought about it as well 😃

Idea

In case AST underneath allows to precisely track position, one of the ideas could be to have something like this: https://twitter.com/firstdrafthell/status/1427936354214764548

Then repeat the prompt again with the cursor at the end. This way it's clear what the boundaries of the error are even in case when broken expression has multiple words.

zvirja avatar Sep 30 '21 17:09 zvirja

I would naturally have an intent to look for an error left to the cursor, not right. And also I have intuition to fix error to the left, not to the right.

yep, why not.

xoofx avatar Oct 01 '21 05:10 xoofx