From c3e1bab9d6195570a59e315669b3afd8761ca459 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 2 Jan 2017 12:05:49 +0000 Subject: [PATCH] Fix comment autoinsert for c-family as well. Fixes #1074 --- rc/core/c-family.kak | 2 +- test/regression/1074-comment-leader-autoinsert-error/cmd | 1 + test/regression/1074-comment-leader-autoinsert-error/in | 1 + test/regression/1074-comment-leader-autoinsert-error/out | 2 ++ test/regression/1074-comment-leader-autoinsert-error/rc | 3 +++ 5 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 test/regression/1074-comment-leader-autoinsert-error/cmd create mode 100644 test/regression/1074-comment-leader-autoinsert-error/in create mode 100644 test/regression/1074-comment-leader-autoinsert-error/out create mode 100644 test/regression/1074-comment-leader-autoinsert-error/rc diff --git a/rc/core/c-family.kak b/rc/core/c-family.kak index 78949de5..97f5ab58 100644 --- a/rc/core/c-family.kak +++ b/rc/core/c-family.kak @@ -72,7 +72,7 @@ def -hidden c-family-insert-on-newline %[ eval -draft %[ exec -save-regs '' k 1s^\h*(//+\h*) y try %[ # if the previous comment isn't empty, create a new one - exec ^\h*//+\h*$ js^\h*p + exec ^\h*//+\h*$ js^\h*P ] catch %[ # if there is no text in the previous comment, remove it completely exec d diff --git a/test/regression/1074-comment-leader-autoinsert-error/cmd b/test/regression/1074-comment-leader-autoinsert-error/cmd new file mode 100644 index 00000000..54aed4f8 --- /dev/null +++ b/test/regression/1074-comment-leader-autoinsert-error/cmd @@ -0,0 +1 @@ +i diff --git a/test/regression/1074-comment-leader-autoinsert-error/in b/test/regression/1074-comment-leader-autoinsert-error/in new file mode 100644 index 00000000..aa8c0d6c --- /dev/null +++ b/test/regression/1074-comment-leader-autoinsert-error/in @@ -0,0 +1 @@ +// abc%( )def diff --git a/test/regression/1074-comment-leader-autoinsert-error/out b/test/regression/1074-comment-leader-autoinsert-error/out new file mode 100644 index 00000000..10251d2e --- /dev/null +++ b/test/regression/1074-comment-leader-autoinsert-error/out @@ -0,0 +1,2 @@ +// abc +// def diff --git a/test/regression/1074-comment-leader-autoinsert-error/rc b/test/regression/1074-comment-leader-autoinsert-error/rc new file mode 100644 index 00000000..53c40654 --- /dev/null +++ b/test/regression/1074-comment-leader-autoinsert-error/rc @@ -0,0 +1,3 @@ +source "%val{runtime}/colors/default.kak" +source "%val{runtime}/rc/core/c-family.kak" +set buffer filetype cpp