fix to PR 8825
svn: r6993
This commit is contained in:
parent
2b21003cc8
commit
3d71bd32c1
|
@ -425,7 +425,8 @@
|
||||||
classify-position)
|
classify-position)
|
||||||
|
|
||||||
(inherit get-styles-fixed)
|
(inherit get-styles-fixed)
|
||||||
(inherit has-focus? find-snip split-snip)
|
(inherit has-focus? find-snip split-snip
|
||||||
|
position-location get-dc)
|
||||||
|
|
||||||
(public tabify-on-return? tabify
|
(public tabify-on-return? tabify
|
||||||
tabify-all insert-return calc-last-para
|
tabify-all insert-return calc-last-para
|
||||||
|
@ -475,18 +476,30 @@
|
||||||
(position-paragraph last))])
|
(position-paragraph last))])
|
||||||
(letrec
|
(letrec
|
||||||
([find-offset
|
([find-offset
|
||||||
(λ (pos)
|
(λ (start-pos)
|
||||||
(let loop ([p pos][o 0])
|
(let ([end-pos
|
||||||
|
(let loop ([p start-pos])
|
||||||
(let ([c (get-character p)])
|
(let ([c (get-character p)])
|
||||||
(cond
|
(cond
|
||||||
[(char=? c #\tab)
|
[(char=? c #\tab)
|
||||||
(loop (add1 p) (+ o (- 8 (modulo o 8))))]
|
(loop (add1 p))]
|
||||||
[(char=? c #\newline)
|
[(char=? c #\newline)
|
||||||
(cons o p)]
|
p]
|
||||||
[(char-whitespace? c)
|
[(char-whitespace? c)
|
||||||
(loop (add1 p) (add1 o))]
|
(loop (add1 p))]
|
||||||
[else
|
[else
|
||||||
(cons o p)]))))]
|
p])))]
|
||||||
|
[start-x (box 0)]
|
||||||
|
[end-x (box 0)])
|
||||||
|
(position-location start-pos start-x #f #t #t)
|
||||||
|
(position-location end-pos end-x #f #t #t)
|
||||||
|
(let-values ([(w _1 _2 _3) (send (get-dc) get-text-extent "x"
|
||||||
|
(send (send (get-style-list)
|
||||||
|
find-named-style "Standard")
|
||||||
|
get-font))])
|
||||||
|
(cons (inexact->exact (floor (/ (- (unbox end-x) (unbox start-x)) w)))
|
||||||
|
end-pos))))]
|
||||||
|
|
||||||
[visual-offset
|
[visual-offset
|
||||||
(λ (pos)
|
(λ (pos)
|
||||||
(let loop ([p (sub1 pos)])
|
(let loop ([p (sub1 pos)])
|
||||||
|
|
Loading…
Reference in New Issue
Block a user