diff options
author | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 1999-12-09 15:27:04 +0000 |
---|---|---|
committer | Jacques Garrigue <garrigue at math.nagoya-u.ac.jp> | 1999-12-09 15:27:04 +0000 |
commit | 016ba4f8779e65c0d0e7386da8eb3424e061a258 (patch) | |
tree | 130ccdb13761b887c4b6978f1d52ade450ceb6cb /otherlibs | |
parent | b68f4e6a5d5f24c61337cd82f59d903a1e034270 (diff) |
kast refinements
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@2681 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs')
-rw-r--r-- | otherlibs/labltk/browser/editor.ml | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/otherlibs/labltk/browser/editor.ml b/otherlibs/labltk/browser/editor.ml index c98ca9d60..26df2673b 100644 --- a/otherlibs/labltk/browser/editor.ml +++ b/otherlibs/labltk/browser/editor.ml @@ -141,9 +141,13 @@ let send_phrase txt = and after = ref false in while !pend = -1 do let token = Lexer.token buffer in - let pos = Lexing.lexeme_start buffer in + let pos = + if token = SEMISEMI then Lexing.lexeme_end buffer + else Lexing.lexeme_start buffer + in + let bol = (pos = 0) || text.[pos-1] = '\n' in if not !after && - Text.compare txt.tw index:(tpos pos) op:`Gt + Text.compare txt.tw index:(tpos pos) op:(if bol then `Gt else `Ge) index:(`Mark"insert",[]) then begin after := true; @@ -152,7 +156,6 @@ let send_phrase txt = block_start := [] end end; - let bol = (pos = 0) || text.[pos-1] = '\n' in match token with CLASS | EXTERNAL | EXCEPTION | FUNCTOR | LET | MODULE | OPEN | TYPE | VAL | SHARP when bol -> @@ -160,10 +163,10 @@ let send_phrase txt = if !after then pend := pos else start := pos else block_start := pos :: List.tl !block_start | SEMISEMI -> - let pos' = Lexing.lexeme_end buffer in if !block_start = [] then - if !after then pend := pos else start := pos' - else block_start := pos' :: List.tl !block_start + if !after then pend := Lexing.lexeme_start buffer + else start := pos + else block_start := pos :: List.tl !block_start | BEGIN | OBJECT | STRUCT | SIG -> block_start := Lexing.lexeme_end buffer :: !block_start | END -> |