linux-0.11调试教程,move_cursor_relative()函数和变量last_c_pos和变量c_pos的关系
来源:互联网 发布:怎样网络销售 编辑:程序博客网 时间:2024/06/05 14:51
move_cursor_relative()函数出现在update_line ()函数中和rl_redisplay ()函数中。
move_cursor_relative()函数和last_c_pos的值和c_pos的值密切相关!!!
[/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;
{
...
move_vert (current_line);
move_cursor_relative (ofd - old, old);
...
}
move_cursor_relative()的时候
static void
move_cursor_relative (new, data)
int new;
char *data;
{
register int i;
/* It may be faster to output a CR, and then move forwards instead
of moving backwards. */
if (new + 1 < last_c_pos - new)
{
tputs (term_cr, 1, output_character_function);
last_c_pos = 0;
}
if (last_c_pos == new) return;
...
new等于9,而last_c_pos也等于9,所以直接返回。
0x17:0x42374为last_c_pos的地址
第二次调用move_cursor_relative()是在rl_redisplay ()函数中。
c_pos的值为0xa,而last_c_pos的值为0xb,所以需要把光标左移一格:既0x445b1b。
for (in = 0; in < rl_end; in++)
{
c = (unsigned char)the_line[in];
...
if (in == rl_point)
c_pos = out; //注意这里c_pos的值既是rl_point的值既是当前光标的绝对位置既out的值。
...
else
line[out++] = c;
}
- linux-0.11调试教程,move_cursor_relative()函数和变量last_c_pos和变量c_pos的关系
- 函数参数和成员变量的关系
- linux互斥锁和条件变量的关系
- linux-0.11调试教程,task2的参数,copy_strings()函数和create_tables()函数的关系
- 变量变量和变量函数
- 变量和内存的关系
- 引用和变量的关系。
- linux中创建和删除变量,sh与变量的作用范围之间的关系
- linux-0.11调试教程,con_init函数和右上角的EGAc
- 局部变量、全局变量和静态变量的关系。
- kotlin的变量和函数
- 变量名和地址的关系探讨
- 变量名和地址的关系探讨
- 变量名和地址之间的关系
- 变量前缀和存储位置的关系
- 数组变量和指针的关系
- 变量声明和定义的关系
- 变量声明和定义的关系
- Bone Collector II
- 理解Proc 文件系统
- gcc命令
- sizeof操作符
- Python Tika guide
- linux-0.11调试教程,move_cursor_relative()函数和变量last_c_pos和变量c_pos的关系
- 360手机卫士 IPHONE APP 弹窗求声援
- 周鸿祎,你怕啥?
- 互联网将对中国社会产生更为深远影响
- Windows Vista 和 Windows Server 2008 中,TCP/IP 默认动态端口范围已更改
- tomcat环境变量的配置
- 分布式文件系统HDFS设计
- poj2488 深度优先搜索
- HBase设计:看上去很美