New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exponentiation on the web interface #97
Comments
Not sure why the circumflex would be deleted. I can't reproduce that on my machine. However, I now made sure a⋅⋅b gets parsed as a^b in the latest commit. |
Thanks! I think its because I'm on a german quertz keyboard and entering a circumflex would start to create a compose key input. Like the sequence In the oninput event this behaviour seems to be handled with specifying the In total there are 4 oninput events that are triggered: First:
Second:
Note that the circumflex immediately disappears after typing the first one - without any further interaction... So my guess would be that the whole composition cycle gets somehow cancelled and therefore deletes the "fake" circumflex that indicates that i am in the composing mode... Here is some more info on that bizz. |
I managed to reproduce these shenanigans: <html>
<head>
<script>
function inp(e) {
let b = document.getElementById("blub");
e.target.selectionStart = e.target.selectionStart;
e.target.selectionEnd = e.target.selectionStart;
}
</script>
</head>
<textarea id="blub" oninput="inp(event)"></textarea>
</html> So i guess the problem is that when I enter the composing mode by entering the first circumflex, the selection of the textfield is immediately updated, which is interpreted by the browser as "the cursor moved so we need to cancel the composing" If i wrap the changing of the selection in an if, then it works. <html>
<head>
<script>
function inp(e) {
let b = document.getElementById("blub");
if (e.inputType !== "insertCompositionText") {
e.target.selectionStart = e.target.selectionStart;
e.target.selectionEnd = e.target.selectionStart;
}
}
</script>
</head>
<textarea id="blub" oninput="inp(event)"></textarea>
</html> Maybe inserting a similar if here solves the issue.... kalker/web/src/KalkCalculator.svelte Lines 221 to 235 in e50d398
But I am not at all aware of any side effects this may have, and I know nearly nothing about this whole key composing stuff myself, so take all of this with a grain of salt, should you or someone else decide to look into this rabbithole. |
This would be a very quick fix for it, that seems to work reasonably well: MonaMayrhofer@77bd037. Normally the circumflex would be somehow highlighted as being "fake", (normally underlined), but that would not be as straight forward to implement. Well that's it for me for now, I don't know how many users are actually affected by this (i personally thought this was standard behavior but as you cannot reproduce it, it does not seem to be as standard). |
@MonaMayrhofer That looks like a reasonable fix and doesn't seem to cause any issues, neat. Feel free to make a pull request! |
Exponentiation does not seem to work in the web interface (Firefox).
As the web interface immediately converts the input into special symbols it is not possible to do inputs such as
2**3
as these get immediately turned into2⋅⋅3
, which then results inUnexpected token: 'Star'
Also I am not able to input
^2
for some reason as the circumflex gets immediately deleted.The console version works fine.
The text was updated successfully, but these errors were encountered: