From 8249adc3f6b29a60a78a7e6ac6a1733b3a0fc6b1 Mon Sep 17 00:00:00 2001 From: slava Date: Tue, 5 Sep 2006 23:02:34 +0000 Subject: [PATCH] Fix a compiler bug, keypad ENTER now inserts a newline --- TODO.FACTOR.txt | 4 ---- library/compiler/optimizer/class-infer.factor | 13 +++++++++---- library/ui/text/commands.factor | 1 + 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 954248b57f..10418257aa 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -1,11 +1,7 @@ + 0.85: -- ENTER key on keypad should do something - pane output in UI should use less memory - signal 4 on datastack underflow on mac intel?? -- why is a 'null' type inferred for the output of foo in - : foo f ; - : bar foo 4 4 = and ; - faster I/O - buffer-ptr should be an alien - faster Unix stream-read# diff --git a/library/compiler/optimizer/class-infer.factor b/library/compiler/optimizer/class-infer.factor index 45c8c2f292..e949cf9059 100644 --- a/library/compiler/optimizer/class-infer.factor +++ b/library/compiler/optimizer/class-infer.factor @@ -155,7 +155,8 @@ DEFER: (infer-classes) ] 2each ; : merge-value-class ( # nodes -- class ) - [ swap node-class# ] map-with null [ class-or ] reduce ; + [ swap node-class# ] map-with + null [ class-or ] reduce ; : annotate-merge ( nodes values -- ) dup length @@ -164,9 +165,13 @@ DEFER: (infer-classes) : merge-children ( node -- ) dup node-successor dup #merge? [ - node-out-d - >r node-children [ last-node ] map r> - annotate-merge + over node-children empty? [ + 2drop + ] [ + node-out-d + >r node-children [ last-node ] map r> + annotate-merge + ] if ] [ 2drop ] if ; diff --git a/library/ui/text/commands.factor b/library/ui/text/commands.factor index 32059cb8ac..1e3d0c3dd8 100644 --- a/library/ui/text/commands.factor +++ b/library/ui/text/commands.factor @@ -71,6 +71,7 @@ editor { "Editing" { "Insert newline" T{ key-down f f "RETURN" } [ "\n" swap user-input ] } { "Insert newline" T{ key-down f { S+ } "RETURN" } [ "\n" swap user-input ] } + { "Insert newline" T{ key-down f "ENTER" } [ "\n" swap user-input ] } { "Delete next character" T{ key-down f f "DELETE" } [ T{ char-elt } editor-delete ] } { "Delete previous character" T{ key-down f f "BACKSPACE" } [ T{ char-elt } editor-backspace ] } { "Delete previous word" T{ key-down f { C+ } "DELETE" } [ T{ word-elt } editor-delete ] }