Commit Graph

11 Commits

Author SHA1 Message Date
Nadeem Abdul Hamid
c0a412ed0e fix close parens behavior in interactions and comments 2012-12-04 20:39:10 -06:00
Danny Yoo
43b0e2157c Optimize stick-to-next-sexp? to speculative match before using forward-match.
Profiler output suggests that forward-match is a bit expensive.  Here
is profiler output from the original code, when profiler is wrapped
around tabify-selection:

------------------------------------------------------------------------------------------------------------
                                  loop [34]                                                             0.1%
                                  get-backward-sexp method in ...k/private/racket.rkt:425:2 [28]       99.9%
 [37] 50648(61.1%)     0(0.0%)  stick-to-next-sexp? method in ...k/private/racket.rkt:425:2 ...
                                  do-forward-match method in ...rk/private/color.rkt:71:2 [50]         99.9%

...

------------------------------------------------------------------------------------------------------------
                                  get-forward-sexp method in ...k/private/racket.rkt:425:2 [38]        17.1%
                                  stick-to-next-sexp? method in ...k/private/racket.rkt:425:2 [37]     82.9%
 [50] 61043(73.6%)    53(0.1%)  do-forward-match method in ...rk/private/color.rkt:71:2 ...
                                  colorer-driver method in ...rk/private/color.rkt:71:2 [66]           99.8%
                                  match-forward method in paren-tree% [72]                              0.1%
------------------------------------------------------------------------------------------------------------

The patch does the prerequisite string matching before calling forward-match.

Reference to dev list: http://lists.racket-lang.org/dev/archive/2012-November/010976.html
2012-11-26 13:42:49 -07:00
Nadeem Abdul Hamid
8f3343cd01 automatic parenthesis mode improvements
Handle close parentheses in a smarter way while in
auto-parens mode and be a little more smart about
inserting brace pairs in general.

In summary:

 - Add some "smart-skip" behavior to insert-close-paren,
   described in the documentation.
    - When auto-parens mode is enabled,
      the existing "balance-parens" keybinding invokes
      insert-close-paren with a smart-skip argument of
      'adjacent
    - A new "balance-parens-forward" keybinding invokes
      insert-close-paren with a smart-skip argument of
      'forward (whether or not auto-parens mode is
      enabled)

 - Enable basic smart-skip behavior for
   strings ("...") and |...| pairs, specifically, typing
   a double-quote or bar character when the cursor
   immediately precedes one causes the cursor to simply
   skip over the existing one

 - Tweak auto-insertion of block comment pairs; i.e.
   typing hash and a bar results in a properly balanced
   #||# pair. Also, when you type a bar character when
   the cursor immediately precedes a closing bar and
   hash of a comment, then the cursor skips over both
   characters (this seems better than having it just
   skip over the bar, and then having to introduce a
   new keybinding to detect when a hash is typed while
   the cursor is between a bar and a hash)

 - In strings and line/block comments, auto-parens mode
   no longer has any effect (you can still use the M+..
   keybindings to force insertion of a particular brace
   pair)

 - Detect when a character constant is being typed, and
   don't insert brace pairs if so; i.e. if the cursor
   is immediately after #\ , then typing any open parens,
   double quote, or bar, does _not_ result in the
   insertion of an open/close pair even in auto-parens
   mode

 - Add a bunch of tests related to auto-parens, matching
   pairs of braces, strings, comments, etc. to
   collects/tests/framework/racket.rkt
2012-11-25 21:57:52 -06:00
Robby Findler
316bbcb038 fix c:c;c:b so it removes {}s
closes PR 13211
2012-11-22 10:25:57 -06:00
Eli Barzilay
672910f27b Lots of bad TAB eliminations.
I started from tabs that are not on the beginning of lines, and in
several places I did further cleanings.

If you're worried about knowing who wrote some code, for example, if you
get to this commit in "git blame", then note that you can use the "-w"
flag in many git commands to ignore whitespaces.  For example, to see
per-line authors, use "git blame -w <file>".  Another example: to see
the (*much* smaller) non-whitespace changes in this (or any other)
commit, use "git log -p -w -1 <sha1>".
2012-11-07 11:22:20 -05:00
Robby Findler
a7cb8fdc84 small improvements to the memory usage for files opened in DrRacket.
Before this commit, opening collects/drracket/private/unit.rkt required
about 17.5 megabytes of memory and after this commit, it is down to
about 15 megabytes.

The precise measurement I did was to create a frame and a scheme:text%
object in it, record the result of current-memory-use, open the file,
and record current-memory-use again.

For comparison, using a text:standard-style-list% object instead of
the scheme:text% requires only about 4.1 megabytes. One difference
being that there are about 3x more snips (10,204 vs 33,901 (after the
commit)), since we have one snip for each region that has a different
color in the scheme:text version, and the text:standard-style-list has
no colors and thus about two per line (there are 5006 lines in the
file).
2012-03-10 20:18:49 -06:00
Robby Findler
eda4d294cc Lost the snipclass with the name (lib "collapsed-snipclass.ss" "framework")
somewhere between 5.1.3 and 5.2.1. Bring it back.

closes PR 12563
2012-02-14 11:26:20 -06:00
Robby Findler
48772f2e40 when double clicking in a comment, fall back to word-based instead
of sexp-based selection

closes PR 12439
2011-12-12 14:45:27 -06:00
Robby Findler
1d03e5f711 adjust the double clicking in racket mode so that clicks on the
(instead of sexp-based)

closes PR 12421
2011-12-05 21:01:28 -06:00
Robby Findler
082978effe improve the double-click-on-word behavior for scribble (generally when
double clicking inside a string) and when clicking on close
parentheses (specifically, only special case close parens that are
actually parentheses according to the colorer, rather than special
casing all close parens).
2011-11-30 16:55:54 -06:00
Robby Findler
458e2c2282 some long overdue Rackety: renaming the 'scheme:' exports of the framework to 'racket:' 2011-11-30 06:45:50 -06:00