With some difficulty, as far as I can make out :) The code overrides on-paint and draws its own cursor. The insertion point does not appear to be changed; the cursor display is just changed from a line between char@pos and char@pos+1 to a box covering char@pos+1
https://github.com/takikawa/drracket-vim-tool/blob/master/private/text.rkt#L213 On Sun, Sep 6, 2015 at 6:08 PM, Robby Findler <ro...@eecs.northwestern.edu> wrote: > The highlighting you're interested in changing is the (by default) > grey highlighting that moves around when you change the insertion > point (when you use the arrow keys, say), right? > > If so, I think the code you're looking for is the match-parens private > method in framework/private/color. You can see where it binds the > variable "here" and you probably wish it were (+ here 1) in some > cases, I guess? > > But the editor classes have the notion of insertion point wired pretty > deeply into them, and that insertion point always sits between two > characters. How does the vim mode change this behavior so that there > is highlighting on a character instead of between them? > > Robby > > > > On Sun, Sep 6, 2015 at 7:20 PM, Martin DeMello <martindeme...@gmail.com> > wrote: > > 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.