summaryrefslogtreecommitdiff
path: root/editor/editor_command_palette.h
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_command_palette.h')
-rw-r--r--editor/editor_command_palette.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/editor/editor_command_palette.h b/editor/editor_command_palette.h
index 093f4b797d..39821a1169 100644
--- a/editor/editor_command_palette.h
+++ b/editor/editor_command_palette.h
@@ -47,13 +47,15 @@ class EditorCommandPalette : public ConfirmationDialog {
Callable callable;
String name;
String shortcut;
+ int last_used = 0; // Store time as int, because doubles have problems with text serialization.
};
struct CommandEntry {
String key_name;
String display_name;
String shortcut_text;
- float score;
+ int last_used = 0;
+ float score = 0;
};
struct CommandEntryComparator {
@@ -62,6 +64,12 @@ class EditorCommandPalette : public ConfirmationDialog {
}
};
+ struct CommandHistoryComparator {
+ _FORCE_INLINE_ bool operator()(const CommandEntry &A, const CommandEntry &B) const {
+ return A.last_used > B.last_used;
+ }
+ };
+
HashMap<String, Command> commands;
HashMap<String, Pair<String, Ref<Shortcut>>> unregistered_shortcuts;
@@ -74,6 +82,7 @@ class EditorCommandPalette : public ConfirmationDialog {
void _update_command_keys();
void _add_command(String p_command_name, String p_key_name, Callable p_binded_action, String p_shortcut_text = "None");
void _theme_changed();
+ void _save_history() const;
EditorCommandPalette();
protected: