aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShirasaka <tk.shirasaka@gmail.com>2020-12-05 23:48:59 +0900
committerShirasaka <tk.shirasaka@gmail.com>2020-12-05 23:48:59 +0900
commitbb6229449d87defca4523c11d82bff8cbcad27ca (patch)
treedf046b48c134a98ed7242e272441e417f0ea09f8
parent9601e7c5d5cc455bd6649ece2049a528993f4c79 (diff)
downloadrneovim-bb6229449d87defca4523c11d82bff8cbcad27ca.tar.gz
rneovim-bb6229449d87defca4523c11d82bff8cbcad27ca.tar.bz2
rneovim-bb6229449d87defca4523c11d82bff8cbcad27ca.zip
Moved temporary variable to where it's used
-rw-r--r--src/nvim/window.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index 5a5d3690f6..c415050391 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -3788,7 +3788,6 @@ void free_tabpage(tabpage_T *tp)
int win_new_tabpage(int after, char_u *filename)
{
tabpage_T *old_curtab = curtab;
- tabpage_T *tp = curtab;
tabpage_T *newtp;
int n;
@@ -3800,18 +3799,20 @@ int win_new_tabpage(int after, char_u *filename)
return FAIL;
}
- newtp->tp_localdir = tp->tp_localdir ? vim_strsave(tp->tp_localdir) : NULL;
+ newtp->tp_localdir = old_curtab->tp_localdir ? vim_strsave(old_curtab->tp_localdir) : NULL;
curtab = newtp;
/* Create a new empty window. */
- if (win_alloc_firstwin(tp->tp_curwin) == OK) {
+ if (win_alloc_firstwin(old_curtab->tp_curwin) == OK) {
/* Make the new Tab page the new topframe. */
if (after == 1) {
/* New tab page becomes the first one. */
newtp->tp_next = first_tabpage;
first_tabpage = newtp;
} else {
+ tabpage_T *tp = old_curtab;
+
if (after > 0) {
/* Put new tab page before tab page "after". */
n = 2;