tabpage_S: Name tp_localdir per convention.

This commit is contained in:
Justin M. Keyes
2017-03-11 17:26:22 +01:00
parent c8f0f8fea6
commit 82117da5df
4 changed files with 11 additions and 13 deletions

View File

@@ -825,8 +825,7 @@ struct tabpage_S {
frame_T *(tp_snapshot[SNAP_COUNT]); ///< window layout snapshots frame_T *(tp_snapshot[SNAP_COUNT]); ///< window layout snapshots
dictitem_T tp_winvar; ///< variable for "t:" Dictionary dictitem_T tp_winvar; ///< variable for "t:" Dictionary
dict_T *tp_vars; ///< internal variables, local to tab page dict_T *tp_vars; ///< internal variables, local to tab page
char_u *localdir; ///< Absolute path of local directory or char_u *tp_localdir; ///< Absolute path of local CWD or NULL
///< NULL
}; };
/* /*

View File

@@ -10901,7 +10901,7 @@ static void f_getcwd(typval_T *argvars, typval_T *rettv, FunPtr fptr)
} }
case kCdScopeTab: // FALLTHROUGH case kCdScopeTab: // FALLTHROUGH
assert(tp); assert(tp);
from = tp->localdir; from = tp->tp_localdir;
if (from) { if (from) {
break; break;
} }
@@ -12015,7 +12015,7 @@ static void f_haslocaldir(typval_T *argvars, typval_T *rettv, FunPtr fptr)
break; break;
case kCdScopeTab: case kCdScopeTab:
assert(tp); assert(tp);
rettv->vval.v_number = tp->localdir ? 1 : 0; rettv->vval.v_number = tp->tp_localdir ? 1 : 0;
break; break;
case kCdScopeGlobal: case kCdScopeGlobal:
// The global scope never has a local directory // The global scope never has a local directory

View File

@@ -6949,8 +6949,8 @@ void post_chdir(CdScope scope)
// Overwrite the local directory of the current tab page for `cd` and `tcd` // Overwrite the local directory of the current tab page for `cd` and `tcd`
if (scope >= kCdScopeTab) { if (scope >= kCdScopeTab) {
xfree(curtab->localdir); xfree(curtab->tp_localdir);
curtab->localdir = NULL; curtab->tp_localdir = NULL;
} }
if (scope < kCdScopeGlobal) { if (scope < kCdScopeGlobal) {
@@ -6970,7 +6970,7 @@ void post_chdir(CdScope scope)
case kCdScopeTab: case kCdScopeTab:
// Remember this local directory for the tab page. // Remember this local directory for the tab page.
if (os_dirname(NameBuff, MAXPATHL) == OK) { if (os_dirname(NameBuff, MAXPATHL) == OK) {
curtab->localdir = vim_strsave(NameBuff); curtab->tp_localdir = vim_strsave(NameBuff);
} }
break; break;
case kCdScopeWindow: case kCdScopeWindow:

View File

@@ -2998,8 +2998,7 @@ void free_tabpage(tabpage_T *tp)
hash_init(&tp->tp_vars->dv_hashtab); hash_init(&tp->tp_vars->dv_hashtab);
unref_var_dict(tp->tp_vars); unref_var_dict(tp->tp_vars);
xfree(tp->tp_localdir);
xfree(tp->localdir); // Free tab-local working directory
xfree(tp); xfree(tp);
} }
@@ -3025,7 +3024,7 @@ int win_new_tabpage(int after, char_u *filename)
return FAIL; return FAIL;
} }
newtp->localdir = tp->localdir ? vim_strsave(tp->localdir) : NULL; newtp->tp_localdir = tp->tp_localdir ? vim_strsave(tp->tp_localdir) : NULL;
curtab = newtp; curtab = newtp;
@@ -3617,9 +3616,9 @@ static void win_enter_ext(win_T *wp, bool undo_sync, int curwin_invalid,
curwin->w_cursor.coladd = 0; curwin->w_cursor.coladd = 0;
changed_line_abv_curs(); /* assume cursor position needs updating */ changed_line_abv_curs(); /* assume cursor position needs updating */
// The new directory is either the local directory of the window, of the tab // The new directory is either the local directory of the window, tab or NULL.
// or NULL. char_u *new_dir = curwin->w_localdir
char_u *new_dir = curwin->w_localdir ? curwin->w_localdir : curtab->localdir; ? curwin->w_localdir : curtab->tp_localdir;
if (new_dir) { if (new_dir) {
// Window/tab has a local directory: Save current directory as global // Window/tab has a local directory: Save current directory as global