aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/labeler.yml90
-rw-r--r--.github/workflows/reviews.yml99
-rw-r--r--ci/common/build.sh7
-rw-r--r--ci/common/suite.sh18
-rw-r--r--ci/common/test.sh9
-rwxr-xr-xci/run_tests.sh24
-rw-r--r--runtime/doc/various.txt2
-rw-r--r--src/nvim/ex_cmds2.c9
-rw-r--r--src/nvim/ops.c99
-rw-r--r--src/nvim/testdir/test_cursor_func.vim8
-rw-r--r--src/nvim/testdir/test_filter_cmd.vim35
11 files changed, 208 insertions, 192 deletions
diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml
index 4940d6bb58..3de0c453a5 100644
--- a/.github/workflows/labeler.yml
+++ b/.github/workflows/labeler.yml
@@ -32,93 +32,3 @@ jobs:
- name: "Extract commit scope and add as label"
continue-on-error: true
run: gh pr edit "$PR_NUMBER" --add-label "$(echo "$PR_TITLE" | sed -E 's|[[:alpha:]]+\((.+)\)!?:.*|\1|')"
-
- add-reviewer:
- runs-on: ubuntu-latest
- needs: ["triage", "type-scope"]
- permissions:
- pull-requests: write
- steps:
- - uses: actions/github-script@v5
- with:
- script: |
- const reviewers = []
-
- const { data: { labels } } = await github.rest.pulls.get({
- owner: context.repo.owner,
- repo: context.repo.repo,
- pull_number: context.issue.number
- })
- const label_names = labels.map(label => label.name)
-
- if (label_names.includes('api')) {
- reviewers.push("bfredl")
- reviewers.push("gpanders")
- reviewers.push("muniter")
- }
-
- if (label_names.includes('ci')) {
- reviewers.push("jamessan")
- }
-
- if (label_names.includes('diagnostic')) {
- reviewers.push("gpanders")
- }
-
- if (label_names.includes('distribution')) {
- reviewers.push("jamessan")
- }
-
- if (label_names.includes('documentation')) {
- reviewers.push("clason")
- }
-
- if (label_names.includes('extmarks')) {
- reviewers.push("bfredl")
- }
-
- if (label_names.includes('filetype')) {
- reviewers.push("clason")
- reviewers.push("gpanders")
- }
-
- if (label_names.includes('gui')) {
- reviewers.push("glacambre")
- reviewers.push("smolck")
- }
-
- if (label_names.includes('lsp')) {
- reviewers.push("mfussenegger")
- reviewers.push("mjlbach")
- }
-
- if (label_names.includes('treesitter')) {
- reviewers.push("bfredl")
- reviewers.push("vigoux")
- }
-
- if (label_names.includes('typo')) {
- reviewers.push("dundargoc")
- }
-
- if (label_names.includes('ui')) {
- reviewers.push("bfredl")
- }
-
- if (label_names.includes('vim-patch')) {
- reviewers.push("janlazo")
- reviewers.push("seandewar")
- reviewers.push("zeertzjq")
- }
-
- const index = reviewers.indexOf(context.actor);
- if (index > -1) {
- reviewers.splice(index, 1);
- }
-
- github.rest.pulls.requestReviewers({
- owner: context.repo.owner,
- repo: context.repo.repo,
- pull_number: context.issue.number,
- reviewers: reviewers
- });
diff --git a/.github/workflows/reviews.yml b/.github/workflows/reviews.yml
new file mode 100644
index 0000000000..1491482b98
--- /dev/null
+++ b/.github/workflows/reviews.yml
@@ -0,0 +1,99 @@
+name: "Request reviews"
+on:
+ pull_request_target:
+ types: [labeled]
+ workflow_run:
+ workflows: [Pull Request Labeler]
+ types: [completed]
+jobs:
+ request-reviewer:
+ runs-on: ubuntu-latest
+ permissions:
+ pull-requests: write
+ steps:
+ - uses: actions/github-script@v5
+ with:
+ script: |
+ // The number of the pull request that triggered this run. If label
+ // was added manually by a person the number will be stored in current
+ // context, otherwise the number will be stored in the payload.
+ const pr_number = context.issue.number || context.payload.workflow_run.pull_requests[0].number
+
+ const pr_data = await github.rest.pulls.get({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ pull_number: pr_number
+ })
+ const labels = pr_data.data.labels.map(e => e.name)
+
+ const reviewers = new Set()
+ if (labels.includes('api')) {
+ reviewers.add("bfredl")
+ reviewers.add("gpanders")
+ reviewers.add("muniter")
+ }
+
+ if (labels.includes('ci')) {
+ reviewers.add("jamessan")
+ }
+
+ if (labels.includes('diagnostic')) {
+ reviewers.add("gpanders")
+ }
+
+ if (labels.includes('distribution')) {
+ reviewers.add("jamessan")
+ }
+
+ if (labels.includes('documentation')) {
+ reviewers.add("clason")
+ }
+
+ if (labels.includes('extmarks')) {
+ reviewers.add("bfredl")
+ }
+
+ if (labels.includes('filetype')) {
+ reviewers.add("clason")
+ reviewers.add("gpanders")
+ }
+
+ if (labels.includes('gui')) {
+ reviewers.add("glacambre")
+ reviewers.add("smolck")
+ }
+
+ if (labels.includes('lsp')) {
+ reviewers.add("mfussenegger")
+ reviewers.add("mjlbach")
+ }
+
+ if (labels.includes('treesitter')) {
+ reviewers.add("bfredl")
+ reviewers.add("vigoux")
+ }
+
+ if (labels.includes('typo')) {
+ reviewers.add("dundargoc")
+ }
+
+ if (labels.includes('ui')) {
+ reviewers.add("bfredl")
+ }
+
+ if (labels.includes('vim-patch')) {
+ reviewers.add("janlazo")
+ reviewers.add("seandewar")
+ reviewers.add("zeertzjq")
+ }
+
+ // Remove person that opened the PR since they can't review themselves
+ const pr_opener = pr_data.data.user.login
+ reviewers.delete(pr_opener)
+
+ github.rest.pulls.requestReviewers({
+ owner: context.repo.owner,
+ repo: context.repo.repo,
+ pull_number: pr_number,
+ reviewers: Array.from(reviewers)
+ });
diff --git a/ci/common/build.sh b/ci/common/build.sh
index c44c234274..b8bbff0b16 100644
--- a/ci/common/build.sh
+++ b/ci/common/build.sh
@@ -44,7 +44,9 @@ build_deps() {
cd "${CI_BUILD_DIR}"
}
-prepare_build() {
+build_nvim() {
+ check_core_dumps --delete quiet
+
if test -n "${CLANG_SANITIZER}" ; then
CMAKE_FLAGS="${CMAKE_FLAGS} -DCLANG_${CLANG_SANITIZER}=ON"
fi
@@ -53,9 +55,8 @@ prepare_build() {
cd "${BUILD_DIR}"
echo "Configuring with '${CMAKE_FLAGS} $@'."
cmake -G Ninja ${CMAKE_FLAGS} "$@" "${CI_BUILD_DIR}"
-}
-build_nvim() {
+
echo "Building nvim."
if ! top_make nvim ; then
exit 1
diff --git a/ci/common/suite.sh b/ci/common/suite.sh
index f6a8c22d21..8f6d81e264 100644
--- a/ci/common/suite.sh
+++ b/ci/common/suite.sh
@@ -47,13 +47,7 @@ exit_suite() {
ci_fold "end" ""
fi
export NVIM_TEST_CURRENT_SUITE="${NVIM_TEST_CURRENT_SUITE%/*}"
- if test "$1" != "--continue" ; then
- exit $FAILED
- else
- local saved_failed=$FAILED
- FAILED=0
- return $saved_failed
- fi
+ FAILED=0
}
fail() {
@@ -71,12 +65,6 @@ fail() {
FAILED=1
}
-run_test() {
- local cmd="$1"
- local test_name="$2"
- eval "$cmd" || fail "$test_name"
-}
-
ended_successfully() {
if test -f "${FAIL_SUMMARY_FILE}" ; then
echo 'Test failed, complete summary:'
@@ -100,7 +88,7 @@ run_suite() {
local suite_name="$2"
enter_suite "$suite_name"
- run_test "$command" "$suite_name"
- exit_suite --continue
+ eval "$command" || fail "$suite_name"
+ exit_suite
}
diff --git a/ci/common/test.sh b/ci/common/test.sh
index 798f2926c6..c5f67edd2c 100644
--- a/ci/common/test.sh
+++ b/ci/common/test.sh
@@ -87,18 +87,15 @@ check_sanitizer() {
}
run_unittests() {(
- enter_suite unittests
ulimit -c unlimited || true
if ! build_make unittest ; then
fail 'unittests' F 'Unit tests failed'
fi
submit_coverage unittest
check_core_dumps "$(command -v luajit)"
- exit_suite
)}
run_functionaltests() {(
- enter_suite functionaltests
ulimit -c unlimited || true
if ! build_make ${FUNCTIONALTEST}; then
fail 'functionaltests' F 'Functional tests failed'
@@ -107,11 +104,9 @@ run_functionaltests() {(
check_sanitizer "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps
- exit_suite
)}
run_oldtests() {(
- enter_suite oldtests
ulimit -c unlimited || true
if ! make oldtest; then
reset
@@ -121,7 +116,6 @@ run_oldtests() {(
check_sanitizer "${LOG_DIR}"
valgrind_check "${LOG_DIR}"
check_core_dumps
- exit_suite
)}
check_runtime_files() {(
@@ -146,7 +140,6 @@ check_runtime_files() {(
)}
install_nvim() {(
- enter_suite 'install_nvim'
if ! build_make install ; then
fail 'install' E 'make install failed'
exit_suite
@@ -179,6 +172,4 @@ install_nvim() {(
if ! grep -q "$gpat" "${INSTALL_PREFIX}/share/nvim/runtime/$genvimsynf" ; then
fail 'funcnames' F "It appears that $genvimsynf does not contain $gpat."
fi
-
- exit_suite
)}
diff --git a/ci/run_tests.sh b/ci/run_tests.sh
index 6c310ccc76..1baeb090a8 100755
--- a/ci/run_tests.sh
+++ b/ci/run_tests.sh
@@ -8,29 +8,17 @@ source "${CI_DIR}/common/build.sh"
source "${CI_DIR}/common/test.sh"
source "${CI_DIR}/common/suite.sh"
-enter_suite build
+run_suite 'build_nvim' 'build'
-check_core_dumps --delete quiet
-
-prepare_build
-build_nvim
-
-exit_suite --continue
-
-enter_suite tests
-
-if test "$CLANG_SANITIZER" != "TSAN" ; then
+if test "$CLANG_SANITIZER" != "TSAN"; then
# Additional threads are only created when the builtin UI starts, which
# doesn't happen in the unit/functional tests
if test "${FUNCTIONALTEST}" != "functionaltest-lua"; then
- run_test run_unittests unittests
+ run_suite run_unittests unittests
fi
- run_test run_functionaltests functionaltests
+ run_suite run_functionaltests functionaltests
fi
-run_test run_oldtests oldtests
-
-run_test install_nvim install_nvim
-
-exit_suite --continue
+run_suite run_oldtests oldtests
+run_suite install_nvim install_nvim
end_tests
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index fc0230c62d..38869f8e94 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -388,6 +388,8 @@ g8 Print the hex values of the bytes used in the
|:marks| - filter by text in the current file,
or file name for other files
|:oldfiles| - filter by file name
+ |:registers| - filter by register contents
+ (does not work multi-line)
|:set| - filter by option name
Only normal messages are filtered, error messages are
diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c
index e5cec0e060..090422088a 100644
--- a/src/nvim/ex_cmds2.c
+++ b/src/nvim/ex_cmds2.c
@@ -12,6 +12,7 @@
#include <string.h>
#include "nvim/ascii.h"
+#include "nvim/globals.h"
#include "nvim/vim.h"
#ifdef HAVE_LOCALE_H
# include <locale.h>
@@ -2190,9 +2191,11 @@ void ex_scriptnames(exarg_T *eap)
if (SCRIPT_ITEM(i).sn_name != NULL) {
home_replace(NULL, SCRIPT_ITEM(i).sn_name, NameBuff, MAXPATHL, true);
vim_snprintf((char *)IObuff, IOSIZE, "%3d: %s", i, NameBuff);
- msg_putchar('\n');
- msg_outtrans(IObuff);
- line_breakcheck();
+ if (!message_filtered(IObuff)) {
+ msg_putchar('\n');
+ msg_outtrans(IObuff);
+ line_breakcheck();
+ }
}
}
}
diff --git a/src/nvim/ops.c b/src/nvim/ops.c
index cf1fd29c9e..f999b68236 100644
--- a/src/nvim/ops.c
+++ b/src/nvim/ops.c
@@ -3732,7 +3732,7 @@ void ex_display(exarg_T *eap)
int name;
char_u *arg = eap->arg;
int clen;
- char_u type[2];
+ int type;
if (arg != NULL && *arg == NUL) {
arg = NULL;
@@ -3745,11 +3745,11 @@ void ex_display(exarg_T *eap)
name = get_register_name(i);
switch (get_reg_type(name, NULL)) {
case kMTLineWise:
- type[0] = 'l'; break;
+ type = 'l'; break;
case kMTCharWise:
- type[0] = 'c'; break;
+ type = 'c'; break;
default:
- type[0] = 'b'; break;
+ type = 'b'; break;
}
if (arg != NULL && vim_strchr(arg, name) == NULL) {
@@ -3776,88 +3776,87 @@ void ex_display(exarg_T *eap)
}
if (yb->y_array != NULL) {
- msg_putchar('\n');
- msg_puts(" ");
- msg_putchar(type[0]);
- msg_puts(" ");
- msg_putchar('"');
- msg_putchar(name);
- msg_puts(" ");
-
- int n = Columns - 11;
- for (size_t j = 0; j < yb->y_size && n > 1; j++) {
- if (j) {
- msg_puts_attr("^J", attr);
- n -= 2;
+ bool do_show = false;
+
+ for (size_t j = 0; !do_show && j < yb->y_size; j++) {
+ do_show = !message_filtered(yb->y_array[j]);
+ }
+
+ if (do_show || yb->y_size == 0) {
+ msg_putchar('\n');
+ msg_puts(" ");
+ msg_putchar(type);
+ msg_puts(" ");
+ msg_putchar('"');
+ msg_putchar(name);
+ msg_puts(" ");
+
+ int n = Columns - 11;
+ for (size_t j = 0; j < yb->y_size && n > 1; j++) {
+ if (j) {
+ msg_puts_attr("^J", attr);
+ n -= 2;
+ }
+ for (p = yb->y_array[j]; *p && (n -= ptr2cells(p)) >= 0; p++) {
+ clen = utfc_ptr2len(p);
+ msg_outtrans_len(p, clen);
+ p += clen - 1;
+ }
}
- for (p = yb->y_array[j]; *p && (n -= ptr2cells(p)) >= 0; p++) { // -V1019 NOLINT(whitespace/line_length)
- clen = utfc_ptr2len(p);
- msg_outtrans_len(p, clen);
- p += clen - 1;
+ if (n > 1 && yb->y_type == kMTLineWise) {
+ msg_puts_attr("^J", attr);
}
+ ui_flush(); // show one line at a time
}
- if (n > 1 && yb->y_type == kMTLineWise) {
- msg_puts_attr("^J", attr);
- }
- ui_flush(); // show one line at a time
+ os_breakcheck();
}
- os_breakcheck();
}
- /*
- * display last inserted text
- */
+ // display last inserted text
if ((p = get_last_insert()) != NULL
- && (arg == NULL || vim_strchr(arg, '.') != NULL) && !got_int) {
+ && (arg == NULL || vim_strchr(arg, '.') != NULL) && !got_int
+ && !message_filtered(p)) {
msg_puts("\n c \". ");
dis_msg(p, true);
}
- /*
- * display last command line
- */
+ // display last command line
if (last_cmdline != NULL && (arg == NULL || vim_strchr(arg, ':') != NULL)
- && !got_int) {
+ && !got_int && !message_filtered(last_cmdline)) {
msg_puts("\n c \": ");
dis_msg(last_cmdline, false);
}
- /*
- * display current file name
- */
+ // display current file name
if (curbuf->b_fname != NULL
- && (arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) {
+ && (arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int
+ && !message_filtered(curbuf->b_fname)) {
msg_puts("\n c \"% ");
dis_msg(curbuf->b_fname, false);
}
- /*
- * display alternate file name
- */
+ // display alternate file name
if ((arg == NULL || vim_strchr(arg, '%') != NULL) && !got_int) {
char_u *fname;
linenr_T dummy;
- if (buflist_name_nr(0, &fname, &dummy) != FAIL) {
+ if (buflist_name_nr(0, &fname, &dummy) != FAIL && !message_filtered(fname)) {
msg_puts("\n c \"# ");
dis_msg(fname, false);
}
}
- /*
- * display last search pattern
- */
+ // display last search pattern
if (last_search_pat() != NULL
- && (arg == NULL || vim_strchr(arg, '/') != NULL) && !got_int) {
+ && (arg == NULL || vim_strchr(arg, '/') != NULL) && !got_int
+ && !message_filtered(last_search_pat())) {
msg_puts("\n c \"/ ");
dis_msg(last_search_pat(), false);
}
- /*
- * display last used expression
- */
+ // display last used expression
if (expr_line != NULL && (arg == NULL || vim_strchr(arg, '=') != NULL)
- && !got_int) {
+ && !got_int && !message_filtered(expr_line)) {
msg_puts("\n c \"= ");
dis_msg(expr_line, false);
}
diff --git a/src/nvim/testdir/test_cursor_func.vim b/src/nvim/testdir/test_cursor_func.vim
index f2ffd50726..47e74a24d6 100644
--- a/src/nvim/testdir/test_cursor_func.vim
+++ b/src/nvim/testdir/test_cursor_func.vim
@@ -75,7 +75,6 @@ func Test_curswant_with_cursorline()
endfunc
func Test_screenpos()
- throw 'skipped: TODO: '
rightbelow new
rightbelow 20vsplit
call setline(1, ["\tsome text", "long wrapping line here", "next line"])
@@ -103,9 +102,10 @@ func Test_screenpos()
bwipe!
call assert_equal({'col': 1, 'row': 1, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1))
- nmenu WinBar.TEST :
- call assert_equal({'col': 1, 'row': 2, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1))
- nunmenu WinBar.TEST
+ " Needs WinBar
+ " nmenu WinBar.TEST :
+ " call assert_equal({'col': 1, 'row': 2, 'endcol': 1, 'curscol': 1}, screenpos(win_getid(), 1, 1))
+ " nunmenu WinBar.TEST
endfunc
func Test_screenpos_number()
diff --git a/src/nvim/testdir/test_filter_cmd.vim b/src/nvim/testdir/test_filter_cmd.vim
index 0c45db049b..d465e48c7b 100644
--- a/src/nvim/testdir/test_filter_cmd.vim
+++ b/src/nvim/testdir/test_filter_cmd.vim
@@ -145,3 +145,38 @@ func Test_filter_commands()
bwipe! file.h
bwipe! file.hs
endfunc
+
+func Test_filter_display()
+ edit Xdoesnotmatch
+ let @a = '!!willmatch'
+ let @b = '!!doesnotmatch'
+ let @c = "oneline\ntwoline\nwillmatch\n"
+ let @/ = '!!doesnotmatch'
+ call feedkeys(":echo '!!doesnotmatch:'\<CR>", 'ntx')
+ let lines = map(split(execute('filter /willmatch/ display'), "\n"), 'v:val[5:6]')
+
+ call assert_true(index(lines, '"a') >= 0)
+ call assert_false(index(lines, '"b') >= 0)
+ call assert_true(index(lines, '"c') >= 0)
+ call assert_false(index(lines, '"/') >= 0)
+ call assert_false(index(lines, '":') >= 0)
+ call assert_false(index(lines, '"%') >= 0)
+
+ let lines = map(split(execute('filter /doesnotmatch/ display'), "\n"), 'v:val[5:6]')
+ call assert_true(index(lines, '"a') < 0)
+ call assert_false(index(lines, '"b') < 0)
+ call assert_true(index(lines, '"c') < 0)
+ call assert_false(index(lines, '"/') < 0)
+ call assert_false(index(lines, '":') < 0)
+ call assert_false(index(lines, '"%') < 0)
+
+ bwipe!
+endfunc
+
+func Test_filter_scriptnames()
+ let lines = split(execute('filter /test_filter_cmd/ scriptnames'), "\n")
+ call assert_equal(1, len(lines))
+ call assert_match('filter_cmd', lines[0])
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab