gdl icon indicating copy to clipboard operation
gdl copied to clipboard

any chance to implement DEFINE_KEY in GDL?

Open brandy125 opened this issue 3 years ago • 2 comments

I had some wonderful key definitions in IDL that helped me a lot to speed up things:

GDL> DEFINE_KEY, 'F10','window,/free',/terminate
% Procedure not found: DEFINE_KEY
% Execution halted at: $MAIN$          
GDL> 

Any chance to implement this in GDL?

brandy125 avatar Oct 18 '22 14:10 brandy125

Why not ! Any suggestion how to do that ?

Just to remember we already have some tricks around :

GDL> help,/key
GDL is using Readline to manage keys shortcuts, few useful listed below.
A summary can be read here : http://www.bigsmoke.us/readline/shortcuts 

Moving in the command line :
  Ctrl-a          : going to the beginning of the line
  Ctrl-e          : going to the end of the line
  Ctrl-u          : removing from here to the beginning of the line
  Ctrl-k          : removing from here to the end of the line
  Ctrl-RightArrow : jumping one word on the right
  Ctrl-LeftArrow  : jumping one word on the left

Moving in the history :
  HELP, /recall       : listing the whole history
  Ctrl-p or UpArrow   : previous entry in history
  Ctrl-n or DownArrow : next entry in history

alaingdl avatar Oct 18 '22 15:10 alaingdl

GDL uses gnu readline, so the equivalent of define_key can (I think) be done externally at this level. Meaning that a define_key.pro doing nothing would suffice to avoid a stop on an undefined procedure. It would be useful to hear if this simple solution is workable. Surely this can be done internally as well using readline functions, a good exercise for a new contributor :smiling_face_with_tear:

GillesDuvert avatar Oct 20 '22 08:10 GillesDuvert