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
(is-a? snip editor-snip%))
(loop (send snip get-editor))
(values editor #f)))]
(values #f editor)))]
[else (values #f #f)])))))
;; get-filename/untitled-name : -> string

View File

@ -221,11 +221,13 @@
'(struct
local
define-type
struct: define-struct: define-struct/exec:
define:
define-type define-predicate
match-define))
(for-each (λ (x)
(hash-set! hash-table x 'begin))
'(case-lambda
'(case-lambda case-lambda: pcase-lambda:
match-lambda match-lambda*
cond
delay
@ -250,10 +252,19 @@
let/cc let/ec letcc catch
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/lists for/first for/last for/fold
for* for*/list for*/hash for*/hasheq for*/and for*/or
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
syntax-case syntax-case* syntax-rules syntax-id-rules

View File

@ -12,17 +12,17 @@
(get-token (or/c (-> input-port?
(values any/c
symbol?
(or/c false? symbol?)
exact-nonnegative-integer?
exact-nonnegative-integer?))
(or/c symbol? #f)
(or/c exact-nonnegative-integer? #f)
(or/c exact-nonnegative-integer? #f)))
(-> input-port?
exact-nonnegative-integer?
any/c
(values any/c
symbol?
(or/c false? symbol?)
exact-nonnegative-integer?
exact-nonnegative-integer?
(or/c symbol? #f)
(or/c exact-nonnegative-integer? #f)
(or/c exact-nonnegative-integer? #f)
exact-nonnegative-integer?
any/c))))
(pairs (listof (list/c symbol? symbol?)))) void?))]{
@ -50,9 +50,9 @@
A symbol indicating how the token should be treated by the paren
matcher or @scheme[#f]. This symbol should be in the pairs argument.}
@item{
The starting position of the token.}
The starting position of the token (or @scheme[#f] if eof).}
@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
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%)])
(values (or/c false/c (is-a?/c editor<%>))
(or/c false/c number?))]{
(values (or/c false/c number?)
(or/c false/c (is-a?/c editor<%>)))]{
This method's first result is @scheme[#f] when the mouse
event does not correspond to a location in the editor.
If the first result is an @scheme[text%] object, then the
second result will be a position in the editor and
otherwise the second result will be @scheme[#f].
If the second result is a @scheme[text%] object, then the
first result will be a position in the editor and
otherwise the first result will be @scheme[#f].
The @scheme[editor<%>] object will always be the nearest
enclosing editor containing the mouse click.