aboutsummaryrefslogtreecommitdiffhomepage
path: root/ide/sentence.ml
diff options
context:
space:
mode:
authorGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-12-11 07:46:08 +0000
committerGravatar letouzey <letouzey@85f007b7-540e-0410-9357-904b9bb8a0f7>2012-12-11 07:46:08 +0000
commit9cdd77d5774e9a73563c4d4870ea2de8225353d9 (patch)
treee3dea01f467ec7b9f62587c53f069961884c14c6 /ide/sentence.ml
parentb0ab21a5a94b09170ff60cd4a405afa5287d7867 (diff)
Coq_lex: direct accounting of utf8 extra bytes in offsets
We directly produce in Coq_lex a utf8 char offset instead of a byte offset, by counting the utf8 extra byte during the lexing. This way, no need anymore for converting later with complex byte_offset_to_char_offset. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/coq/trunk@16059 85f007b7-540e-0410-9357-904b9bb8a0f7
Diffstat (limited to 'ide/sentence.ml')
-rw-r--r--ide/sentence.ml10
1 files changed, 3 insertions, 7 deletions
diff --git a/ide/sentence.ml b/ide/sentence.ml
index f6bc99207..01add490e 100644
--- a/ide/sentence.ml
+++ b/ide/sentence.ml
@@ -16,14 +16,10 @@
let split_slice_lax (buffer:GText.buffer) start stop =
List.iter (buffer#remove_tag ~start ~stop) Tags.Script.all;
let slice = buffer#get_text ~start ~stop () in
- let mkiter =
- (* caveat : partial application with effects *)
- let convert = Ideutils.byte_offset_to_char_offset slice in
- fun off -> start#forward_chars (convert off)
- in
let apply_tag off tag =
- let start = mkiter off in
- buffer#apply_tag ~start ~stop:start#forward_char tag
+ (* off is now a utf8-compliant char offset, cf Coq_lex.utf8_adjust *)
+ let iter = start#forward_chars off in
+ buffer#apply_tag ~start:iter ~stop:iter#forward_char tag
in
Coq_lex.delimit_sentences apply_tag slice