gracelang / grace-web-editor

A simple editor for Grace
GNU General Public License v3.0
2 stars 8 forks source link

Resolves Auto-pair bracket clash #94

Closed virinchiv closed 6 months ago

virinchiv commented 10 months ago

I changed the code in editor.js so that when the Autopair setting is turned on and two brackets '[[' are typed in, the replacement from '[[' to '⟦' occurs on the left side along with ']]' to '⟧' on the right side. Everything else operates same as before.

apblack commented 10 months ago

It looks like this works correctly! Congratulations on finding the place to make the changes. A couple of suggestions:

  1. Don't make gratuitous changes to unrelated code. You may not like the whitespace conventions that another author has used, but changing them in a commit dedicated to another purpose just makes it harder to see the real changes. If you really must change unrelated code, put those changes in a separate commit, with an appropriate commit message.
  2. The existing digraph replacement code uses the var (should be const) replacements to identify characters that should be replaced, and their replacements. Your code has [[ and ⟦, and ]] and ⟧, hard-coded. Of course, we know that (right now) [[ and ]] are the only pair that we should be concerned with ... but it would be nicer if you would find them in the dictionary rather than hard-code them.