Fixed inconsistent return values for get-pos/text.

original commit: 4b575c315b02e71c32823e155d2e32a3445a6817
This commit is contained in:
Asumu Takikawa 2011-04-29 11:38:50 -04:00
commit ae8faa265d
4 changed files with 27 additions and 16 deletions

View File

@ -73,7 +73,7 @@
(if (and snip (if (and snip
(is-a? snip editor-snip%)) (is-a? snip editor-snip%))
(loop (send snip get-editor)) (loop (send snip get-editor))
(values editor #f)))] (values #f editor)))]
[else (values #f #f)]))))) [else (values #f #f)])))))
;; get-filename/untitled-name : -> string ;; get-filename/untitled-name : -> string

View File

@ -221,11 +221,13 @@
'(struct '(struct
local local
define-type struct: define-struct: define-struct/exec:
define:
define-type define-predicate
match-define)) match-define))
(for-each (λ (x) (for-each (λ (x)
(hash-set! hash-table x 'begin)) (hash-set! hash-table x 'begin))
'(case-lambda '(case-lambda case-lambda: pcase-lambda:
match-lambda match-lambda* match-lambda match-lambda*
cond cond
delay delay
@ -250,10 +252,19 @@
let/cc let/ec letcc catch let/cc let/ec letcc catch
let-syntax letrec-syntax fluid-let-syntax letrec-syntaxes+values let-syntax letrec-syntax fluid-let-syntax letrec-syntaxes+values
let: letrec: let*:
let-values: letrec-values: let*-values:
let/cc: let/ec:
lambda: λ:
plambda: opt-lambda: popt-lambda:
for for/list for/hash for/hasheq for/and for/or for for/list for/hash for/hasheq for/and for/or
for/lists for/first for/last for/fold for/lists for/first for/last for/fold
for* for*/list for*/hash for*/hasheq for*/and for*/or for* for*/list for*/hash for*/hasheq for*/and for*/or
for*/lists for*/first for*/last for*/fold for*/lists for*/first for*/last for*/fold
for: for/list: for/or: for/lists: for/fold:
for*: for*/lists: for*/fold: do:
kernel-syntax-case kernel-syntax-case
syntax-case syntax-case* syntax-rules syntax-id-rules syntax-case syntax-case* syntax-rules syntax-id-rules

View File

@ -12,17 +12,17 @@
(get-token (or/c (-> input-port? (get-token (or/c (-> input-port?
(values any/c (values any/c
symbol? symbol?
(or/c false? symbol?) (or/c symbol? #f)
exact-nonnegative-integer? (or/c exact-nonnegative-integer? #f)
exact-nonnegative-integer?)) (or/c exact-nonnegative-integer? #f)))
(-> input-port? (-> input-port?
exact-nonnegative-integer? exact-nonnegative-integer?
any/c any/c
(values any/c (values any/c
symbol? symbol?
(or/c false? symbol?) (or/c symbol? #f)
exact-nonnegative-integer? (or/c exact-nonnegative-integer? #f)
exact-nonnegative-integer? (or/c exact-nonnegative-integer? #f)
exact-nonnegative-integer? exact-nonnegative-integer?
any/c)))) any/c))))
(pairs (listof (list/c symbol? symbol?)))) void?))]{ (pairs (listof (list/c symbol? symbol?)))) void?))]{
@ -50,9 +50,9 @@
A symbol indicating how the token should be treated by the paren A symbol indicating how the token should be treated by the paren
matcher or @scheme[#f]. This symbol should be in the pairs argument.} matcher or @scheme[#f]. This symbol should be in the pairs argument.}
@item{ @item{
The starting position of the token.} The starting position of the token (or @scheme[#f] if eof).}
@item{ @item{
The ending position of the token.}] The ending position of the token (or @scheme[#f] if eof).}]
When @scheme[get-token] accepts an offset and mode value in addition to an When @scheme[get-token] accepts an offset and mode value in addition to an
input port, it must also return two extra results, which are a backup input port, it must also return two extra results, which are a backup

View File

@ -127,15 +127,15 @@
} }
@defmethod[(get-pos/text [event (is-a?/c mouse-event%)]) @defmethod[(get-pos/text [event (is-a?/c mouse-event%)])
(values (or/c false/c (is-a?/c editor<%>)) (values (or/c false/c number?)
(or/c false/c number?))]{ (or/c false/c (is-a?/c editor<%>)))]{
This method's first result is @scheme[#f] when the mouse This method's first result is @scheme[#f] when the mouse
event does not correspond to a location in the editor. event does not correspond to a location in the editor.
If the first result is an @scheme[text%] object, then the If the second result is a @scheme[text%] object, then the
second result will be a position in the editor and first result will be a position in the editor and
otherwise the second result will be @scheme[#f]. otherwise the first result will be @scheme[#f].
The @scheme[editor<%>] object will always be the nearest The @scheme[editor<%>] object will always be the nearest
enclosing editor containing the mouse click. enclosing editor containing the mouse click.