linux-0.11调试教程,退格键的调用过程(2)

[/root]# ac
[/root]# c

下面的调用过程对应上面的情况,光标位于字符串的中间的时候,非末尾的情况。


rl_redisplay ()

    update_line ()
        delete_chars ()

       output_some_chars ()


/* Delete COUNT characters from the display line. */

static
delete_chars (count)
     int count;
{
  if (count > screenwidth)
    return;

  if (term_DC && *term_DC)
    {
      char *tgoto (), *buffer;
      buffer = tgoto (term_DC, 0, count);
      tputs (buffer, 1, output_character_function);
    }
  else
    {
      if (term_dc && *term_dc)
    while (count--)
      tputs (term_dc, 1, output_character_function);
    }

}



__iowrite处下断点时的情形:length为0xb




附上涉及的代码:

static
update_line (old, new, current_line)
     register char *old, *new;
     int current_line;
{


...


  else                /* Delete characters from line. */
    {
      /* If possible and inexpensive to use terminal deletion, then do so. */
      if (term_dc && (2 * (ne - nfd)) >= (-lendiff))
    {
      if (lendiff)
        delete_chars (-lendiff); /* delete (diff) characters */

      /* Copy (new) chars to screen from first diff to last match */
      if ((nls - nfd) > 0)
        {
          output_some_chars (nfd, (nls - nfd));
          last_c_pos += (nls - nfd);
        }
    }
...
}


[/root]# c    -->    [/root]# ac        按下a键, length5     

 [/root]# ac   -->     [/root]# abc  按下b键,length5


[/root]# abc   -->      [/root]# ac  按下退格键,lengthb


  [/root]# abc   -->      [/root]# abc 按下左方向键    length3

 [/root]# abc    -->       [/root]# abc 按下左方向键  

 [/root]# abc    -->       [/root]# bc 按下退格键 length7


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值