Mercurial > vim
diff src/window.c @ 15006:1fd8e32532f7 v8.1.0514
patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
commit https://github.com/vim/vim/commit/1bbb61948342b5cf6e363629f145c65eb455c388
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat Nov 10 16:02:01 2018 +0100
patch 8.1.0514: CTRL-W ^ does not work when alternate buffer has no name
Problem: CTRL-W ^ does not work when alternate buffer has no name.
Solution: Use another method to split and edit the alternate buffer. (Jason
Franklin)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 10 Nov 2018 16:15:05 +0100 |
parents | 27b9a84395b5 |
children | de63593896b3 |
line wrap: on
line diff
--- a/src/window.c +++ b/src/window.c @@ -151,8 +151,21 @@ do_window( case '^': CHECK_CMDWIN; reset_VIsual_and_resel(); /* stop Visual mode */ - cmd_with_count("split #", 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 %ld 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 */