Re: [Factor-talk] Why does editor pass some handled gestures?

2015-08-19 Thread Georg Simon
Thank you. Sorry for the wrong syntax.

Now it seems to me that editor receives both C+c and copy-action
when I type C+c.

With http://paste.factorcode.org/paste?id=3590#1634 I see that
- UP is not handled and passed to parent as I would expect
- DELETE is handled and not passed to parent as I would expect but
- C+cis handled AND passed to parent.

The last behaviour is cumbersome and I do not understand it's purpose.


Am Wed, 19 Aug 2015 09:42:30 +0200
schrieb Jon Harper jon.harpe...@gmail.com:

 Hi Georg,
 You have 2 problems in
 IN: scratchpad T{ key-down f f C+c } editor get-gesture-handler .
 f
 
 First, see
 http://docs.factorcode.org/content/article-keyboard-gestures.html for
 the correct syntax: IN: scratchpad T{ key-down f { C+ } l }
 editor get-gesture-handler . [ \ select-line invoke-command ]
 
 Second, copy paste has a mechanism to work as C+c on linux/windows and
 Cmd+c on mac: see
 http://docs.factorcode.org/content/article-action-gestures.html and
 http://docs.factorcode.org/content/word-action-modifier,ui.gestures.html
 (The docs are a little light on this point though..)
 IN: scratchpad \ copy-action editor get-gesture-handler .
 [ \ com-copy invoke-command ]
 
 Hope that helps!
 Jon
 
 On Wed, Aug 19, 2015 at 7:01 AM, Georg Simon georg.si...@auge.de
 wrote:
 
  Thank you.
 
  What you describe is what I use. And I do not want an editor that
  always passes gestures.
  But now it comes to C+c, C+v, C+x, C+y, and C+z.
  There is no gesture-handler in editor for them:
 
  IN: scratchpad T{ key-down f f C+c } editor
  get-gesture-handler . f
 
  But they work. They work as expected as copy, paste, cut, redo, and
  undo.
  And they are documented in
  http://docs.factorcode.org/content/article-gadgets-editors-commands.html
 
  How can I detect in my program that C+c works but for instance C+d
  not?
 
  Am Tue, 18 Aug 2015 07:37:24 -0700
  schrieb John Benediktsson mrj...@gmail.com:
 
   If you look at the docs for handle-gesture, it says Outputs f if
   the gesture was handled, and t if the gesture should be passed on
   to the gadget's parent..
  
  
  http://docs.factorcode.org/content/word-handle-gesture,ui.gestures.html
  
   I would guess it's because your editor is wrapped by a main-gadget
   and any actions that are ui.commands are handled by the editor
   and not passed to the parent gadget.
  
  
  
  https://github.com/slavapestov/factor/blob/master/basis/ui/gadgets/editors/editors.factor#L425
  
   So, left is handled (meaning ``f`` don't pass to parent):
  
   IN: scratchpad T{ key-down f f LEFT } editor
   get-gesture-handler . [ \ previous-character invoke-command ]
  
   IN: scratchpad T{ key-down f f LEFT } editor
   handle-gesture . f
  
   But, up is not (because it isn't a multiline-editor):
  
   IN: scratchpad T{ key-down f f UP } editor
   get-gesture-handler . f
  
   IN: scratchpad T{ key-down f f UP } editor
   handle-gesture . t
  
   If you want an editor that always passes gestures, then...
  
   TUPLE: my-editor  editor ;
  
   : my-editor ( -- editor )
   my-editor new-editor ;
  
   M: my-editor handle-gesture call-next-method drop t ;
  
   Hope that helps!
  
  
  
  
   On Mon, Aug 17, 2015 at 10:55 PM, Georg Simon
   georg.si...@auge.de wrote:
  
Ubuntu 14.04.2 LTS
Factor 0.98 x86.64 (1565, heads/master-0-g592764d, Wed Dec 24
04:52:05 2014) [GCC 4.8.2] on linux
   
In the test program http://paste.factorcode.org/paste?id=3590
BACKSPACE and DELETE
don't appear in the terminal as they are handled by editor.
UP and DOWN
appear in the terminal as they are not handled by editor.
But C+c and C+v
appear in the terminal although they are handled by editor.
   
In my application I can catch them separately when I know they
are handled by editor. But is there a better way?
   
   
   
  --
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk
   
 
 
 
  --
  ___
  Factor-talk mailing list
  Factor-talk@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/factor-talk
 


--
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk


Re: [Factor-talk] Why does editor pass some handled gestures?

2015-08-19 Thread Jon Harper
Hi Georg,
You have 2 problems in
IN: scratchpad T{ key-down f f C+c } editor get-gesture-handler .
f

First, see http://docs.factorcode.org/content/article-keyboard-gestures.html
for the correct syntax:
IN: scratchpad T{ key-down f { C+ } l } editor get-gesture-handler .
[ \ select-line invoke-command ]

Second, copy paste has a mechanism to work as C+c on linux/windows and
Cmd+c on mac: see
http://docs.factorcode.org/content/article-action-gestures.html and
http://docs.factorcode.org/content/word-action-modifier,ui.gestures.html
(The docs are a little light on this point though..)
IN: scratchpad \ copy-action editor get-gesture-handler .
[ \ com-copy invoke-command ]

Hope that helps!
Jon

On Wed, Aug 19, 2015 at 7:01 AM, Georg Simon georg.si...@auge.de wrote:

 Thank you.

 What you describe is what I use. And I do not want an editor that
 always passes gestures.
 But now it comes to C+c, C+v, C+x, C+y, and C+z.
 There is no gesture-handler in editor for them:

 IN: scratchpad T{ key-down f f C+c } editor get-gesture-handler .
 f

 But they work. They work as expected as copy, paste, cut, redo, and
 undo.
 And they are documented in
 http://docs.factorcode.org/content/article-gadgets-editors-commands.html

 How can I detect in my program that C+c works but for instance C+d not?

 Am Tue, 18 Aug 2015 07:37:24 -0700
 schrieb John Benediktsson mrj...@gmail.com:

  If you look at the docs for handle-gesture, it says Outputs f if the
  gesture was handled, and t if the gesture should be passed on to the
  gadget's parent..
 
 
 http://docs.factorcode.org/content/word-handle-gesture,ui.gestures.html
 
  I would guess it's because your editor is wrapped by a main-gadget
  and any actions that are ui.commands are handled by the editor and
  not passed to the parent gadget.
 
 
 
 https://github.com/slavapestov/factor/blob/master/basis/ui/gadgets/editors/editors.factor#L425
 
  So, left is handled (meaning ``f`` don't pass to parent):
 
  IN: scratchpad T{ key-down f f LEFT } editor
  get-gesture-handler . [ \ previous-character invoke-command ]
 
  IN: scratchpad T{ key-down f f LEFT } editor handle-gesture .
  f
 
  But, up is not (because it isn't a multiline-editor):
 
  IN: scratchpad T{ key-down f f UP } editor
  get-gesture-handler . f
 
  IN: scratchpad T{ key-down f f UP } editor handle-gesture .
  t
 
  If you want an editor that always passes gestures, then...
 
  TUPLE: my-editor  editor ;
 
  : my-editor ( -- editor )
  my-editor new-editor ;
 
  M: my-editor handle-gesture call-next-method drop t ;
 
  Hope that helps!
 
 
 
 
  On Mon, Aug 17, 2015 at 10:55 PM, Georg Simon georg.si...@auge.de
  wrote:
 
   Ubuntu 14.04.2 LTS
   Factor 0.98 x86.64 (1565, heads/master-0-g592764d, Wed Dec 24
   04:52:05 2014) [GCC 4.8.2] on linux
  
   In the test program http://paste.factorcode.org/paste?id=3590
   BACKSPACE and DELETE
   don't appear in the terminal as they are handled by editor.
   UP and DOWN
   appear in the terminal as they are not handled by editor.
   But C+c and C+v
   appear in the terminal although they are handled by editor.
  
   In my application I can catch them separately when I know they are
   handled by editor. But is there a better way?
  
  
  
 --
   ___
   Factor-talk mailing list
   Factor-talk@lists.sourceforge.net
   https://lists.sourceforge.net/lists/listinfo/factor-talk
  



 --
 ___
 Factor-talk mailing list
 Factor-talk@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/factor-talk

--
___
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk