From 8516c2dc1f301c439695629fff771227dbe00d30 Mon Sep 17 00:00:00 2001 From: Famiu Haque Date: Sat, 23 Nov 2024 14:22:06 +0600 Subject: refactor(options): autogenerate valid values and flag enums for options (#31089) Problem: Option metadata like list of valid values for an option and option flags are not listed in the `options.lua` file and are instead manually defined in C, which means option metadata is split between several places. Solution: Put metadata such as list of valid values for an option and option flags in `options.lua`, and autogenerate the corresponding C variables and enums. Supersedes #28659 Co-authored-by: glepnir --- src/nvim/undo.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/undo.c') diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 0f8857a6bd..233e323f37 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -2528,7 +2528,7 @@ static void u_undoredo(bool undo, bool do_buf_event) /// @param absolute used ":undo N" static void u_undo_end(bool did_undo, bool absolute, bool quiet) { - if ((fdo_flags & FDO_UNDO) && KeyTyped) { + if ((fdo_flags & kOptFdoFlagUndo) && KeyTyped) { foldOpenCursor(); } -- cgit From 9c6a3703bb15d56fecdd962512f69f0ccf6d398c Mon Sep 17 00:00:00 2001 From: Tomasz N Date: Mon, 16 Dec 2024 12:07:27 +0100 Subject: fix(messages): no message kind for :undo messages #31590 Problem: cannot handle `:undo` and `:redo` messages in a special way, e.g. replace one by another. Solution: add `undo` kind. --- src/nvim/undo.c | 1 + 1 file changed, 1 insertion(+) (limited to 'src/nvim/undo.c') diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 233e323f37..d523e55640 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -1862,6 +1862,7 @@ static void u_doit(int startcount, bool quiet, bool do_buf_event) u_oldcount = -1; } + msg_ext_set_kind("undo"); int count = startcount; while (count--) { // Do the change warning now, so that it triggers FileChangedRO when -- cgit From d1e00a5f6dce9cf1fa80f613d4d27019966e5a79 Mon Sep 17 00:00:00 2001 From: luukvbaal Date: Sun, 22 Dec 2024 15:42:48 +0100 Subject: fix(messages): typo and unwanted truncation in msg_outtrans_long #31669 - Typo/bug in msg_outtrans_long passing string length as "hist" argument. - Avoid truncating message in msg_outtrans_long with ext_messages (followup to 1097d239c307a10a87fa995c4cfbe5987939e177). - Remove `_hl` from `msg_keep`, `smsg_keep` as there is no non-`_hl` variant. - `msg_printf_hl` is removed (identical to `smsg` except it sets `msg_scroll = true`, seemingly as a caveat to force a more prompt in cmdline mode). Move this logic to the only the only place this was used in ex_getln.c. --- src/nvim/undo.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/nvim/undo.c') diff --git a/src/nvim/undo.c b/src/nvim/undo.c index d523e55640..45401ca5e1 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -2596,12 +2596,12 @@ static void u_undo_end(bool did_undo, bool absolute, bool quiet) check_pos(curbuf, &VIsual); } - smsg_hl_keep(0, _("%" PRId64 " %s; %s #%" PRId64 " %s"), - u_oldcount < 0 ? (int64_t)-u_oldcount : (int64_t)u_oldcount, - _(msgstr), - did_undo ? _("before") : _("after"), - uhp == NULL ? 0 : (int64_t)uhp->uh_seq, - msgbuf); + smsg_keep(0, _("%" PRId64 " %s; %s #%" PRId64 " %s"), + u_oldcount < 0 ? (int64_t)-u_oldcount : (int64_t)u_oldcount, + _(msgstr), + did_undo ? _("before") : _("after"), + uhp == NULL ? 0 : (int64_t)uhp->uh_seq, + msgbuf); } /// Put the timestamp of an undo header in "buf[buflen]" in a nice format. -- cgit From 2a7d0ed6145bf3f8b139c2694563f460f829813a Mon Sep 17 00:00:00 2001 From: "Justin M. Keyes" Date: Mon, 23 Dec 2024 05:43:52 -0800 Subject: refactor: iwyu #31637 Result of `make iwyu` (after some "fixups"). --- src/nvim/undo.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'src/nvim/undo.c') diff --git a/src/nvim/undo.c b/src/nvim/undo.c index 45401ca5e1..8d791a4c38 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -89,7 +89,6 @@ #include "nvim/buffer_updates.h" #include "nvim/change.h" #include "nvim/cursor.h" -#include "nvim/decoration.h" #include "nvim/drawscreen.h" #include "nvim/edit.h" #include "nvim/errors.h" @@ -107,12 +106,10 @@ #include "nvim/getchar.h" #include "nvim/gettext_defs.h" #include "nvim/globals.h" -#include "nvim/highlight.h" #include "nvim/highlight_defs.h" #include "nvim/macros_defs.h" #include "nvim/mark.h" #include "nvim/mark_defs.h" -#include "nvim/marktree_defs.h" #include "nvim/mbyte.h" #include "nvim/memline.h" #include "nvim/memline_defs.h" -- cgit