From 303d87978556b3548ca4bab98f5daba7f804e4b8 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Sun, 31 Mar 2024 21:38:51 +1100 Subject: Support exposing some env vars as part of the mode information This should implement what #5131 proposed in a different way. Closes #5131 --- src/input_handler.hh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src/input_handler.hh') diff --git a/src/input_handler.hh b/src/input_handler.hh index eeb42464..1d1404d4 100644 --- a/src/input_handler.hh +++ b/src/input_handler.hh @@ -4,6 +4,7 @@ #include "completion.hh" #include "constexpr_utils.hh" #include "context.hh" +#include "env_vars.hh" #include "face.hh" #include "normal.hh" #include "keys.hh" @@ -52,6 +53,12 @@ enum class InsertMode : unsigned OpenLineAbove }; +struct ModeInfo +{ + DisplayLine display_line; + EnvVarMap env_vars; +}; + class InputHandler : public SafeCountable { public: @@ -97,7 +104,7 @@ public: Context& context() { return m_context; } const Context& context() const { return m_context; } - DisplayLine mode_line() const; + ModeInfo mode_info() const; std::pair get_cursor_info() const; -- cgit v1.2.3 From 917db454d9502d087b43cd1ab455616735e86f69 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 1 Apr 2024 11:03:22 +1100 Subject: Change mode_info to contain an optional NormalParams As @topisani pointed out in #5131, it is more user friendly to always provide a %val{register} and %val{count} regardless of the mode. --- src/input_handler.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/input_handler.hh') diff --git a/src/input_handler.hh b/src/input_handler.hh index 1d1404d4..2d0aa355 100644 --- a/src/input_handler.hh +++ b/src/input_handler.hh @@ -56,7 +56,7 @@ enum class InsertMode : unsigned struct ModeInfo { DisplayLine display_line; - EnvVarMap env_vars; + std::optional normal_params; }; class InputHandler : public SafeCountable -- cgit v1.2.3 From 6626d1cfa62faae7752f65efd5bdf47659164218 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 1 Apr 2024 11:33:51 +1100 Subject: Fix std::optional used instead of Optional --- src/input_handler.hh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/input_handler.hh') diff --git a/src/input_handler.hh b/src/input_handler.hh index 2d0aa355..ba73d2b1 100644 --- a/src/input_handler.hh +++ b/src/input_handler.hh @@ -7,6 +7,7 @@ #include "env_vars.hh" #include "face.hh" #include "normal.hh" +#include "optional.hh" #include "keys.hh" #include "string.hh" #include "utils.hh" @@ -56,7 +57,7 @@ enum class InsertMode : unsigned struct ModeInfo { DisplayLine display_line; - std::optional normal_params; + Optional normal_params; }; class InputHandler : public SafeCountable -- cgit v1.2.3