slang-users mailing list

[1999 Date Index] [1999 Thread Index] [Other years]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]

Re: mouse event in SLang_read_line


kikutani@xxxxxxxxxxxxxx <kikutani@xxxxxxxxxxxxxx> wrote:
>But even though a default value is provided at the mini buffer,
>I should press ENTER. I'd be happy if SLang_read_line can recognize
>a mouse click as ENTER key.

After calling 

    int SLang_init_readline (SLang_RLine_Info_Type *rli)
    
use rli->keymap as the keymap argument to the SLkm_define_key
function to bind the mouse key, e.g.,

    static int mouse_cmd (void)
    {
       /* Discard mouse info */
       (void) SLang_getkey ();  
       (void) SLang_getkey ();  
       (void) SLang_getkey ();
       
       (void) SLang_ungetkey ('\r');
    }

        .
	.
    SLang_init_readline (rli);
    SLkm_define_key ("\033[M", mouse_cmd, rli->keymap);

-- 
John E. Davis                   Center for Space Research/AXAF Science Center
617-258-8119                    One Hampshire St., Building NE80-6019
http://space.mit.edu/~davis     Cambridge, MA  02139-4307


[1999 date index] [1999 thread index]
[Thread Prev] [Thread Next]      [Date Prev] [Date Next]