mirror of
https://github.com/Tha14/toxic.git
synced 2024-11-16 23:13:03 +01:00
down arrow returns empty string if at end of history
This commit is contained in:
parent
0013dae552
commit
5187861b69
@ -120,19 +120,21 @@ void add_line_to_hist(const wchar_t *buf, size_t len, wchar_t (*hst)[MAX_STR_SIZ
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* copies history item at hst_pos to buf. Sets pos and len to the len of the history item.
|
/* copies history item at hst_pos to buf. Sets pos and len to the len of the history item.
|
||||||
hst_pos is decremented or incremented depending on key_dir. */
|
hst_pos is decremented or incremented depending on key_dir.
|
||||||
|
|
||||||
|
resets buffer if at end of history */
|
||||||
void fetch_hist_item(wchar_t *buf, size_t *pos, size_t *len, wchar_t (*hst)[MAX_STR_SIZE],
|
void fetch_hist_item(wchar_t *buf, size_t *pos, size_t *len, wchar_t (*hst)[MAX_STR_SIZE],
|
||||||
int hst_tot, int *hst_pos, int key_dir)
|
int hst_tot, int *hst_pos, int key_dir)
|
||||||
{
|
{
|
||||||
if (key_dir == LN_HIST_MV_UP) {
|
if (key_dir == LN_HIST_MV_UP) {
|
||||||
if (--(*hst_pos) < 0) {
|
if (--(*hst_pos) < 0) {
|
||||||
++(*hst_pos);
|
(*hst_pos) = 0;
|
||||||
beep();
|
beep();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (++(*hst_pos) >= hst_tot) {
|
if (++(*hst_pos) >= hst_tot) {
|
||||||
--(*hst_pos);
|
(*hst_pos) = hst_tot;
|
||||||
beep();
|
reset_buf(buf, pos, len);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user