mirror of
https://github.com/RGBCube/serenity
synced 2025-06-01 06:18:12 +00:00
LibGUI: Don't merge TextDocumentUndoCommand if too much time has elapsed
This commit is contained in:
parent
ee81c1b07a
commit
2adc5efe2b
2 changed files with 15 additions and 3 deletions
|
@ -12,6 +12,7 @@
|
|||
#include <AK/NonnullRefPtr.h>
|
||||
#include <AK/Optional.h>
|
||||
#include <AK/RefCounted.h>
|
||||
#include <AK/Time.h>
|
||||
#include <AK/Utf32View.h>
|
||||
#include <LibCore/Forward.h>
|
||||
#include <LibGUI/Command.h>
|
||||
|
@ -25,6 +26,8 @@
|
|||
|
||||
namespace GUI {
|
||||
|
||||
constexpr Time COMMAND_COMMIT_TIME = Time::from_milliseconds(400);
|
||||
|
||||
struct TextDocumentSpan {
|
||||
TextRange range;
|
||||
Gfx::TextAttributes attributes;
|
||||
|
@ -202,6 +205,9 @@ public:
|
|||
}
|
||||
|
||||
protected:
|
||||
bool commit_time_expired() const { return Time::now_monotonic() - m_timestamp >= COMMAND_COMMIT_TIME; }
|
||||
|
||||
Time m_timestamp = Time::now_monotonic();
|
||||
TextDocument& m_document;
|
||||
TextDocument::Client const* m_client { nullptr };
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue