mirror of
https://github.com/davatorium/rofi.git
synced 2024-11-25 13:55:34 -05:00
Fix history becoming stuck.
This commit is contained in:
parent
fb56250d18
commit
cba893f500
1 changed files with 4 additions and 1 deletions
|
@ -58,13 +58,16 @@ static void __history_write_element_list ( FILE *fd, _element **list, unsigned i
|
||||||
// Sort the list before writing out.
|
// Sort the list before writing out.
|
||||||
qsort ( list, length, sizeof ( _element* ), __element_sort_func );
|
qsort ( list, length, sizeof ( _element* ), __element_sort_func );
|
||||||
|
|
||||||
|
// Get minimum index.
|
||||||
|
int min_value = list[length-1]->index;
|
||||||
|
|
||||||
// Set the max length of the list.
|
// Set the max length of the list.
|
||||||
length = ( length > HISTORY_MAX_ENTRIES ) ? HISTORY_MAX_ENTRIES : length;
|
length = ( length > HISTORY_MAX_ENTRIES ) ? HISTORY_MAX_ENTRIES : length;
|
||||||
|
|
||||||
// Write out entries.
|
// Write out entries.
|
||||||
for ( unsigned int iter = 0; iter < length; iter++ )
|
for ( unsigned int iter = 0; iter < length; iter++ )
|
||||||
{
|
{
|
||||||
fprintf ( fd, "%ld %s\n", list[iter]->index, list[iter]->name );
|
fprintf ( fd, "%ld %s\n", list[iter]->index-min_value, list[iter]->name );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue