Let's say I have the following:

(let ([x (foo bar)] ... )

In the regular drracket editor, when I move the cursor between the ) and ]
it highlights (foo bar). In the vim emulator, the cursor has been replaced
by a block that highlights a character, rather than a line just before it.
So the same cursor position would display a box over the ] rather than a
line between ) and ], and therefore backward-sexp needs to match the [
rather than the (.

There is the following code in the vim editor to handle explicitly hitting
%:

      ;; implements the behavior of "%" and friends in vim
      (define/private (do-matching-paren action)
        (define pos-box (box 0))
        (get-position pos-box)
        (define pos (unbox pos-box))
        (define char (get-character pos))
        (match char
          [(or #\) #\] #\})
           (action 'backward (get-backward-sexp (add1 pos))
                             (add1 pos))]

and I was trying to do the same for highlighting the sexp when the cursor
is over the closing ), but I can't figure it out.

martin

On Sun, Sep 6, 2015 at 5:00 PM, Robby Findler <ro...@eecs.northwestern.edu>
wrote:

> I am not quite following what you want to do. Can you give an example
> interaction?
>
> Robby
>
> On Sunday, September 6, 2015, Martin DeMello <martindeme...@gmail.com>
> wrote:
>
>> I'm trying to override the automatic backward-sexp highlighting in
>> drracket to highlight the sexp based on the ) after the cursor rather than
>> before it [https://github.com/takikawa/drracket-vim-tool/issues/13]. Is
>> this possible? I tried overriding flash-backward-sexp but it didn't seem to
>> have any effect.
>>
>> martin
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Racket Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to racket-users+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
> --
> You received this message because you are subscribed to the Google Groups
> "Racket Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to racket-users+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to racket-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to