Add more memory domains to certain data
This commit is contained in:
parent
54d540021c
commit
2f3a7112ea
|
@ -12,7 +12,7 @@ namespace Kakoune
|
||||||
class BufferManager : public Singleton<BufferManager>
|
class BufferManager : public Singleton<BufferManager>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using BufferList = Vector<std::unique_ptr<Buffer>>;
|
using BufferList = Vector<std::unique_ptr<Buffer>, MemoryDomain::BufferMeta>;
|
||||||
using iterator = BufferList::const_iterator;
|
using iterator = BufferList::const_iterator;
|
||||||
|
|
||||||
~BufferManager();
|
~BufferManager();
|
||||||
|
|
|
@ -58,7 +58,7 @@ private:
|
||||||
ClientList m_clients;
|
ClientList m_clients;
|
||||||
ClientList m_client_trash;
|
ClientList m_client_trash;
|
||||||
Vector<WindowAndSelections, MemoryDomain::Client> m_free_windows;
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -940,7 +940,11 @@ void define_command(const ParametersParser& parser, Context& context, const Shel
|
||||||
String output = ShellManager::instance().eval(shell_cmd, context, {},
|
String output = ShellManager::instance().eval(shell_cmd, context, {},
|
||||||
ShellManager::Flags::WaitForStdout,
|
ShellManager::Flags::WaitForStdout,
|
||||||
shell_context).first;
|
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"))
|
else if (auto shell_cmd_opt = parser.get_switch("shell-candidates"))
|
||||||
|
|
|
@ -15,7 +15,7 @@ namespace Kakoune
|
||||||
|
|
||||||
class Context;
|
class Context;
|
||||||
|
|
||||||
using CandidateList = Vector<String>;
|
using CandidateList = Vector<String, MemoryDomain::Completion>;
|
||||||
|
|
||||||
struct Completions
|
struct Completions
|
||||||
{
|
{
|
||||||
|
|
|
@ -82,11 +82,11 @@ public:
|
||||||
private:
|
private:
|
||||||
friend class FDWatcher;
|
friend class FDWatcher;
|
||||||
friend class Timer;
|
friend class Timer;
|
||||||
Vector<FDWatcher*> m_fd_watchers;
|
Vector<FDWatcher*, MemoryDomain::Events> m_fd_watchers;
|
||||||
Vector<Timer*> m_timers;
|
Vector<Timer*, MemoryDomain::Events> m_timers;
|
||||||
fd_set m_forced_fd;
|
fd_set m_forced_fd;
|
||||||
|
|
||||||
TimePoint m_last;
|
TimePoint m_last;
|
||||||
};
|
};
|
||||||
|
|
||||||
using SignalHandler = void(*)(int);
|
using SignalHandler = void(*)(int);
|
||||||
|
|
|
@ -421,7 +421,7 @@ CandidateList complete_filename(StringView prefix, const Regex& ignored_regex,
|
||||||
return candidates(matches, expand ? parsed_dirname : dirname);
|
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));
|
String real_prefix = parse_filename(prefix.substr(0, cursor_pos));
|
||||||
StringView dirname, fileprefix;
|
StringView dirname, fileprefix;
|
||||||
|
|
|
@ -71,7 +71,7 @@ struct HighlighterFactoryAndDocstring
|
||||||
String docstring;
|
String docstring;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct HighlighterRegistry : IdMap<HighlighterFactoryAndDocstring>,
|
struct HighlighterRegistry : IdMap<HighlighterFactoryAndDocstring, MemoryDomain::Highlight>,
|
||||||
Singleton<HighlighterRegistry>
|
Singleton<HighlighterRegistry>
|
||||||
{};
|
{};
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ private:
|
||||||
|
|
||||||
SafePtr<HookManager> m_parent;
|
SafePtr<HookManager> m_parent;
|
||||||
IdMap<IdMap<HookFunc, MemoryDomain::Hooks>, MemoryDomain::Hooks> m_hook;
|
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;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -106,7 +106,7 @@ private:
|
||||||
Context m_context;
|
Context m_context;
|
||||||
|
|
||||||
friend class InputMode;
|
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(); }
|
InputMode& current_mode() const { return *m_mode_stack.back(); }
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ struct InsertCompletion
|
||||||
bool operator<(const Candidate& other) const { return completion < other.completion; }
|
bool operator<(const Candidate& other) const { return completion < other.completion; }
|
||||||
};
|
};
|
||||||
|
|
||||||
using CandidateList = Vector<Candidate>;
|
using CandidateList = Vector<Candidate, MemoryDomain::Completion>;
|
||||||
|
|
||||||
BufferCoord begin;
|
BufferCoord begin;
|
||||||
BufferCoord end;
|
BufferCoord end;
|
||||||
|
|
|
@ -54,7 +54,7 @@ private:
|
||||||
|
|
||||||
InputCallback m_input_callback;
|
InputCallback m_input_callback;
|
||||||
FDWatcher m_stdin_watcher;
|
FDWatcher m_stdin_watcher;
|
||||||
Vector<Key> m_pending_keys;
|
Vector<Key, MemoryDomain::Client> m_pending_keys;
|
||||||
DisplayCoord m_dimensions;
|
DisplayCoord m_dimensions;
|
||||||
String m_requests;
|
String m_requests;
|
||||||
};
|
};
|
||||||
|
|
|
@ -33,6 +33,8 @@ enum class MemoryDomain
|
||||||
Selections,
|
Selections,
|
||||||
History,
|
History,
|
||||||
Remote,
|
Remote,
|
||||||
|
Events,
|
||||||
|
Completion,
|
||||||
Count
|
Count
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -61,6 +63,8 @@ inline const char* domain_name(MemoryDomain domain)
|
||||||
case MemoryDomain::Selections: return "Selections";
|
case MemoryDomain::Selections: return "Selections";
|
||||||
case MemoryDomain::History: return "History";
|
case MemoryDomain::History: return "History";
|
||||||
case MemoryDomain::Remote: return "Remote";
|
case MemoryDomain::Remote: return "Remote";
|
||||||
|
case MemoryDomain::Events: return "Events";
|
||||||
|
case MemoryDomain::Completion: return "Completion";
|
||||||
case MemoryDomain::Count: break;
|
case MemoryDomain::Count: break;
|
||||||
}
|
}
|
||||||
kak_assert(false);
|
kak_assert(false);
|
||||||
|
|
|
@ -60,7 +60,7 @@ private:
|
||||||
|
|
||||||
String m_session;
|
String m_session;
|
||||||
std::unique_ptr<FDWatcher> m_listener;
|
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);
|
bool check_session(StringView session);
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct EnvVarDesc { String str; bool prefix; EnvVarRetriever func; };
|
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 {};
|
template<> struct WithBitOps<ShellManager::Flags> : std::true_type {};
|
||||||
|
|
|
@ -76,7 +76,7 @@ void Window::center_column(ColumnCount buffer_column)
|
||||||
|
|
||||||
Window::Setup Window::build_setup(const Context& context) const
|
Window::Setup Window::build_setup(const Context& context) const
|
||||||
{
|
{
|
||||||
Vector<BufferRange> selections;
|
Vector<BufferRange, MemoryDomain::Display> selections;
|
||||||
for (auto& sel : context.selections())
|
for (auto& sel : context.selections())
|
||||||
selections.push_back({sel.cursor(), sel.anchor()});
|
selections.push_back({sel.cursor(), sel.anchor()});
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@ private:
|
||||||
DisplayCoord dimensions;
|
DisplayCoord dimensions;
|
||||||
size_t timestamp;
|
size_t timestamp;
|
||||||
size_t main_selection;
|
size_t main_selection;
|
||||||
Vector<BufferRange> selections;
|
Vector<BufferRange, MemoryDomain::Display> selections;
|
||||||
};
|
};
|
||||||
Setup build_setup(const Context& context) const;
|
Setup build_setup(const Context& context) const;
|
||||||
Setup m_last_setup;
|
Setup m_last_setup;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user