viresh-ratnakar / exolve

Online interactive crossword software in JavaScript
MIT License
71 stars 15 forks source link

Entering "Å" changes current cell in unexpected way #33

Closed perstar closed 3 years ago

perstar commented 3 years ago
  1. With a fresh version from trunk I edit exolve.html just to add a line exolve-language: sv Latin after the line with exolve-id.
  2. Then I open the file in Firefox and click in the top left corner of the crossword.
  3. I press the "Å" key on my (Swedish) keyboard. An "Å" is entered as it should be, but then the top right corner becomes the current cell!

I expected the "Å" to just be added without any jumping around, so the middle north cell should be current. (Other "special" letters "Ä" and "Ö" seem to work fine.)

viresh-ratnakar commented 3 years ago

Hi,

I tried to replicate the issue but I haven't been able to, so far. I tried using Firefox v79.0 on Linux using a test puzzle that I have copied below.

Can you please let me know which Firefox version you are using (if older than v79.0 then perhaps try updating?). Perhaps you can share the exolve puzzle specs too.

Thanks! Viresh

exolve-begin exolve-id: test-swedish exolve-title: Test-Swedish exolve-width: 3 exolve-height: 3 exolve-language: sv Latin exolve-prelude: Test entering Å Ä Ö exolve-grid: Å Ä Ö Å . Ö Ä Ä Å exolve-across: 1 aao (3) 3 aaa (3) exolve-down: 1 aaa (3) 2 ooa (3) exolve-end

perstar commented 3 years ago

Thanks for looking into this! I've found what it is. The handling of character codes and keyboard codes is a bit strange. When I press the "Å" key on a Swedish keyboard that generates an event with keyCode 219, which is the same as a "[{" key (according to this. But that is what Exolve converts shifted TABs to so it's also handled as that. I fixed it for myself by using some other replacements for the TAB key – I used:

key = e.shiftKey ? 33 : 34

that is PageUp and PageDown, which should be safe.

viresh-ratnakar commented 3 years ago

I'm glad that you've figure this out! Looks like some lazy programming at my end interacted badly with a random behaviour that I had not anticipated. I'll fix the code to not convert shift-tab into some character, so that you do not have to hack around that. Will update this bug when I do.

If you've put up a crossword in Swedish on the web using Exolve, I would love to take a look!

Thanks, Viresh

perstar commented 3 years ago

Thanks! I found it hard to find documentation on how this is supposed to work. For example this question is essentially left unanswered. I rather liked making PageUp/Down work as I did.

Since you asked, I discovered this regarding a crossword originally on paper in a newsletter, now "exolved" here. I have been a bit lazy there because there are pictures to some of the clues, and ideally I should make it so the corresponding image would be shown prominently when looking at one of those clues. (BTW, regarding localization a minor feature request would be to make "a" and "d" for across/down be configurable.)

viresh-ratnakar commented 3 years ago

Thanks for sharing that link--the page looks lovely and makes me happy!

I'll add customization of 'a' and 'd' via exolve-relabel in the next release.

viresh-ratnakar commented 3 years ago

With v0.85 that I checked in a little while ago, the "shift-tab" issue has been fixed.

I did not get to customization of 'a'/'d' yet. Will try to do it asap (feel free to open a bug for it).

Thanks!

viresh-ratnakar commented 3 years ago

With v0.88 that I checked in just now, you can customize the a/d. You can also change every single piece of text (please let me know if I missed something!). You can do something like:

exolve-relabel: across-letter: q down-letter: p

Complete details at https://github.com/viresh-ratnakar/exolve#exolve-relabel

viresh-ratnakar commented 3 years ago

Closing out old bugs that I did take some action on. If I haven't fixed every aspect as expected, apologies, but please open a new bug (hard for me to parse out what remains to be fixed).