mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-19 04:20:27 +01:00
Changed method to limit the number of History entries loaded
The previous code limited the number of entries that were read into the history array, but the user is expecting a maximum on the number of entries displayed. This can make a little difference in two cases: - if there are duplicate entries (dups are checked for and removed) - if some entries are not strings (unlikely, but not impossible) The new code just stops adding history entries when the user specified count is reached.
This commit is contained in:
committed by
Carlos R. Mafra
parent
bcee010082
commit
5a5216ffb9
@@ -199,14 +199,15 @@ static WMArray *LoadHistory(const char *filename, int max)
|
||||
|
||||
if (plhistory && WMIsPLArray(plhistory)) {
|
||||
num = WMGetPropListItemCount(plhistory);
|
||||
if (num > max)
|
||||
num = max;
|
||||
|
||||
for (i = 0; i < num; ++i) {
|
||||
plitem = WMGetFromPLArray(plhistory, i);
|
||||
if (WMIsPLString(plitem) && WMFindInArray(history, strmatch,
|
||||
WMGetFromPLString(plitem)) == WANotFound)
|
||||
WMGetFromPLString(plitem)) == WANotFound) {
|
||||
WMAddToArray(history, WMGetFromPLString(plitem));
|
||||
if (--max <= 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user