diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-25 08:28:19 +0300 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2020-07-25 08:28:19 +0300 |
commit | a81b43d33c7b37996cd04c527917c3651c5cdc65 (patch) | |
tree | ab94ccdf763ccf9448dc832f2ce0ec4d582f7546 | |
parent | 534ca653e54f417f413a65a9eacd71eb12c51326 (diff) |
App: Maximum number of history items
-rw-r--r-- | src/app.c | 7 |
1 files changed, 6 insertions, 1 deletions
@@ -55,7 +55,7 @@ static const char *dataDir_App_ = "~/.config/lagrange"; | |||
55 | #endif | 55 | #endif |
56 | static const char *prefsFileName_App_ = "prefs.cfg"; | 56 | static const char *prefsFileName_App_ = "prefs.cfg"; |
57 | 57 | ||
58 | static const int HISTORY_MAX = 100; | 58 | static const size_t HISTORY_MAX = 100; |
59 | 59 | ||
60 | struct Impl_App { | 60 | struct Impl_App { |
61 | iCommandLine args; | 61 | iCommandLine args; |
@@ -384,6 +384,11 @@ iBool handleCommand_App(const char *cmd) { | |||
384 | init_HistoryItem(&item); | 384 | init_HistoryItem(&item); |
385 | set_String(&item.url, url); | 385 | set_String(&item.url, url); |
386 | pushBack_Array(&d->history, &item); | 386 | pushBack_Array(&d->history, &item); |
387 | /* Don't make it too long. */ | ||
388 | if (size_Array(&d->history) > HISTORY_MAX) { | ||
389 | deinit_HistoryItem(front_Array(&d->history)); | ||
390 | remove_Array(&d->history, 0); | ||
391 | } | ||
387 | } | 392 | } |
388 | } | 393 | } |
389 | printHistory_App_(d); | 394 | printHistory_App_(d); |