linux-0.11调试教程,update_line()函数分析,和update_line()函数的数据模型
来源:互联网 发布:ios 淘宝详情页 编辑:程序博客网 时间:2024/05/18 01:16
如何由old变成new的?答案在最后!
例子一:
[/root]# c --> [/root]# ac 按下a键, length为5
具体过程为:[/root]# c --> [/root]# a --> [/root]# ac
static
update_line (old, new, current_line)
register char *old, *new;
int current_line;
{ ....
else
{
/* At the end of a line the characters do not have to
be "inserted". They can just be placed on the screen. */
output_some_chars (nfd, lendiff);
last_c_pos += lendiff;
}
/* Copy (new) chars to screen from first diff to last match. */
if (((nls - nfd) - lendiff) > 0)
{
output_some_chars (&nfd[lendiff], ((nls - nfd) - lendiff));
last_c_pos += ((nls - nfd) - lendiff);
}
....
}
output_some_chars (nfd, lendiff);时:
output_some_chars (&nfd[lendiff], ((nls - nfd) - lendiff));时:
可见nfd为0x59c15,lendiff为1,nls为0x59c17,ne为0x59c17
(ofd为0x63415,ols和oe都为0x63416)
/* if (len (new) > len (old)) */
lendiff = (nls - nfd) - (ols - ofd); /* lendiff = 2-1=1
例子2:下面的对应下面的图,退格键时的6个位置
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 /*产生字符0x50315b1b*/
/* Copy (new) chars to screen from first diff to last match */
if ((nls - nfd) > 0)
{
output_some_chars (nfd, (nls - nfd)); /*产生字符0x63*/
last_c_pos += (nls - nfd);
}
}
[/root]# abc --> [/root]# ac 按下退格键,length为b
delete_chars (-lendiff);时
output_some_chars()时
lendiff = (nls - nfd) - (ols - ofd);
lendiff = 10 - 15 = -5;
先删除5个字符,delete_chars (-lendiff);/*产生字符0x50355b1b*/,会调用内核的csi_P()函数。
然后再打印出10个字符buggy say,把le-buggy i覆盖掉!!!
既调用output_some_chars (nfd, (nls - nfd));。
static void delete_char(int currcons)
{
int i;
unsigned short * p = (unsigned short *) pos;
if (x>=video_num_columns)
return;
i = x;
while (++i < video_num_columns) {
*p = *(p+1);
p++;
}
*p = video_erase_char;
}
static void csi_P(int currcons, unsigned int nr)
{
if (nr > video_num_columns)
nr = video_num_columns;
else if (!nr)
nr = 1;
while (nr--)
delete_char(currcons);
}
- linux-0.11调试教程,update_line()函数分析,和update_line()函数的数据模型
- linux-0.11调试教程,update_line()函数中按下退格键时对应的缓冲区
- linux-0.11调试教程,update_line()函数中的按下字符键对应的缓冲区
- linux-0.11调试教程,终端的初始化init_terminal_io ()函数分析
- linux-0.11调试教程,con_init函数和右上角的EGAc
- linux-0.11调试教程,fflush()函数实现分析和FILE类型定义
- linux-0.11调试教程,task2的参数,copy_strings()函数和create_tables()函数的关系
- linux-0.11调试教程,rl_insert_text函数和the_line[]数组
- linux-0.11调试教程,move_cursor_relative()函数和变量last_c_pos和变量c_pos的关系
- linux-0.11调试教程,fwrite ()函数的作用
- linux-0.11调试教程,readline ()函数中,ECHO的关闭和开启
- linux-0.11调试教程,rl_dispatch ()函数调用函数的参数的个数
- linux-0.11调试教程,task3(04),sa_restore函数
- linux-0.11调试教程,bash-1.12源代码分析readline.a和termcap.a的连接
- 函数调试的反汇编分析
- Linux lock_kernel()函数的分析。
- linux的i2c驱动中的函数和数据结构的分析
- 嵌入式linux的中断函数实现和分析
- IOS手势操作:点击+滑动
- JAVA 抽象类
- SQL Server 2005 不允许远程连接解决方法
- LINUX内核编译选项-1
- 五步评估Ad Hoc报表工具
- linux-0.11调试教程,update_line()函数分析,和update_line()函数的数据模型
- hdu1194
- memcached完全剖析–1. memcached的基础
- BroadcastReceiver(一)
- 用Registry Trash Keys Finder删除Total Uninstall注册表中无用信息,解决注册时必须强制网络访问问题
- LINUX内核编译选项-2
- 训练指南 uva 11729 重载运算符比较vector大小
- 阿里云JAVA安装
- LINUX内核编译选项-3