racket / drracket

DrRacket, IDE for Racket
http://www.racket-lang.org/
Other
444 stars 93 forks source link

Wrapping expression with bracket with "automatically adjust opening square brackets" #662

Closed sorawee closed 5 months ago

sorawee commented 5 months ago

It is possible to wrap an expression with parentheses and braces, but not with brackets, when "automatically adjust opening square brackets" is on.

For example, if «....» represents a highlighted region, then if we have:

1 «2 3 4» 5

After pressing (, {, and ctrl-[, we obtain:

1 (2 3 4) 5
1 {2 3 4} 5

and

1 [] 5

The last one is undesirable.

Note that I used ctrl-[ because "automatically adjust opening square brackets" is on, which makes [ act like ( in this context.

jbclements commented 5 months ago

Interesting... on my mac, I use "ESC-[" for this, which (I just tested and) still works fine. I don't really know which one is supposed to work, so this may well still be a bug!

rfindler commented 5 months ago

I pushed a fix for this: https://github.com/racket/gui/commit/f7be366a3be1a30dacfc10f8a8bf15b1a5ec2cb5 , but messed up the commit message.

Also, I'm not super confident about this change as I'm not sure the test suites really are covering enough stuff so let me know if you find other ways it is wrong!