mirror of
https://github.com/RGBCube/serenity
synced 2025-06-29 01:42:11 +00:00
LibLine+Shell: Add dirty history flag and use it
This patch adds a new flag called history_dirty to Line::Editor that is set when history is added to but written. Applications can leverage this flag to write history only when it changes. This patch adds an example usage of this functionality to Shell, which will now only save the history when it is dirty.
This commit is contained in:
parent
227ccfc61a
commit
ecbe17fb11
3 changed files with 5 additions and 1 deletions
|
@ -2084,7 +2084,7 @@ void Shell::timer_event(Core::TimerEvent& event)
|
|||
if (!m_history_autosave_time.has_value())
|
||||
return;
|
||||
|
||||
if (m_editor)
|
||||
if (m_editor && m_editor->is_history_dirty())
|
||||
m_editor->save_history(get_history_path());
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue