D20383: [KRunner] Avoid writing history if addToHistory is idempotent
This revision was automatically updated to reflect the committed changes. Closed by commit R120:9686c05c7226: [KRunner] Avoid writing history if addToHistory is idempotent (authored by bruns). REPOSITORY R120 Plasma Workspace CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D20383?vs=55793&id=55815 REVISION DETAIL https://phabricator.kde.org/D20383 AFFECTED FILES krunner/view.cpp To: bruns, #plasma, broulik, apol Cc: plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20383: [KRunner] Avoid writing history if addToHistory is idempotent
bruns updated this revision to Diff 55793. bruns added a comment. use const REPOSITORY R120 Plasma Workspace CHANGES SINCE LAST UPDATE https://phabricator.kde.org/D20383?vs=55748&id=55793 BRANCH arcpatch-D20383 REVISION DETAIL https://phabricator.kde.org/D20383 AFFECTED FILES krunner/view.cpp To: bruns, #plasma, broulik, apol Cc: plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20383: [KRunner] Avoid writing history if addToHistory is idempotent
apol added a comment.
I'm not sure what we win but I'm not against the optimization.
INLINE COMMENTS
> view.cpp:370
> +// Avoid removing the same item from the front and prepending it again
> +if (!m_history.isEmpty() && m_history.first() == item) {
> +return;
`m_history.constFirst() == item`
REPOSITORY
R120 Plasma Workspace
REVISION DETAIL
https://phabricator.kde.org/D20383
To: bruns, #plasma, broulik, apol
Cc: plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai,
ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
D20383: [KRunner] Avoid writing history if addToHistory is idempotent
bruns created this revision. bruns added reviewers: Plasma, broulik, apol. Herald added a project: Plasma. Herald added a subscriber: plasma-devel. bruns requested review of this revision. REVISION SUMMARY It is not uncommon to run the same command repeatedly. In this case, the history is actually unchanged - the item is removed from the first position, and prepended again. TEST PLAN run the same command twice, config file is not rewritten run a new command, config is updated REPOSITORY R120 Plasma Workspace BRANCH krunner_history REVISION DETAIL https://phabricator.kde.org/D20383 AFFECTED FILES krunner/view.cpp To: bruns, #plasma, broulik, apol Cc: plasma-devel, jraleigh, GB_2, ragreen, Pitel, ZrenBot, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, mart
