コード例 #1
0
static void sig_sigtstp (int sig) /*{{{*/
{
   (void) sig;
   SLsig_block_signals ();
   reset_tty ();
   kill(getpid(),SIGSTOP);
   init_tty ();

   if (Use_SLang_Readline == 0)
     {
#ifdef HAVE_GNU_READLINE
        rl_refresh_line (0,0);
#endif
     }
   else
     {
        if (Active_Rline_Info != NULL)
          {

             SLrline_set_display_width (Active_Rline_Info, SLtt_Screen_Cols);
             SLrline_redraw (Active_Rline_Info);
          }
     }

   SLsig_unblock_signals ();
}
コード例 #2
0
ファイル: readline.c プロジェクト: balagopalraj/clearlinux
static void sig_sigtstp (int sig)
{
   (void) sig;
   SLsig_block_signals ();
   reset_tty ();
   kill(getpid(),SIGSTOP);
   init_tty ();
   if (Active_Rline_Info != NULL)
     {
	SLrline_set_display_width (Active_Rline_Info, SLtt_Screen_Cols);
	SLrline_redraw (Active_Rline_Info);
     }
   SLsig_unblock_signals ();
}
コード例 #3
0
ファイル: readline.c プロジェクト: hankem/S-Lang
static void suspend_slsh (void)
{
    reset_tty ();
    (void) SLang_run_hooks ("slsh_readline_suspend_before_hook", 0);
    kill (0, SIGSTOP);
    (void) SLang_run_hooks ("slsh_readline_suspend_after_hook", 0);
    init_tty ();
    if (Active_Rline_Info != NULL)
    {
        SLsig_block_signals ();
        SLrline_set_display_width (Active_Rline_Info->rli, SLtt_Screen_Cols);
        SLrline_redraw (Active_Rline_Info->rli);
        SLsig_unblock_signals ();
    }
}
コード例 #4
0
ファイル: slrline.c プロジェクト: GalaxyTab4/workbench
static int rl_complete (SLrline_Type *rli)
{
   char *line;
   unsigned int i, n, nbytes;
   char **strings, *str0, ch0;
   int start_point, delta;
   SLang_Array_Type *at;
   SLang_Name_Type *completion_callback;
   SLang_Name_Type *list_completions_callback;

   if (NULL == (completion_callback = rli->completion_callback))
     {
	completion_callback = Default_Completion_Callback;
	if (completion_callback == NULL)
	  return SLrline_ins (rli, "\t", 1);
     }
   if (NULL == (list_completions_callback = rli->list_completions_callback))
     list_completions_callback = Default_List_Completions_Callback;

   if (NULL == (line = SLrline_get_line (rli)))
     return -1;

   if ((-1 == SLang_start_arg_list ())
       || (-1 == SLang_push_string (line))
       || (-1 == SLang_push_int (rli->point))
       || (-1 == SLang_end_arg_list ())
       || (-1 == SLexecute_function (completion_callback)))
     {
	SLfree (line);
	return -1;
     }

   SLfree (line);

   if (-1 == SLang_pop_int (&start_point))
     return -1;
   
   if (start_point < 0)
     start_point = 0;

   if (-1 == SLang_pop_array_of_type (&at, SLANG_STRING_TYPE))
     return -1;

   strings = (char **) at->data;
   n = at->num_elements;
   
   if (n == 0)
     {
	SLang_free_array (at);
	return 0;
     }

   if ((n != 1) && (list_completions_callback != NULL))
     {
	if ((-1 == SLang_start_arg_list ())
	    || (-1 == SLang_push_array (at, 0))
	    || (-1 == SLang_end_arg_list ())
	    || (-1 == SLexecute_function (list_completions_callback)))
	  {
	     SLang_free_array (at);
	     return -1;
	  }
	(void) SLrline_redraw (rli);
     }
	
   str0 = strings[0];
   nbytes = 0;
   while (0 != (ch0 = str0[nbytes]))
     {
	for (i = 1; i < n; i++)
	  {
	     char ch1 = strings[i][nbytes];
	     if (ch0 != ch1)
	       break;
	  }
	if (i != n)
	  break;
	nbytes++;
     }

   delta = start_point - rli->point;
   if (delta < 0)
     {
	(void) SLrline_move (rli, delta);
	delta = -delta;
     }
   (void) SLrline_del (rli, (unsigned int) delta);
   (void) SLrline_ins (rli, str0, nbytes);

   /* How should the completion be ended?
    *   "foo/     -->  "foo/
    *   "foo/bar  -->  "foo/bar"
    *   "foo      -->  "foo"
    *   foo       -->  fooSPACE
    *   foo/bar   -->  fooSPACE
    */
   if ((n == 1) 
       && nbytes && (str0[nbytes-1] != '/') && (str0[nbytes-1] != '\\'))
     {
	char qch = ' ';

	if (start_point > 0)
	  {
	     ch0 = rli->buf[start_point-1];
	     if ((ch0 == '"') || (ch0 == '\''))
	       qch = ch0;
	  }
	if (qch != 0)
	  (void) SLrline_ins (rli, &qch, 1);
     }

   SLang_free_array (at);
   return 0;
}
コード例 #5
0
ファイル: slrline.c プロジェクト: GalaxyTab4/workbench
static int rl_redraw (SLrline_Type *This_RLI)
{
   SLrline_redraw (This_RLI);
   return 0;
}