diff options
-rw-r--r-- | .github/workflows/release.yml | 11 | ||||
-rw-r--r-- | runtime/doc/lsp.txt | 4 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/buf.lua | 6 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/diagnostic.lua | 2 | ||||
-rw-r--r-- | runtime/lua/vim/lsp/util.lua | 59 | ||||
-rwxr-xr-x | scripts/release.sh | 3 | ||||
-rw-r--r-- | src/nvim/screen.c | 5 | ||||
-rw-r--r-- | src/nvim/testdir/test_number.vim | 25 |
8 files changed, 46 insertions, 69 deletions
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8c2333e68d..def934c597 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -13,6 +13,7 @@ on: - v[0-9]+.[0-9]+.[0-9]+ # Build on the oldest supported images, so we have broader compatibility +# Upgrade to gcc-11 to prevent it from using its builtins (#14150) jobs: linux: runs-on: ubuntu-18.04 @@ -26,11 +27,11 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y autoconf automake build-essential cmake gettext gperf libtool-bin locales ninja-build pkg-config unzip + sudo apt-get install -y autoconf automake build-essential cmake gcc-11 gettext gperf libtool-bin locales ninja-build pkg-config unzip - name: Build release id: build run: | - make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH=" + CC=gcc-11 make CMAKE_BUILD_TYPE=RelWithDebInfo CMAKE_EXTRA_FLAGS="-DCMAKE_INSTALL_PREFIX:PATH=" printf '::set-output name=version::%s\n' "$(./build/bin/nvim --version | head -n 3 | sed -z 's/\n/%0A/g')" printf '::set-output name=release::%s\n' "$(./build/bin/nvim --version | head -n 1)" make DESTDIR="$GITHUB_WORKSPACE/build/release/nvim-linux64" install @@ -51,11 +52,11 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y autoconf automake build-essential cmake gettext gperf libtool-bin locales ninja-build pkg-config unzip + sudo apt-get install -y autoconf automake build-essential cmake gcc-11 gettext gperf libtool-bin locales ninja-build pkg-config unzip - if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name != 'nightly') - run: make appimage-latest + run: CC=gcc-11 make appimage-latest - if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && github.event.inputs.tag_name == 'nightly') - run: make appimage-nightly + run: CC=gcc-11 make appimage-nightly - uses: actions/upload-artifact@v2 with: name: appimage diff --git a/runtime/doc/lsp.txt b/runtime/doc/lsp.txt index 55873331c0..aa95245bd0 100644 --- a/runtime/doc/lsp.txt +++ b/runtime/doc/lsp.txt @@ -1547,6 +1547,10 @@ show_line_diagnostics({opts}, {bufnr}, {line_nr}, {client_id}) {opts} table Configuration table • show_header (boolean, default true): Show "Diagnostics:" header. + • Plus all the opts for + |vim.lsp.diagnostic.get_line_diagnostics()| + and |vim.lsp.util.open_floating_preview()| + can be used here. {bufnr} number The buffer number {line_nr} number The line number {client_id} number|nil the client id diff --git a/runtime/lua/vim/lsp/buf.lua b/runtime/lua/vim/lsp/buf.lua index c63b947c99..ad5a348d4c 100644 --- a/runtime/lua/vim/lsp/buf.lua +++ b/runtime/lua/vim/lsp/buf.lua @@ -156,7 +156,7 @@ function M.formatting(options) if client == nil then return end local params = util.make_formatting_params(options) - return client.request("textDocument/formatting", params) + return client.request("textDocument/formatting", params, nil, vim.api.nvim_get_current_buf()) end --- Performs |vim.lsp.buf.formatting()| synchronously. @@ -176,7 +176,7 @@ function M.formatting_sync(options, timeout_ms) if client == nil then return end local params = util.make_formatting_params(options) - local result, err = client.request_sync("textDocument/formatting", params, timeout_ms) + local result, err = client.request_sync("textDocument/formatting", params, timeout_ms, vim.api.nvim_get_current_buf()) if result and result.result then util.apply_text_edits(result.result) elseif err then @@ -218,7 +218,7 @@ function M.formatting_seq_sync(options, timeout_ms, order) for _, client in ipairs(clients) do if client.resolved_capabilities.document_formatting then local params = util.make_formatting_params(options) - local result, err = client.request_sync("textDocument/formatting", params, timeout_ms) + local result, err = client.request_sync("textDocument/formatting", params, timeout_ms, vim.api.nvim_get_current_buf()) if result and result.result then util.apply_text_edits(result.result) elseif err then diff --git a/runtime/lua/vim/lsp/diagnostic.lua b/runtime/lua/vim/lsp/diagnostic.lua index d4580885db..e4acfd0711 100644 --- a/runtime/lua/vim/lsp/diagnostic.lua +++ b/runtime/lua/vim/lsp/diagnostic.lua @@ -1123,6 +1123,8 @@ end --- </pre> ---@param opts table Configuration table --- - show_header (boolean, default true): Show "Diagnostics:" header. +--- - Plus all the opts for |vim.lsp.diagnostic.get_line_diagnostics()| +--- and |vim.lsp.util.open_floating_preview()| can be used here. ---@param bufnr number The buffer number ---@param line_nr number The line number ---@param client_id number|nil the client id diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua index 326005dac4..7c0132822e 100644 --- a/runtime/lua/vim/lsp/util.lua +++ b/runtime/lua/vim/lsp/util.lua @@ -867,7 +867,7 @@ function M.convert_signature_help_to_markdown_lines(signature_help, ft) end local label = signature.label if ft then - -- wrap inside a code block so fancy_markdown can render it properly + -- wrap inside a code block so stylize_markdown can render it properly label = ("```%s\n%s\n```"):format(ft, label) end vim.list_extend(contents, vim.split(label, '\n', true)) @@ -1011,7 +1011,7 @@ function M.preview_location(location, opts) local syntax = api.nvim_buf_get_option(bufnr, 'syntax') if syntax == "" then -- When no syntax is set, we use filetype as fallback. This might not result - -- in a valid syntax definition. See also ft detection in fancy_floating_win. + -- in a valid syntax definition. See also ft detection in stylize_markdown. -- An empty syntax is more common now with TreeSitter, since TS disables syntax. syntax = api.nvim_buf_get_option(bufnr, 'filetype') end @@ -1029,53 +1029,6 @@ local function find_window_by_var(name, value) end end ---- Enters/leaves the focusable window associated with the current buffer via the ---window - variable `unique_name`. If no such window exists, run the function ---{fn}. ---- ---@param unique_name (string) Window variable ---@param fn (function) should return create a new window and return a tuple of ----({focusable_buffer_id}, {window_id}). if {focusable_buffer_id} is a valid ----buffer id, the newly created window will be the new focus associated with ----the current buffer via the tag `unique_name`. ---@returns (pbufnr, pwinnr) if `fn()` has created a new window; nil otherwise ----@deprecated please use open_floating_preview directly -function M.focusable_float(unique_name, fn) - vim.notify("focusable_float is deprecated. Please use open_floating_preview and pass focus_id = [unique_name] instead", vim.log.levels.WARN) - -- Go back to previous window if we are in a focusable one - if npcall(api.nvim_win_get_var, 0, unique_name) then - return api.nvim_command("wincmd p") - end - local bufnr = api.nvim_get_current_buf() - do - local win = find_window_by_var(unique_name, bufnr) - if win and api.nvim_win_is_valid(win) and vim.fn.pumvisible() == 0 then - api.nvim_set_current_win(win) - api.nvim_command("stopinsert") - return - end - end - local pbufnr, pwinnr = fn() - if pbufnr then - api.nvim_win_set_var(pwinnr, unique_name, bufnr) - return pbufnr, pwinnr - end -end - ---- Focuses/unfocuses the floating preview window associated with the current ---- buffer via the window variable `unique_name`. If no such preview window ---- exists, makes a new one. ---- ---@param unique_name (string) Window variable ---@param fn (function) The return values of this function will be passed ----directly to |vim.lsp.util.open_floating_preview()|, in the case that a new ----floating window should be created ----@deprecated please use open_floating_preview directly -function M.focusable_preview(unique_name, fn) - vim.notify("focusable_preview is deprecated. Please use open_floating_preview and pass focus_id = [unique_name] instead", vim.log.levels.WARN) - return M.open_floating_preview(fn(), {focus_id = unique_name}) -end - --- Trims empty lines from input and pad top and bottom with empty lines --- ---@param contents table of lines to trim and pad @@ -1103,14 +1056,6 @@ function M._trim(contents, opts) return contents end - - ---- @deprecated please use open_floating_preview directly -function M.fancy_floating_markdown(contents, opts) - vim.notify("fancy_floating_markdown is deprecated. Please use open_floating_preview and pass focus_id = [unique_name] instead", vim.log.levels.WARN) - return M.open_floating_preview(contents, "markdown", opts) -end - --- Converts markdown into syntax highlighted regions by stripping the code --- blocks and converting them into highlighted code. --- This will by default insert a blank line separator after those code block diff --git a/scripts/release.sh b/scripts/release.sh index 5b4902a2d7..4d1484b77a 100755 --- a/scripts/release.sh +++ b/scripts/release.sh @@ -64,10 +64,9 @@ _do_release_commit() { if ! test "$ARG1" = '--use-current-commit' ; then echo "Building changelog since ${__LAST_TAG}..." - __CHANGELOG="$(./scripts/git-log-pretty-since.sh "$__LAST_TAG" 'vim-patch:[^[:space:]]')" git add CMakeLists.txt - git commit --edit -m "${__RELEASE_MSG} ${__CHANGELOG}" + (echo "${__RELEASE_MSG}"; ./scripts/git-log-pretty-since.sh "$__LAST_TAG" 'vim-patch:[^[:space:]]') | git commit --edit -F - fi git tag --sign -a v"${__VERSION}" -m "NVIM v${__VERSION}" diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 5c494d5066..04157a0154 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -2757,8 +2757,9 @@ static int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, } if (wp->w_p_rl) { // reverse line numbers // like rl_mirror(), but keep the space at the end - char_u *p2 = skiptowhite(extra) - 1; - for (char_u *p1 = extra; p1 < p2; p1++, p2--) { + char_u *p2 = skipwhite(extra); + p2 = skiptowhite(p2) - 1; + for (char_u *p1 = skipwhite(extra); p1 < p2; p1++, p2--) { const int t = *p1; *p1 = *p2; *p2 = t; diff --git a/src/nvim/testdir/test_number.vim b/src/nvim/testdir/test_number.vim index 81326bce14..eaabe3f67e 100644 --- a/src/nvim/testdir/test_number.vim +++ b/src/nvim/testdir/test_number.vim @@ -1,5 +1,6 @@ " Test for 'number' and 'relativenumber' +source check.vim source view_util.vim func s:screen_lines(start, end) abort @@ -263,3 +264,27 @@ func Test_relativenumber_uninitialised() redraw bwipe! endfunc + +" Test for displaying line numbers with 'rightleft' +func Test_number_rightleft() + CheckFeature rightleft + new + setlocal number + setlocal rightleft + call setline(1, range(1, 1000)) + normal! 9Gzt + redraw! + call assert_match('^\s\+9 9$', Screenline(1)) + normal! 10Gzt + redraw! + call assert_match('^\s\+01 10$', Screenline(1)) + normal! 100Gzt + redraw! + call assert_match('^\s\+001 100$', Screenline(1)) + normal! 1000Gzt + redraw! + call assert_match('^\s\+0001 1000$', Screenline(1)) + bw! +endfunc + +" vim: shiftwidth=2 sts=2 expandtab |