mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-10 13:00:29 +03:00
LibGUI: Fixes modified indicator behavior after saving
Pior to this change when the user added text after having saved the file the Text Editor wouldn't enable the modified flag, unless this new text was a new line. This happened because the UndoStack was merging the Command added by the new text with the old text one, and when is_current_modified() was called, the m_stack_index would not have been incremented, and it would return false. In this change was added a condition to verify if the modified tag is active, and the merge is only done if the document is already modified.
This commit is contained in:
parent
83c412ee9e
commit
964249a5b0
Notes:
sideshowbarker
2024-07-18 04:45:36 +09:00
Author: https://github.com/luizgfc 🔰 Commit: https://github.com/SerenityOS/serenity/commit/964249a5b01 Pull-request: https://github.com/SerenityOS/serenity/pull/9427
@ -62,7 +62,7 @@ void UndoStack::push(NonnullOwnPtr<Command> command)
|
||||
if (m_clean_index.has_value() && m_clean_index.value() > m_stack.size())
|
||||
m_clean_index = {};
|
||||
|
||||
if (!m_stack.is_empty()) {
|
||||
if (!m_stack.is_empty() && is_current_modified()) {
|
||||
if (m_stack.last().merge_with(*command))
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user