diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2019-10-02 22:43:59 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-10-02 22:43:59 -0700 |
commit | 30479417e808eac338025dbbfbd3724e158fb344 (patch) | |
tree | a8f0e660fc18436506f323d0e2be0eb3236485b6 /src/nvim/window.c | |
parent | b069e9b20f9e1f24fde34bee7d6e5d95f47ef10d (diff) | |
parent | 4518f230fa84e66737f6fc313fb669984974a1fd (diff) | |
download | rneovim-30479417e808eac338025dbbfbd3724e158fb344.tar.gz rneovim-30479417e808eac338025dbbfbd3724e158fb344.tar.bz2 rneovim-30479417e808eac338025dbbfbd3724e158fb344.zip |
Merge #11087 from janlazo/vim-8.1.0010
vim-patch:8.1.{10,230,315,330,514,517,518,1327,1347,1758,2072,2074,2091,2095,2103}
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r-- | src/nvim/window.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c index 1e6de73549..4d8eaa9dcc 100644 --- a/src/nvim/window.c +++ b/src/nvim/window.c @@ -131,8 +131,20 @@ do_window ( case '^': CHECK_CMDWIN; reset_VIsual_and_resel(); // stop Visual mode - cmd_with_count("split #", (char_u *)cbuf, sizeof(cbuf), Prenum); - do_cmdline_cmd(cbuf); + + if (buflist_findnr(Prenum == 0 ? curwin->w_alt_fnum : Prenum) == NULL) { + if (Prenum == 0) { + EMSG(_(e_noalt)); + } else { + EMSGN(_("E92: Buffer %" PRId64 " not found"), Prenum); + } + break; + } + + if (!curbuf_locked() && win_split(0, 0) == OK) { + (void)buflist_getfile(Prenum == 0 ? curwin->w_alt_fnum : Prenum, + (linenr_T)0, GETF_ALT, false); + } break; /* open new window */ @@ -5598,10 +5610,14 @@ void scroll_to_fraction(win_T *wp, int prev_height) int sline, line_size; int height = wp->w_height_inner; - // Don't change w_topline when height is zero. Don't set w_topline when - // 'scrollbind' is set and this isn't the current window. + // Don't change w_topline in any of these cases: + // - window height is 0 + // - 'scrollbind' is set and this isn't the current window + // - window height is sufficient to display the whole buffer and first line + // is visible. if (height > 0 && (!wp->w_p_scb || wp == curwin) + && (height < wp->w_buffer->b_ml.ml_line_count || wp->w_topline > 1) ) { /* * Find a value for w_topline that shows the cursor at the same |