From 7018d0570376322fae8817539674937c94c0d36e Mon Sep 17 00:00:00 2001 From: slava Date: Mon, 28 Aug 2006 04:24:05 +0000 Subject: [PATCH] Fix X11 stack height bug, S+click in editor to extend selection --- TODO.FACTOR.txt | 2 +- library/ui/gestures.factor | 2 +- library/ui/text/commands.factor | 9 ++++++--- library/ui/x11/ui.factor | 3 ++- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/TODO.FACTOR.txt b/TODO.FACTOR.txt index 7c7648807a..7706b6be47 100644 --- a/TODO.FACTOR.txt +++ b/TODO.FACTOR.txt @@ -28,6 +28,7 @@ + ui: +- x11.app has a problem with A+ keys - status bar showing number of words needing a recompile - UI dataflow visualizer - services do not launch if factor not running @@ -37,7 +38,6 @@ - only redraw visible lines - more efficient multi-line inserts - editor should support stream output protocol - - s+click - double/triple click - autoscroll - undo and redo diff --git a/library/ui/gestures.factor b/library/ui/gestures.factor index 5f4736c93a..5665a82df9 100644 --- a/library/ui/gestures.factor +++ b/library/ui/gestures.factor @@ -129,7 +129,7 @@ V{ } clone hand-buttons set-global : modifier ( mod modifiers -- seq ) [ second swap bitand 0 > ] subset-with - [ first ] map f like ; + [ first ] map prune f like ; : drag-loc ( -- loc ) hand-loc get-global hand-click-loc get-global v- ; diff --git a/library/ui/text/commands.factor b/library/ui/text/commands.factor index 8646bea4c5..6f27af2ff2 100644 --- a/library/ui/text/commands.factor +++ b/library/ui/text/commands.factor @@ -4,10 +4,12 @@ IN: gadgets-text USING: gadgets gadgets-controls kernel models namespaces sequences ; -: editor-mouse-down ( editor -- ) +: editor-extend-selection ( editor -- ) dup request-focus - dup - dup editor-caret click-loc + dup editor-caret click-loc ; + +: editor-mouse-down ( editor -- ) + dup editor-extend-selection dup editor-mark click-loc ; : editor-mouse-drag ( editor -- ) @@ -68,6 +70,7 @@ editor { { f "Insert newline" T{ key-down f f "RETURN" } [ "\n" swap user-input ] } { f "Insert newline" T{ key-down f { S+ } "RETURN" } [ "\n" swap user-input ] } { f "Position caret" T{ button-down } [ editor-mouse-down ] } + { f "Extend selection" T{ button-down f { S+ } } [ editor-extend-selection ] } { f "Start selection" T{ drag } [ editor-mouse-drag ] } { f "Focus editor" T{ gain-focus } [ focus-editor ] } { f "Unfocus editor" T{ lose-focus } [ unfocus-editor ] } diff --git a/library/ui/x11/ui.factor b/library/ui/x11/ui.factor index 53d4ec210d..2dcc599da6 100644 --- a/library/ui/x11/ui.factor +++ b/library/ui/x11/ui.factor @@ -26,6 +26,7 @@ M: world configure-event { S+ HEX: 1 } { C+ HEX: 4 } { A+ HEX: 8 } + { A+ HEX: 10 } } ; : key-codes @@ -90,7 +91,7 @@ M: world key-up-event world-focus swap key-event>gesture dup [ dup [ swap handle-gesture drop ] [ 2drop ] if ] [ - 2drop + 3drop ] if ; : mouse-event-loc ( event -- loc )