diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2016-11-28 13:59:55 +0000 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2016-11-28 13:59:55 +0000 |
| commit | 2f3a7112eafe7bfa6ddd9c6b8a3e6d11a44ce49d (patch) | |
| tree | c3adad7f5e58664311e26f74b71b7a7ca96a66a0 /src | |
| parent | 54d540021cd50dc78e58a127e4770dc7b26e161f (diff) | |
Add more memory domains to certain data
Diffstat (limited to 'src')
| -rw-r--r-- | src/buffer_manager.hh | 2 | ||||
| -rw-r--r-- | src/client_manager.hh | 2 | ||||
| -rw-r--r-- | src/commands.cc | 6 | ||||
| -rw-r--r-- | src/completion.hh | 2 | ||||
| -rw-r--r-- | src/event_manager.hh | 6 | ||||
| -rw-r--r-- | src/file.cc | 2 | ||||
| -rw-r--r-- | src/highlighter.hh | 2 | ||||
| -rw-r--r-- | src/hook_manager.hh | 2 | ||||
| -rw-r--r-- | src/input_handler.hh | 2 | ||||
| -rw-r--r-- | src/insert_completer.hh | 2 | ||||
| -rw-r--r-- | src/json_ui.hh | 2 | ||||
| -rw-r--r-- | src/memory.hh | 4 | ||||
| -rw-r--r-- | src/remote.hh | 2 | ||||
| -rw-r--r-- | src/shell_manager.hh | 2 | ||||
| -rw-r--r-- | src/window.cc | 2 | ||||
| -rw-r--r-- | src/window.hh | 2 |
16 files changed, 25 insertions, 17 deletions
diff --git a/src/buffer_manager.hh b/src/buffer_manager.hh index d12c515b..50d75b7d 100644 --- a/src/buffer_manager.hh +++ b/src/buffer_manager.hh @@ -12,7 +12,7 @@ namespace Kakoune class BufferManager : public Singleton<BufferManager> { public: - using BufferList = Vector<std::unique_ptr<Buffer>>; + using BufferList = Vector<std::unique_ptr<Buffer>, MemoryDomain::BufferMeta>; using iterator = BufferList::const_iterator; ~BufferManager(); diff --git a/src/client_manager.hh b/src/client_manager.hh index b7a085a2..cb05d83e 100644 --- a/src/client_manager.hh +++ b/src/client_manager.hh @@ -58,7 +58,7 @@ private: ClientList m_clients; ClientList m_client_trash; Vector<WindowAndSelections, MemoryDomain::Client> m_free_windows; - Vector<std::unique_ptr<Window>> m_window_trash; + Vector<std::unique_ptr<Window>, MemoryDomain::Client> m_window_trash; }; } diff --git a/src/commands.cc b/src/commands.cc index b7f4bd01..32d54996 100644 --- a/src/commands.cc +++ b/src/commands.cc @@ -940,7 +940,11 @@ void define_command(const ParametersParser& parser, Context& context, const Shel String output = ShellManager::instance().eval(shell_cmd, context, {}, ShellManager::Flags::WaitForStdout, shell_context).first; - return Completions{ 0_byte, pos_in_token, split(output, '\n', 0) }; + CandidateList candidates; + for (auto& str : split(output, '\n', 0)) + candidates.push_back(std::move(str)); + + return Completions{ 0_byte, pos_in_token, std::move(candidates) }; }; } else if (auto shell_cmd_opt = parser.get_switch("shell-candidates")) diff --git a/src/completion.hh b/src/completion.hh index 6743194e..95dc7deb 100644 --- a/src/completion.hh +++ b/src/completion.hh @@ -15,7 +15,7 @@ namespace Kakoune class Context; -using CandidateList = Vector<String>; +using CandidateList = Vector<String, MemoryDomain::Completion>; struct Completions { diff --git a/src/event_manager.hh b/src/event_manager.hh index 3c1567c9..49edb1af 100644 --- a/src/event_manager.hh +++ b/src/event_manager.hh @@ -82,11 +82,11 @@ public: private: friend class FDWatcher; friend class Timer; - Vector<FDWatcher*> m_fd_watchers; - Vector<Timer*> m_timers; + Vector<FDWatcher*, MemoryDomain::Events> m_fd_watchers; + Vector<Timer*, MemoryDomain::Events> m_timers; fd_set m_forced_fd; - TimePoint m_last; + TimePoint m_last; }; using SignalHandler = void(*)(int); diff --git a/src/file.cc b/src/file.cc index 9620467a..92ddcf13 100644 --- a/src/file.cc +++ b/src/file.cc @@ -421,7 +421,7 @@ CandidateList complete_filename(StringView prefix, const Regex& ignored_regex, return candidates(matches, expand ? parsed_dirname : dirname); } -Vector<String> complete_command(StringView prefix, ByteCount cursor_pos) +CandidateList complete_command(StringView prefix, ByteCount cursor_pos) { String real_prefix = parse_filename(prefix.substr(0, cursor_pos)); StringView dirname, fileprefix; diff --git a/src/highlighter.hh b/src/highlighter.hh index 18255b82..2845f9ad 100644 --- a/src/highlighter.hh +++ b/src/highlighter.hh @@ -71,7 +71,7 @@ struct HighlighterFactoryAndDocstring String docstring; }; -struct HighlighterRegistry : IdMap<HighlighterFactoryAndDocstring>, +struct HighlighterRegistry : IdMap<HighlighterFactoryAndDocstring, MemoryDomain::Highlight>, Singleton<HighlighterRegistry> {}; diff --git a/src/hook_manager.hh b/src/hook_manager.hh index d6b8d0a8..f5e55739 100644 --- a/src/hook_manager.hh +++ b/src/hook_manager.hh @@ -30,7 +30,7 @@ private: SafePtr<HookManager> m_parent; IdMap<IdMap<HookFunc, MemoryDomain::Hooks>, MemoryDomain::Hooks> m_hook; - mutable Vector<std::pair<StringView, StringView>> m_running_hooks; + mutable Vector<std::pair<StringView, StringView>, MemoryDomain::Hooks> m_running_hooks; }; } diff --git a/src/input_handler.hh b/src/input_handler.hh index 14e9d048..43fd9ecb 100644 --- a/src/input_handler.hh +++ b/src/input_handler.hh @@ -106,7 +106,7 @@ private: Context m_context; friend class InputMode; - Vector<RefPtr<InputMode>> m_mode_stack; + Vector<RefPtr<InputMode>, MemoryDomain::Client> m_mode_stack; InputMode& current_mode() const { return *m_mode_stack.back(); } diff --git a/src/insert_completer.hh b/src/insert_completer.hh index 064047f8..ac1fa22b 100644 --- a/src/insert_completer.hh +++ b/src/insert_completer.hh @@ -62,7 +62,7 @@ struct InsertCompletion bool operator<(const Candidate& other) const { return completion < other.completion; } }; - using CandidateList = Vector<Candidate>; + using CandidateList = Vector<Candidate, MemoryDomain::Completion>; BufferCoord begin; BufferCoord end; diff --git a/src/json_ui.hh b/src/json_ui.hh index f8b48924..026481dc 100644 --- a/src/json_ui.hh +++ b/src/json_ui.hh @@ -54,7 +54,7 @@ private: InputCallback m_input_callback; FDWatcher m_stdin_watcher; - Vector<Key> m_pending_keys; + Vector<Key, MemoryDomain::Client> m_pending_keys; DisplayCoord m_dimensions; String m_requests; }; diff --git a/src/memory.hh b/src/memory.hh index 19fa6a40..4d41c0c0 100644 --- a/src/memory.hh +++ b/src/memory.hh @@ -33,6 +33,8 @@ enum class MemoryDomain Selections, History, Remote, + Events, + Completion, Count }; @@ -61,6 +63,8 @@ inline const char* domain_name(MemoryDomain domain) case MemoryDomain::Selections: return "Selections"; case MemoryDomain::History: return "History"; case MemoryDomain::Remote: return "Remote"; + case MemoryDomain::Events: return "Events"; + case MemoryDomain::Completion: return "Completion"; case MemoryDomain::Count: break; } kak_assert(false); diff --git a/src/remote.hh b/src/remote.hh index 5537e3fd..7e171b17 100644 --- a/src/remote.hh +++ b/src/remote.hh @@ -60,7 +60,7 @@ private: String m_session; std::unique_ptr<FDWatcher> m_listener; - Vector<std::unique_ptr<Accepter>> m_accepters; + Vector<std::unique_ptr<Accepter>, MemoryDomain::Remote> m_accepters; }; bool check_session(StringView session); diff --git a/src/shell_manager.hh b/src/shell_manager.hh index 0d9a16a1..2f2608ef 100644 --- a/src/shell_manager.hh +++ b/src/shell_manager.hh @@ -44,7 +44,7 @@ public: private: struct EnvVarDesc { String str; bool prefix; EnvVarRetriever func; }; - Vector<EnvVarDesc> m_env_vars; + Vector<EnvVarDesc, MemoryDomain::EnvVars> m_env_vars; }; template<> struct WithBitOps<ShellManager::Flags> : std::true_type {}; diff --git a/src/window.cc b/src/window.cc index 78e75be9..54fffc6a 100644 --- a/src/window.cc +++ b/src/window.cc @@ -76,7 +76,7 @@ void Window::center_column(ColumnCount buffer_column) Window::Setup Window::build_setup(const Context& context) const { - Vector<BufferRange> selections; + Vector<BufferRange, MemoryDomain::Display> selections; for (auto& sel : context.selections()) selections.push_back({sel.cursor(), sel.anchor()}); diff --git a/src/window.hh b/src/window.hh index 68ecc636..d4359864 100644 --- a/src/window.hh +++ b/src/window.hh @@ -75,7 +75,7 @@ private: DisplayCoord dimensions; size_t timestamp; size_t main_selection; - Vector<BufferRange> selections; + Vector<BufferRange, MemoryDomain::Display> selections; }; Setup build_setup(const Context& context) const; Setup m_last_setup; |
