Пример #1
0
/*
 * Handle backspace key
 */
static void rl_key_backspace (void)
{
    if (rl_tab_state > 0)
        rl_tab_cancel ();
    if (rl_left (1))
        rl_key_delete ();
}
Пример #2
0
static int rl_delbol (SLrline_Type *This_RLI)
{
   while (This_RLI->point)
     {
	rl_left (This_RLI);
	rl_del(This_RLI);
     }
   return 0;
}
Пример #3
0
static int rl_bdel (SLrline_Type *This_RLI)
{
   if (This_RLI->point)
     {
	rl_left (This_RLI);
	rl_del(This_RLI);
     }
   return 0;
}
Пример #4
0
/*
 * Handle tab key - continue tabbing backwards
 */
static void rl_key_shifttab (void)
{
    str_s str = { NULL, 0, 0 };
    const char *display;
    int off;
    UWORD columns;

    if (rl_tab_state <= 0)
    {
        printf ("\a");
        return;
    }

    rl_linecompress (&rl_temp, rl_tab_pos, rl_ucspos);
    rl_tab_cont = rl_tab_getprev (&rl_temp);
    rl_left (rl_tab_common);

    for ( ; rl_tab_len; rl_tab_len--)
        rl_delete ();
    if (!rl_tab_cont)
    {
        printf ("\a");
        rl_tab_state = 0;
        rl_recheck (TRUE);
        return;
    }

    str.txt = rl_tab_alias ? rl_tab_alias->alias : rl_tab_cont->nick;
    str.len = strlen (str.txt);
    for (off = 0; off < str.len; )
    {
        wint_tt ucs = ConvGetUTF8 (&str, &off);
        rl_analyze_ucs (ucs, &display, &columns);
        rl_insert_basic (ucs, s_sprintf ("%s%s%s", rl_colon.txt, display, rl_coloff.txt),
                         strlen (display) + rl_colon.len + rl_coloff.len, columns & 0xff);
        rl_tab_len++;
    }
    rl_left (rl_tab_len - rl_tab_common);
    rl_recheck (TRUE);
}
Пример #5
0
/*
 * Handle left arrow key
 */
static void rl_key_left (void)
{
    if (!rl_ucspos)
        return;

    if (rl_tab_state > 0)
    {
        if (rl_tab_common)
            rl_tab_common--;
        else
            rl_tab_cancel();
    }
    rl_left (1);
}
Пример #6
0
int SLrline_move (SLrline_Type *rli, int n)
{
   if (rli == NULL)
     return -1;

   if (n < 0)
     {
	n = -n;
	while (n && rli->point)
	  {
	     (void) rl_left (rli);
	     n--;
	  }
	return 0;
     }
   
   while (n && (rli->point != rli->len))
     {
	(void) rl_right (rli);
	n--;
     }
   return 0;
}
Пример #7
0
/*
 * Cancel the current tab contact
 */
static void rl_tab_cancel (void)
{
    str_s str = { NULL, 0, 0 };
    const char *display;
    int i, off;
    UWORD columns;
    
    if (rl_tab_state <= 0)
       return;
    rl_left (rl_tab_common);
    for ( ; rl_tab_len; rl_tab_len--)
        rl_delete ();
    str.txt = rl_tab_alias ? rl_tab_alias->alias : rl_tab_cont->nick;
    str.len = strlen (str.txt);
    for (off = i = 0; off < str.len && i < rl_tab_common; i++)
    {
        wint_tt ucs = ConvGetUTF8 (&str, &off);
        rl_analyze_ucs (ucs, &display, &columns);
        rl_insert_basic (ucs, display, strlen (display), columns & 0xff);
    }
    rl_tab_state = 0;
    rl_recheck (TRUE);
}
Пример #8
0
/*
 * Handle tab key - start or continue tabbing
 */
static void rl_key_tab (void)
{
    str_s str = { NULL, 0, 0 };
    strc_t ins;
    const char *display;
    int i, off;
    UWORD columns;

    if (rl_tab_state == -1)
    {
        rl_insert (9);
        return;
    }

    if (!rl_tab_state)
    {
        if (!rl_ucs.len)
        {
            rl_insert ('m');
            rl_insert ('s');
            rl_insert ('g');
            rl_insert (' ');
        }
        for (i = 0; i < rl_ucspos; i++)
        {
            if (rl_ucs_at (&rl_ucs, i) == ' ')
            {
                rl_tab_index = 0;
                rl_tab_state = 1;
                rl_tab_pos = i + 1;
                rl_linecompress (&rl_temp, rl_tab_pos, rl_ucspos);
                if ((rl_tab_cont = rl_tab_getnext (&rl_temp)))
                {
                    ins = ConvTo (COLQUOTE, ENC(enc_loc));
                    s_init (&rl_colon, "", 0);
                    s_catn (&rl_colon, ins->txt, ins->len);
                    ins = ConvTo (COLNONE, ENC(enc_loc));
                    s_init (&rl_coloff, "", 0);
                    s_catn (&rl_coloff, ins->txt, ins->len);

                    while (rl_ucspos > rl_tab_pos)
                        rl_left (1), rl_tab_len++;
                    rl_tab_common = rl_tab_len;
                    break;
                }
            }
        }
        if (!rl_tab_state)
        {
            printf ("\a");
            return;
        }
    }
    else
    {
        rl_linecompress (&rl_temp, rl_tab_pos, rl_ucspos);
        rl_tab_cont = rl_tab_getnext (&rl_temp);
        rl_left (rl_tab_common);
    }
    for ( ; rl_tab_len; rl_tab_len--)
        rl_delete ();
    if (!rl_tab_cont)
    {
        printf ("\a");
        rl_tab_state = 0;
        rl_recheck (TRUE);
        return;
    }

    str.txt = rl_tab_alias ? rl_tab_alias->alias : rl_tab_cont->nick;
    str.len = strlen (str.txt);
    for (off = 0; off < str.len; )
    {
        wint_tt ucs = ConvGetUTF8 (&str, &off);
        rl_analyze_ucs (ucs, &display, &columns);
        rl_insert_basic (ucs, s_sprintf ("%s%s%s", rl_colon.txt, display, rl_coloff.txt),
                         strlen (display) + rl_colon.len + rl_coloff.len, columns & 0xff);
        rl_tab_len++;
    }
    rl_left (rl_tab_len - rl_tab_common);
    rl_recheck (TRUE);
}