.
original commit: c83d6061c78d2dc7ef6680d3c4b3fe795d5a9fe2
This commit is contained in:
parent
20dbafe0a0
commit
dc55ffbd8b
|
@ -1316,11 +1316,12 @@
|
||||||
(sequence
|
(sequence
|
||||||
(apply super-init mred proxy args))))
|
(apply super-init mred proxy args))))
|
||||||
|
|
||||||
|
;; Weak boxed:
|
||||||
(define active-main-frame #f)
|
(define active-main-frame #f)
|
||||||
|
|
||||||
(wx:application-file-handler (entry-point
|
(wx:application-file-handler (entry-point
|
||||||
(lambda (f)
|
(lambda (f)
|
||||||
(let ([af active-main-frame])
|
(let ([af (weak-box-value active-main-frame)])
|
||||||
(when af
|
(when af
|
||||||
(queue-window-callback
|
(queue-window-callback
|
||||||
af
|
af
|
||||||
|
@ -1346,7 +1347,7 @@
|
||||||
[f (entry-point
|
[f (entry-point
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(unless running-quit?
|
(unless running-quit?
|
||||||
(let ([af active-main-frame])
|
(let ([af (weak-box-value active-main-frame)])
|
||||||
(when af
|
(when af
|
||||||
(set! running-quit? #t)
|
(set! running-quit? #t)
|
||||||
(queue-window-callback
|
(queue-window-callback
|
||||||
|
@ -1474,7 +1475,7 @@
|
||||||
(set! act-date/seconds (current-seconds))
|
(set! act-date/seconds (current-seconds))
|
||||||
(set! act-date/milliseconds (current-milliseconds))
|
(set! act-date/milliseconds (current-milliseconds))
|
||||||
(when (wx:main-eventspace? (get-eventspace))
|
(when (wx:main-eventspace? (get-eventspace))
|
||||||
(set! active-main-frame this)))
|
(set! active-main-frame (make-weak-box this))))
|
||||||
;; Windows needs trampoline:
|
;; Windows needs trampoline:
|
||||||
(queue-window-callback
|
(queue-window-callback
|
||||||
this
|
this
|
||||||
|
@ -7388,29 +7389,36 @@
|
||||||
[lock-semaphore (make-semaphore 1)]
|
[lock-semaphore (make-semaphore 1)]
|
||||||
[update-str-to-snip
|
[update-str-to-snip
|
||||||
(lambda ()
|
(lambda ()
|
||||||
|
(if (not snip)
|
||||||
|
(set! str #f)
|
||||||
|
(let ([snip-start (send text get-snip-position snip)])
|
||||||
(cond
|
(cond
|
||||||
[(not snip)
|
[(snip-start . >= . end)
|
||||||
(set! str #f)]
|
|
||||||
[((send text get-snip-position snip) . >= . end)
|
|
||||||
(set! str #f)]
|
(set! str #f)]
|
||||||
[(is-a? snip wx:string-snip%)
|
[(is-a? snip wx:string-snip%)
|
||||||
(set! str (send snip get-text 0 (send snip get-count)))]
|
(set! str (send snip get-text 0 (min (send snip get-count)
|
||||||
|
(- end snip-start))))]
|
||||||
[else
|
[else
|
||||||
(set! str 'snip)]))]
|
(set! str 'snip)]))))]
|
||||||
[next-snip
|
[next-snip
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(set! snip (send snip next))
|
(set! snip (send snip next))
|
||||||
(set! pos 0)
|
(set! pos 0)
|
||||||
(update-str-to-snip))]
|
(update-str-to-snip))]
|
||||||
[read-char (lambda ()
|
[read-chars (lambda (to-str)
|
||||||
(cond
|
(cond
|
||||||
[(not str) eof]
|
[(not str) eof]
|
||||||
[(string? str)
|
[(string? str)
|
||||||
(begin0
|
(let* ([sl (string-length str)]
|
||||||
(string-ref str pos)
|
[n (min (- sl pos) (string-length to-str))])
|
||||||
(set! pos (+ pos 1))
|
(let loop ([i 0])
|
||||||
(when ((string-length str) . <= . pos)
|
(unless (= i n)
|
||||||
(next-snip)))]
|
(string-set! to-str i (string-ref str (+ i pos)))
|
||||||
|
(loop (add1 i))))
|
||||||
|
(set! pos (+ pos n))
|
||||||
|
(when (sl . <= . pos)
|
||||||
|
(next-snip))
|
||||||
|
n)]
|
||||||
[(eq? str 'snip)
|
[(eq? str 'snip)
|
||||||
(let ([the-snip snip])
|
(let ([the-snip snip])
|
||||||
(lambda (file line col ppos)
|
(lambda (file line col ppos)
|
||||||
|
@ -7438,13 +7446,7 @@
|
||||||
(if (semaphore-try-wait? lock-semaphore)
|
(if (semaphore-try-wait? lock-semaphore)
|
||||||
(dynamic-wind
|
(dynamic-wind
|
||||||
void
|
void
|
||||||
(lambda ()
|
(lambda () (read-chars s))
|
||||||
(let ([c (read-char)])
|
|
||||||
(if (char? c)
|
|
||||||
(begin
|
|
||||||
(string-set! s 0 c)
|
|
||||||
1)
|
|
||||||
c)))
|
|
||||||
(lambda () (semaphore-post lock-semaphore)))
|
(lambda () (semaphore-post lock-semaphore)))
|
||||||
(make-semaphore-peek lock-semaphore))))
|
(make-semaphore-peek lock-semaphore))))
|
||||||
#f ; no peek
|
#f ; no peek
|
||||||
|
|
Loading…
Reference in New Issue
Block a user