adjusted the keybindings for search a little bit
svn: r10931
This commit is contained in:
parent
d58bdb5f56
commit
12d18d8107
|
@ -1299,6 +1299,9 @@ module browser threading seems wrong.
|
|||
get-area-container
|
||||
update-info
|
||||
get-file-menu
|
||||
search-hidden?
|
||||
unhide-search
|
||||
hide-search
|
||||
file-menu:get-close-item
|
||||
file-menu:get-save-item
|
||||
file-menu:get-save-as-item
|
||||
|
@ -2634,7 +2637,23 @@ module browser threading seems wrong.
|
|||
(update-shown))
|
||||
#\e
|
||||
(string-constant interactions-menu-item-help-string)))
|
||||
|
||||
(new menu:can-restore-menu-item%
|
||||
[shortcut #\f]
|
||||
[shortcut-prefix (cons (case (system-type)
|
||||
[(macosx) 'option]
|
||||
[else 'alt])
|
||||
(get-default-shortcut-prefix))]
|
||||
[parent (get-show-menu)]
|
||||
[label (string-constant show-find-bar)]
|
||||
[callback
|
||||
(λ (menu evt)
|
||||
(cond
|
||||
[(search-hidden?)
|
||||
(send menu set-label (string-constant hide-find-bar))
|
||||
(unhide-search #t)]
|
||||
[else
|
||||
(send menu set-label (string-constant hide-find-bar))
|
||||
(hide-search)]))])
|
||||
(new menu:can-restore-menu-item%
|
||||
(shortcut #\u)
|
||||
(label
|
||||
|
|
|
@ -2004,7 +2004,7 @@
|
|||
(send canvas focus))))
|
||||
(set! hidden? #t))
|
||||
|
||||
(define/public (unhide-search)
|
||||
(define/public (unhide-search focus?)
|
||||
(when hidden?
|
||||
(set! hidden? #f)
|
||||
(build-search-gui-in-frame)
|
||||
|
@ -2012,7 +2012,8 @@
|
|||
(send find-edit text-to-search-changed #f text-to-search)
|
||||
(unless (memq search/replace-panel (send super-root get-children))
|
||||
(send super-root add-child search/replace-panel))
|
||||
(send (send find-edit get-canvas) focus)))
|
||||
(when focus?
|
||||
(send (send find-edit get-canvas) focus))))
|
||||
|
||||
(define/public (can-replace?)
|
||||
(let ([tx (get-text-to-search)])
|
||||
|
@ -2029,24 +2030,17 @@
|
|||
(send find-edit get-text 0 (send find-edit last-position))))))))
|
||||
|
||||
(define/public (search searching-direction)
|
||||
(cond
|
||||
[hidden?
|
||||
(unhide-search)]
|
||||
[else
|
||||
(send find-edit search searching-direction #t)
|
||||
(void)]))
|
||||
(unhide-search #f)
|
||||
(send find-edit search searching-direction #t))
|
||||
|
||||
(define/public (replace&search dir)
|
||||
(cond
|
||||
[hidden?
|
||||
(unhide-search)]
|
||||
[else
|
||||
(let ([text (get-text-to-search)])
|
||||
(when text
|
||||
(send text begin-edit-sequence)
|
||||
(when (replace)
|
||||
(search dir))
|
||||
(send text end-edit-sequence)))]))
|
||||
(unhide-search #f)
|
||||
(let ([text (get-text-to-search)])
|
||||
(when text
|
||||
(send text begin-edit-sequence)
|
||||
(when (replace)
|
||||
(search dir))
|
||||
(send text end-edit-sequence))))
|
||||
|
||||
(define/private (replace)
|
||||
(let ([replacee-text (let ([txt (get-text-to-search)])
|
||||
|
@ -2075,36 +2069,33 @@
|
|||
(loop prev))])))
|
||||
|
||||
(define/public (replace-all)
|
||||
(cond
|
||||
[hidden?
|
||||
(unhide-search)]
|
||||
[else
|
||||
(let ([txt (get-text-to-search)])
|
||||
(when txt
|
||||
(let ([search-str (send find-edit get-text)]
|
||||
[ht (make-hasheq)])
|
||||
(send txt begin-edit-sequence)
|
||||
(hash-set! ht txt #t)
|
||||
(let loop ([txt (pop-all-the-way-out txt)]
|
||||
[pos 0])
|
||||
(let-values ([(found-txt found-pos) (find-string-embedded txt
|
||||
search-str
|
||||
'forward
|
||||
pos
|
||||
'eof
|
||||
#f
|
||||
case-sensitive-search?
|
||||
#t)])
|
||||
(cond
|
||||
[found-pos
|
||||
(unless (hash-ref ht txt #f)
|
||||
(hash-set! ht txt #t)
|
||||
(send txt begin-edit-sequence))
|
||||
(send found-txt set-position (- found-pos (string-length search-str)) found-pos)
|
||||
(replace)
|
||||
(loop found-txt (send found-txt get-end-position))]
|
||||
[else (void)])))
|
||||
(hash-for-each ht (λ (txt _) (send txt end-edit-sequence))))))]))
|
||||
(unhide-search #f)
|
||||
(let ([txt (get-text-to-search)])
|
||||
(when txt
|
||||
(let ([search-str (send find-edit get-text)]
|
||||
[ht (make-hasheq)])
|
||||
(send txt begin-edit-sequence)
|
||||
(hash-set! ht txt #t)
|
||||
(let loop ([txt (pop-all-the-way-out txt)]
|
||||
[pos 0])
|
||||
(let-values ([(found-txt found-pos) (find-string-embedded txt
|
||||
search-str
|
||||
'forward
|
||||
pos
|
||||
'eof
|
||||
#f
|
||||
case-sensitive-search?
|
||||
#t)])
|
||||
(cond
|
||||
[found-pos
|
||||
(unless (hash-ref ht txt #f)
|
||||
(hash-set! ht txt #t)
|
||||
(send txt begin-edit-sequence))
|
||||
(send found-txt set-position (- found-pos (string-length search-str)) found-pos)
|
||||
(replace)
|
||||
(loop found-txt (send found-txt get-end-position))]
|
||||
[else (void)])))
|
||||
(hash-for-each ht (λ (txt _) (send txt end-edit-sequence)))))))
|
||||
|
||||
(define/private (pop-all-the-way-out txt)
|
||||
(let ([admin (send txt get-admin)])
|
||||
|
|
|
@ -926,9 +926,11 @@ framework)) @(require (for-label scheme/gui)) @(require
|
|||
frame.
|
||||
|
||||
}
|
||||
@defmethod*[(((unhide-search) void))]{
|
||||
When the searching sub window is hidden, makes it visible.
|
||||
|
||||
@defmethod*[(((unhide-search [move-focus? boolean? #f]) void))]{
|
||||
When the searching sub window is hidden, makes it visible. If
|
||||
@scheme[move-focus?] is @scheme[#f], the focus is not moved,
|
||||
but if it is any other value, the focus is moved to the find
|
||||
window.
|
||||
}
|
||||
@defmethod[(get-case-sensitive-search?) boolean?]{
|
||||
Returns @scheme[#t] if the search is currently case-sensitive.
|
||||
|
@ -953,7 +955,7 @@ framework)) @(require (for-label scheme/gui)) @(require
|
|||
|
||||
@defmethod*[#:mode override (((edit-menu:find-callback (item (is-a?/c menu-item%)) (evt (is-a?/c control-event%))) void?))]{
|
||||
|
||||
Calls
|
||||
Calls @method[frame:searchable unhide-search] and then
|
||||
@method[frame:searchable<%> search].
|
||||
}
|
||||
@defmethod*[#:mode override (((edit-menu:create-find?) boolean?))]{
|
||||
|
@ -961,7 +963,7 @@ framework)) @(require (for-label scheme/gui)) @(require
|
|||
}
|
||||
@defmethod*[#:mode override (((edit-menu:find-backwards-callback (item (is-a?/c menu-item%)) (evt (is-a?/c control-event%))) void?))]{
|
||||
|
||||
Calls
|
||||
Calls @method[frame:searchable unhide-search] and then
|
||||
@method[frame:searchable<%> search].
|
||||
}
|
||||
@defmethod*[#:mode override (((edit-menu:create-find-backwards?) boolean?))]{
|
||||
|
@ -969,7 +971,8 @@ framework)) @(require (for-label scheme/gui)) @(require
|
|||
}
|
||||
|
||||
@defmethod*[#:mode override (((edit-menu:replace-and-find-callback) boolean?))]{
|
||||
Calls @method[frame:searchable<%> replace&search].
|
||||
Calls @method[frame:searchable unhide-search] and then
|
||||
calls @method[frame:searchable<%> replace&search].
|
||||
}
|
||||
@defmethod*[#:mode override (((edit-menu:replace-and-find-on-demand (item menu-item%)) void))]{
|
||||
|
||||
|
@ -984,7 +987,8 @@ framework)) @(require (for-label scheme/gui)) @(require
|
|||
}
|
||||
|
||||
@defmethod*[#:mode override (((edit-menu:replace-and-find-backwards-callback) boolean?))]{
|
||||
Calls @method[frame:searchable<%> replace&search].
|
||||
Calls @method[frame:searchable unhide-search] and then
|
||||
calls @method[frame:searchable<%> replace&search].
|
||||
}
|
||||
@defmethod*[#:mode override (((edit-menu:replace-and-find-backwards-on-demand (item menu-item%)) void))]{
|
||||
|
||||
|
|
|
@ -711,6 +711,9 @@ please adhere to these guidelines:
|
|||
(show-module-browser "Show Module Browser")
|
||||
(hide-module-browser "Hide Module Browser")
|
||||
|
||||
(show-find-bar "Show Find Bar")
|
||||
(hide-find-bar "Hide Find Bar")
|
||||
|
||||
(help-menu-label "&Help")
|
||||
(about-info "Credits and details for this application")
|
||||
(about-menu-item "About...")
|
||||
|
|
Loading…
Reference in New Issue
Block a user