aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/lua/vim/lsp/util.lua59
-rwxr-xr-xscripts/release.sh3
-rw-r--r--src/nvim/api/buffer.c34
-rw-r--r--src/nvim/screen.c5
-rw-r--r--src/nvim/testdir/test_number.vim25
5 files changed, 49 insertions, 77 deletions
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/api/buffer.c b/src/nvim/api/buffer.c
index f84e8c99a4..b371c08d2a 100644
--- a/src/nvim/api/buffer.c
+++ b/src/nvim/api/buffer.c
@@ -1489,21 +1489,6 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id,
return 0;
}
- size_t len = 0;
- if (line < 0 || line > buf->b_ml.ml_line_count) {
- api_set_error(err, kErrorTypeValidation, "line value outside range");
- return 0;
- } else if (line < buf->b_ml.ml_line_count) {
- len = STRLEN(ml_get_buf(buf, (linenr_T)line+1, false));
- }
-
- if (col == -1) {
- col = (Integer)len;
- } else if (col < -1 || col > (Integer)len) {
- api_set_error(err, kErrorTypeValidation, "col value outside range");
- return 0;
- }
-
bool ephemeral = false;
uint64_t id = 0;
@@ -1674,6 +1659,22 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id,
}
}
+ size_t len = 0;
+ if (line < 0 || line > buf->b_ml.ml_line_count) {
+ api_set_error(err, kErrorTypeValidation, "line value outside range");
+ return 0;
+ } else if (line < buf->b_ml.ml_line_count) {
+ len = ephemeral ? MAXCOL : STRLEN(ml_get_buf(buf, (linenr_T)line+1, false));
+ }
+
+ if (col == -1) {
+ col = (Integer)len;
+ } else if (col < -1 || col > (Integer)len) {
+ api_set_error(err, kErrorTypeValidation, "col value outside range");
+ return 0;
+ }
+
+
// Only error out if they try to set end_right_gravity without
// setting end_col or end_line
if (line2 == -1 && col2 == -1 && end_gravity_set) {
@@ -1684,7 +1685,8 @@ Integer nvim_buf_set_extmark(Buffer buffer, Integer ns_id,
if (col2 >= 0) {
if (line2 >= 0 && line2 < buf->b_ml.ml_line_count) {
- len = STRLEN(ml_get_buf(buf, (linenr_T)line2 + 1, false));
+ len = ephemeral ? MAXCOL : STRLEN(
+ ml_get_buf(buf, (linenr_T)line2 + 1, false));
} else if (line2 == buf->b_ml.ml_line_count) {
// We are trying to add an extmark past final newline
len = 0;
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