linux-0.11调试教程,move

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

staticupdate_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 voidmove_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

相关文章:

你感兴趣的文章:

标签云: