disable overwrite mode when the overwrite keybindings are disabled
This commit is contained in:
parent
ab998c9f53
commit
d1e3a991cd
|
@ -1,7 +1,6 @@
|
|||
#lang scribble/doc
|
||||
@(require scribble/manual scribble/extract)
|
||||
@(require (for-label framework))
|
||||
@(require (for-label scheme/gui))
|
||||
@(require (for-label framework racket/gui))
|
||||
@title{Text}
|
||||
|
||||
@definterface[text:basic<%> (editor:basic<%> text%)]{
|
||||
|
@ -1335,6 +1334,17 @@
|
|||
}
|
||||
}
|
||||
|
||||
@definterface[text:overwrite-disable<%> ()]{
|
||||
Classes implementing this interface disable overwrite mode when
|
||||
the overwrite mode keybindings are turned off.
|
||||
}
|
||||
|
||||
@defmixin[text:overwrite-disable-mixin (text%) (text:set-overwrite-mode<%>)]{
|
||||
This mixin adds a callback for @racket['framework:overwrite-mode-keybindings]
|
||||
via @racket[preferences:add-callback] that calls @method[text% set-overwrite-mode]
|
||||
with @racket[#f] when the preference is set to @racket[#f].
|
||||
}
|
||||
|
||||
@defclass[text:basic% (text:basic-mixin (editor:basic-mixin text%)) ()]{}
|
||||
@defclass[text:line-spacing% (text:line-spacing-mixin text:basic%) ()]{}
|
||||
@defclass[text:hide-caret/selection% (text:hide-caret/selection-mixin text:line-spacing%) ()]{}
|
||||
|
@ -1344,7 +1354,9 @@
|
|||
@defclass[text:wide-snip% (text:wide-snip-mixin text:line-spacing%) ()]{}
|
||||
@defclass[text:standard-style-list% (editor:standard-style-list-mixin text:wide-snip%) ()]{}
|
||||
@defclass[text:input-box% (text:input-box-mixin text:standard-style-list%) ()]{}
|
||||
@defclass[text:keymap% (editor:keymap-mixin text:standard-style-list%) ()]{}
|
||||
@defclass[text:keymap%
|
||||
(text:overwrite-disable-mixin (editor:keymap-mixin text:standard-style-list%))
|
||||
()]{}
|
||||
@defclass[text:return% (text:return-mixin text:keymap%) ()]{}
|
||||
@defclass[text:autowrap% (editor:autowrap-mixin text:keymap%) ()]{}
|
||||
@defclass[text:file% (text:file-mixin (editor:file-mixin text:autowrap%)) ()]{}
|
||||
|
|
|
@ -200,6 +200,7 @@
|
|||
ports<%>
|
||||
input-box<%>
|
||||
autocomplete<%>
|
||||
overwrite-disable<%>
|
||||
|
||||
basic%
|
||||
line-spacing%
|
||||
|
@ -241,7 +242,8 @@
|
|||
crlf-line-endings-mixin
|
||||
ports-mixin
|
||||
input-box-mixin
|
||||
autocomplete-mixin))
|
||||
autocomplete-mixin
|
||||
overwrite-disable-mixin))
|
||||
(define-signature text^ extends text-class^
|
||||
(autocomplete-append-after
|
||||
autocomplete-limit
|
||||
|
|
|
@ -4549,6 +4549,24 @@ designates the character that triggers autocompletion
|
|||
all-string-snips?]))
|
||||
|
||||
(super-new)))
|
||||
|
||||
(define overwrite-disable<%> (interface ()))
|
||||
(define overwrite-disable-mixin
|
||||
(mixin ((class->interface text%)) (overwrite-disable<%>)
|
||||
(inherit set-overwrite-mode)
|
||||
|
||||
;; private field held onto by the object
|
||||
;; because of the weak callback below
|
||||
(define (overwrite-changed-callback p v)
|
||||
(unless v
|
||||
(set-overwrite-mode #f)))
|
||||
|
||||
(preferences:add-callback
|
||||
'framework:overwrite-mode-keybindings
|
||||
overwrite-changed-callback
|
||||
#t)
|
||||
|
||||
(super-new)))
|
||||
|
||||
(define basic% (basic-mixin (editor:basic-mixin text%)))
|
||||
(define line-spacing% (line-spacing-mixin basic%))
|
||||
|
@ -4559,7 +4577,7 @@ designates the character that triggers autocompletion
|
|||
(define wide-snip% (wide-snip-mixin line-spacing%))
|
||||
(define standard-style-list% (editor:standard-style-list-mixin wide-snip%))
|
||||
(define input-box% (input-box-mixin standard-style-list%))
|
||||
(define -keymap% (editor:keymap-mixin standard-style-list%))
|
||||
(define -keymap% (overwrite-disable-mixin (editor:keymap-mixin standard-style-list%)))
|
||||
(define return% (return-mixin -keymap%))
|
||||
(define autowrap% (editor:autowrap-mixin -keymap%))
|
||||
(define file% (file-mixin (editor:file-mixin autowrap%)))
|
||||
|
|
Loading…
Reference in New Issue
Block a user