]> gitweb.factorcode.org Git - factor.git/commitdiff
listener: don't activate the ctrl-break handler by default
authorAlexander Iljin <ajsoft@yandex.ru>
Wed, 24 Aug 2016 00:27:07 +0000 (03:27 +0300)
committerJohn Benediktsson <mrjbq7@gmail.com>
Tue, 1 Nov 2016 23:53:01 +0000 (16:53 -0700)
To activate the ctrl-break handler, add the following code to your
.factor-rc:
USING: listener namespaces ; t handle-ctrl-break set-global

basis/listener/listener.factor

index ba9a7546ba118e429cd76815dbe92bf573e254dd..ea7d0075179fcedb71b7794019e68cc101ec73c6 100644 (file)
@@ -24,8 +24,16 @@ H{
 M: object prompt.
     nip prompt-style get-global format bl flush ;
 
+SYMBOL: handle-ctrl-break
+
+: maybe-enable-ctrl-break ( -- )
+    handle-ctrl-break get-global [ enable-ctrl-break ] when ;
+
 : with-ctrl-break ( quot -- )
-    enable-ctrl-break
+    maybe-enable-ctrl-break
+    ! Always call disable-ctrl-break, no matter what handle-ctrl-break
+    ! says: it might've been changed just now by the user in the Listener.
+    ! It's a no-op if it's not enabled.
     [ disable-ctrl-break ] [ ] cleanup ; inline
 
 : parse-lines-interactive ( lines -- quot/f )