aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--runtime/autoload/health.vim24
-rw-r--r--runtime/autoload/health/nvim.vim8
-rw-r--r--runtime/autoload/health/provider.vim8
-rw-r--r--src/nvim/screen.c100
-rw-r--r--src/nvim/testdir/test_put.vim11
5 files changed, 39 insertions, 112 deletions
diff --git a/runtime/autoload/health.vim b/runtime/autoload/health.vim
index 53d45afc2e..56ae2071e9 100644
--- a/runtime/autoload/health.vim
+++ b/runtime/autoload/health.vim
@@ -93,26 +93,26 @@ function! s:help_to_link(s) abort
return substitute(a:s, '\v:h%[elp] ([^|][^"\r\n ]+)', ':help |\1|', 'g')
endfunction
-" Format a message for a specific report item
+" Format a message for a specific report item.
+" a:1: Optional advice (string or list)
function! s:format_report_message(status, msg, ...) abort " {{{
let output = ' - ' . a:status . ': ' . s:indent_after_line1(a:msg, 4)
- let advice = []
" Optional parameters
if a:0 > 0
- let advice = type(a:1) == type("") ? [a:1] : a:1
+ let advice = type(a:1) == type('') ? [a:1] : a:1
if type(advice) != type([])
- throw "Expected String or List"
+ throw 'a:1: expected String or List'
endif
- endif
- " Report each suggestion
- if len(advice) > 0
- let output .= "\n - ADVICE:"
+ " Report each suggestion
+ if !empty(advice)
+ let output .= "\n - ADVICE:"
+ for suggestion in advice
+ let output .= "\n - " . s:indent_after_line1(suggestion, 10)
+ endfor
+ endif
endif
- for suggestion in advice
- let output .= "\n - " . s:indent_after_line1(suggestion, 10)
- endfor
return s:help_to_link(output)
endfunction " }}}
@@ -128,6 +128,7 @@ function! health#report_ok(msg) abort " {{{
endfunction " }}}
" Reports a health warning.
+" a:1: Optional advice (string or list)
function! health#report_warn(msg, ...) abort " {{{
if a:0 > 0
echo s:format_report_message('WARNING', a:msg, a:1)
@@ -137,6 +138,7 @@ function! health#report_warn(msg, ...) abort " {{{
endfunction " }}}
" Reports a failed healthcheck.
+" a:1: Optional advice (string or list)
function! health#report_error(msg, ...) abort " {{{
if a:0 > 0
echo s:format_report_message('ERROR', a:msg, a:1)
diff --git a/runtime/autoload/health/nvim.vim b/runtime/autoload/health/nvim.vim
index 017c047ef4..d09a714719 100644
--- a/runtime/autoload/health/nvim.vim
+++ b/runtime/autoload/health/nvim.vim
@@ -7,12 +7,12 @@ function! s:check_config() abort
" If $VIM is empty we don't care. Else make sure it is valid.
if !empty($VIM) && !filereadable($VIM.'/runtime/doc/nvim.txt')
let ok = v:false
- call health#report_error("$VIM is invalid: ".$VIM)
+ call health#report_error('$VIM is invalid: '.$VIM)
endif
if exists('$NVIM_TUI_ENABLE_CURSOR_SHAPE')
let ok = v:false
- call health#report_warn("$NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+",
+ call health#report_warn('$NVIM_TUI_ENABLE_CURSOR_SHAPE is ignored in Nvim 0.2+',
\ [ "Use the 'guicursor' option to configure cursor shape. :help 'guicursor'",
\ 'https://github.com/neovim/neovim/wiki/Following-HEAD#20170402' ])
endif
@@ -100,8 +100,8 @@ function! s:check_performance() abort
else
call health#report_info(buildtype)
call health#report_warn(
- \ "Non-optimized build-type. Nvim will be slower.",
- \ ["Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.",
+ \ 'Non-optimized build-type. Nvim will be slower.',
+ \ ['Install a different Nvim package, or rebuild with `CMAKE_BUILD_TYPE=RelWithDebInfo`.',
\ s:suggest_faq])
endif
endfunction
diff --git a/runtime/autoload/health/provider.vim b/runtime/autoload/health/provider.vim
index 073dcf92a8..e18125300c 100644
--- a/runtime/autoload/health/provider.vim
+++ b/runtime/autoload/health/provider.vim
@@ -260,8 +260,7 @@ function! s:check_python(version) abort
let python_multiple = []
if exists(loaded_var) && !exists('*provider#'.pyname.'#Call')
- call health#report_info('Disabled. '.loaded_var.'='.eval(loaded_var))
- return
+ call health#report_info('Disabled ('.loaded_var.'='.eval(loaded_var).'). This might be due to some previous error.')
endif
if !empty(pyenv)
@@ -289,9 +288,6 @@ function! s:check_python(version) abort
if empty(pyname)
call health#report_warn('No Python interpreter was found with the neovim '
\ . 'module. Using the first available for diagnostics.')
- if !empty(pythonx_errs)
- call health#report_warn(pythonx_errs)
- endif
endif
if !empty(pyname)
@@ -457,7 +453,7 @@ function! s:check_ruby() abort
let host = provider#ruby#Detect()
if empty(host)
- call health#report_warn("`neovim-ruby-host` not found.",
+ call health#report_warn('`neovim-ruby-host` not found.',
\ ['Run `gem install neovim` to ensure the neovim RubyGem is installed.',
\ 'Run `gem environment` to ensure the gem bin directory is in $PATH.',
\ 'If you are using rvm/rbenv/chruby, try "rehashing".',
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index 238d9a92a6..2b4317fd49 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -6445,64 +6445,11 @@ void setcursor(void)
/// Returns FAIL if the lines are not inserted, OK for success.
int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear)
{
- int did_delete;
- int nextrow;
- int lastrow;
- int retval;
-
- if (invalid)
- wp->w_lines_valid = 0;
-
- if (wp->w_height < 5)
- return FAIL;
-
- if (line_count > wp->w_height - row)
- line_count = wp->w_height - row;
-
- retval = win_do_lines(wp, row, line_count, mayclear, FALSE);
- if (retval != MAYBE)
- return retval;
-
- /*
- * If there is a next window or a status line, we first try to delete the
- * lines at the bottom to avoid messing what is after the window.
- * If this fails and there are following windows, don't do anything to avoid
- * messing up those windows, better just redraw.
- */
- did_delete = FALSE;
- if (wp->w_next != NULL || wp->w_status_height) {
- if (screen_del_lines(0, wp->w_winrow + wp->w_height - line_count,
- line_count, (int)Rows, NULL) == OK)
- did_delete = TRUE;
- else if (wp->w_next)
- return FAIL;
- }
- /*
- * if no lines deleted, blank the lines that will end up below the window
- */
- if (!did_delete) {
- wp->w_redr_status = TRUE;
- redraw_cmdline = TRUE;
- nextrow = wp->w_winrow + wp->w_height + wp->w_status_height;
- lastrow = nextrow + line_count;
- if (lastrow > Rows)
- lastrow = Rows;
- screen_fill(nextrow - line_count, lastrow - line_count,
- wp->w_wincol, W_ENDCOL(wp),
- ' ', ' ', 0);
- }
-
- if (screen_ins_lines(0, wp->w_winrow + row, line_count, (int)Rows, NULL)
- == FAIL) {
- /* deletion will have messed up other windows */
- if (did_delete) {
- wp->w_redr_status = TRUE;
- win_rest_invalid(wp->w_next);
- }
+ if (wp->w_height < 5) {
return FAIL;
}
- return OK;
+ return win_do_lines(wp, row, line_count, invalid, mayclear, false);
}
/// Delete "line_count" window lines at "row" in window "wp".
@@ -6512,47 +6459,18 @@ int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear)
/// Return OK for success, FAIL if the lines are not deleted.
int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear)
{
- int retval;
-
- if (invalid)
- wp->w_lines_valid = 0;
-
- if (line_count > wp->w_height - row)
- line_count = wp->w_height - row;
-
- retval = win_do_lines(wp, row, line_count, mayclear, TRUE);
- if (retval != MAYBE)
- return retval;
-
- if (screen_del_lines(0, wp->w_winrow + row, line_count,
- (int)Rows, NULL) == FAIL) {
- return FAIL;
- }
-
- /*
- * If there are windows or status lines below, try to put them at the
- * correct place. If we can't do that, they have to be redrawn.
- */
- if (wp->w_next || wp->w_status_height || cmdline_row < Rows - 1) {
- if (screen_ins_lines(0, wp->w_winrow + wp->w_height - line_count,
- line_count, (int)Rows, NULL) == FAIL) {
- wp->w_redr_status = TRUE;
- win_rest_invalid(wp->w_next);
- }
- }
- /*
- * If this is the last window and there is no status line, redraw the
- * command line later.
- */
- else
- redraw_cmdline = TRUE;
- return OK;
+ return win_do_lines(wp, row, line_count, invalid, mayclear, true);
}
// Common code for win_ins_lines() and win_del_lines().
// Returns OK or FAIL when the work has been done.
-static int win_do_lines(win_T *wp, int row, int line_count, int mayclear, int del)
+static int win_do_lines(win_T *wp, int row, int line_count,
+ int invalid, int mayclear, int del)
{
+ if (invalid) {
+ wp->w_lines_valid = 0;
+ }
+
if (!redrawing() || line_count <= 0) {
return FAIL;
}
diff --git a/src/nvim/testdir/test_put.vim b/src/nvim/testdir/test_put.vim
index 612bdabb6c..0154de1ec0 100644
--- a/src/nvim/testdir/test_put.vim
+++ b/src/nvim/testdir/test_put.vim
@@ -10,3 +10,14 @@ func Test_put_block()
call assert_equal("\u2500x", getline(1))
bwipe!
endfunc
+
+func Test_put_char_block()
+ new
+ call setline(1, ['Line 1', 'Line 2'])
+ f Xfile_put
+ " visually select both lines and put the cursor at the top of the visual
+ " selection and then put the buffer name over it
+ exe "norm! G0\<c-v>ke\"%p"
+ call assert_equal(['Xfile_put 1', 'Xfile_put 2'], getline(1,2))
+ bw!
+endfunc