- [PATCH 1/2 v2] hv: shell: improve console to buffer history cmds
Re: [PATCH 1/2 v2] hv: shell: improve console to buffer history cmds
[Cao, Minggui] there is a rule for history cmds: it is not a loop, if press up or
[Cao, Minggui] it is a ring buffer, if the buffer is not fullUnderstood. But we don't need to check it.
filled and full, the index shall be Handled differently. For
example, if total buffer size 8, now just buffered 4, the index
shall Be just in 3-0;
For key_UP, it can do like:
If ( --p_shell->selected_index < 0 )
p_shell->selected_index += p_shell->total_buffered_cmds;
down key always, it will go up/down to the first or last command as the end one,
so the user will know the history is to end.
1. if the ring buffer not full, up key will go until 0 index, then it will not
change any more.
2. if the ring buffer is full, up key will also go to an end index too and
will not change any more then.
Why we need this kind of difference? I am not convinced/
I updated this patch to V3, and sent it out, combine "input_line" and
"buffered_cmds" as "buffered_line", and simplify some logic as your comments.
Could you have a review?
Join firstname.lastname@example.org to automatically receive all group messages.