mhuebert / maria

A ClojureScript coding environment for beginners.

Home Page:https://maria.cloud

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Weird behavior inserting parentheses on Norwegian keyboard

teodorlu opened this issue · comments

Issue: Weird behavior inserting parentheses on Norwegian keyboard

Hello! Thanks for creating Maria. Seeing how smooth the experience is has motivated me to dig into Clojurescript.

I'm observing weird behavior trying to insert parentheses on my Norwegian keyboard:

  • Pressing Shift+8 to insert ( inserts (
  • Pressing Shift+9 to insert ) inserts ()

I suspect keyboard differences and keycode usage might be to blame. I haven't dug into the issue, but I thought I'd report it.

Have a nice day!

Environment:

  • Browser: Firefox
  • Platform: Ubuntu 20.04

Also observed on Chrome / Mac with a Norwegian keyboard layout.

Here's console-logged keydown events for pressing Shift+8 and Shift+9 on my keyboard:

image

Thanks for reporting, Teodor :)

@teodorlu Thanks for the report! Sadly, we have had an endless struggle with different KB layouts. :/

I can imagine!

I tried poking around a bit, but I don't feel like I'm getting anywhere. The input fields appear to be using CodeMirror. Codemirror's native Clojure mode handles parentheses on Norwegian keyboards as expected. Maria, however, appears to be using Lark for paredit. Relevant namespaces: maria.editors.code and lark.commands.exec.

Is it OK to comment on a 3 years old issue? I have exactly the same problem with Japanese layout, where the parentheses are on the same 8 and 9 keys as in Norwegian. It's great to have a good workaround; switching to a US-English keyboard layout is easy enough for me.

And yes, thanks for maria.cloud!

Hello! Could you try out 2.Maria.cloud and let us know how it behaves? It has a new key binding system

Hello! Could you try out 2.Maria.cloud and let us know how it behaves? It has a new key binding system

With pleasure.

With my Japanese keyboard setting, I observed the following:

  • When I enter an opening parenthesis, a closing one is immediately added (resulting in ()), but I have no problems removing the closing one.
  • Weird but not totally devoid of logic: A backspace over a closing parenthesis leaves the parenthesis unchanged, as if it were a mere cursor movement.
  • It seems that a closed parenthesis is ignored when typed directly after white space.
  • Sadly, Control-Enter has no effect. Totally ignored.

The Japanese keyboard layout is, by the way, very similar to the US English one, even when it comes to some often used symbols like slash, question mark, hyphen. Parentheses (round, square, curly) are in slightly different locations.

Trying to attach a video file that documents the behaviour; hope it works: https://github.com/mhuebert/maria/assets/11023294/107f0d04-3b21-4007-b13c-acc291677463 (I just noticed that I forgot the location parameters of the position function, but that is unlikely to be related to the problem).

I have some time right now and would be happy to do more testing.

On 2.maria.cloud right now with a Norwegian mac keyboard, I'm seeing the following:

  1. æøåÆØÅ does what I expect it to do
  2. ( works, and inserts ( and matching )
    • I insert ( on my keyboard with shift+8
  3. [ only inserts opening [, not closing ]
    • I insert [ on my keyboard with option+8

Found another surprising behavior:

image

When I write (last [1 2 3]) and press cmd+enter, I can't get it to evaluate. It just says nil.