Remove 'textmode' option

'textmode' is an option obsoleted for at least 10 years in favor of
'fileformat'.
This commit is contained in:
Marco Hinz 2014-04-15 16:41:51 +02:00 committed by Thiago de Arruda
parent a53f784738
commit 85b5a75a69
4 changed files with 39 additions and 60 deletions

View File

@ -607,7 +607,6 @@ struct file_buffer {
long b_p_smc; /* 'synmaxcol' */ long b_p_smc; /* 'synmaxcol' */
char_u *b_p_syn; /* 'syntax' */ char_u *b_p_syn; /* 'syntax' */
long b_p_ts; /* 'tabstop' */ long b_p_ts; /* 'tabstop' */
int b_p_tx; /* 'textmode' */
long b_p_tw; /* 'textwidth' */ long b_p_tw; /* 'textwidth' */
long b_p_tw_nobin; /* b_p_tw saved for binary mode */ long b_p_tw_nobin; /* b_p_tw saved for binary mode */
long b_p_tw_nopaste; /* b_p_tw saved for paste mode */ long b_p_tw_nopaste; /* b_p_tw saved for paste mode */

View File

@ -1608,9 +1608,10 @@ rewind_retry:
if (fileformat == EOL_UNKNOWN) if (fileformat == EOL_UNKNOWN)
fileformat = default_fileformat(); fileformat = default_fileformat();
/* if editing a new file: may set p_tx and p_ff */ // May set 'p_ff' if editing a new file.
if (set_options) if (set_options) {
set_fileformat(fileformat, OPT_LOCAL); set_fileformat(fileformat, OPT_LOCAL);
}
} }
} }

View File

@ -1147,41 +1147,41 @@ get_fileformat_force (
return EOL_DOS; return EOL_DOS;
} }
/* /// Set the current end-of-line type to EOL_UNIX, EOL_MAC, or EOL_DOS.
* Set the current end-of-line type to EOL_DOS, EOL_UNIX or EOL_MAC. ///
* Sets both 'textmode' and 'fileformat'. /// Sets 'fileformat'.
* Note: Does _not_ set global value of 'textmode'! ///
*/ /// @param eol_style End-of-line style.
void /// @param opt_flags OPT_LOCAL and/or OPT_GLOBAL
set_fileformat ( void set_fileformat(int eol_style, int opt_flags)
int t,
int opt_flags /* OPT_LOCAL and/or OPT_GLOBAL */
)
{ {
char *p = NULL; char *p = NULL;
switch (t) { switch (eol_style) {
case EOL_DOS: case EOL_UNIX:
p = FF_DOS; p = FF_UNIX;
curbuf->b_p_tx = TRUE; break;
break; case EOL_MAC:
case EOL_UNIX: p = FF_MAC;
p = FF_UNIX; break;
curbuf->b_p_tx = FALSE; case EOL_DOS:
break; p = FF_DOS;
case EOL_MAC: break;
p = FF_MAC;
curbuf->b_p_tx = FALSE;
break;
} }
if (p != NULL)
set_string_option_direct((char_u *)"ff", -1, (char_u *)p,
OPT_FREE | opt_flags, 0);
/* This may cause the buffer to become (un)modified. */ // p is NULL if "eol_style" is EOL_UNKNOWN.
if (p != NULL) {
set_string_option_direct((char_u *)"ff",
-1,
(char_u *)p,
OPT_FREE | opt_flags,
0);
}
// This may cause the buffer to become (un)modified.
check_status(curbuf); check_status(curbuf);
redraw_tabline = TRUE; redraw_tabline = TRUE;
need_maketitle = TRUE; /* set window title later */ need_maketitle = TRUE; // Set window title later.
} }
/* /*

View File

@ -165,7 +165,6 @@
#define PV_TAGS OPT_BOTH(OPT_BUF(BV_TAGS)) #define PV_TAGS OPT_BOTH(OPT_BUF(BV_TAGS))
#define PV_TS OPT_BUF(BV_TS) #define PV_TS OPT_BUF(BV_TS)
#define PV_TW OPT_BUF(BV_TW) #define PV_TW OPT_BUF(BV_TW)
#define PV_TX OPT_BUF(BV_TX)
# define PV_UDF OPT_BUF(BV_UDF) # define PV_UDF OPT_BUF(BV_UDF)
#define PV_WM OPT_BUF(BV_WM) #define PV_WM OPT_BUF(BV_WM)
@ -280,7 +279,6 @@ static char_u *p_spf;
static char_u *p_spl; static char_u *p_spl;
static long p_ts; static long p_ts;
static long p_tw; static long p_tw;
static int p_tx;
static int p_udf; static int p_udf;
static long p_wm; static long p_wm;
static char_u *p_keymap; static char_u *p_keymap;
@ -1587,16 +1585,6 @@ static struct vimoption
(char_u *)&p_ta, PV_NONE, (char_u *)&p_ta, PV_NONE,
{(char_u *)DFLT_TEXTAUTO, (char_u *)TRUE} {(char_u *)DFLT_TEXTAUTO, (char_u *)TRUE}
SCRIPTID_INIT}, SCRIPTID_INIT},
{"textmode", "tx", P_BOOL|P_VI_DEF|P_NO_MKRC,
(char_u *)&p_tx, PV_TX,
{
#ifdef USE_CRNL
(char_u *)TRUE,
#else
(char_u *)FALSE,
#endif
(char_u *)0L
} SCRIPTID_INIT},
{"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM|P_RBUF, {"textwidth", "tw", P_NUM|P_VI_DEF|P_VIM|P_RBUF,
(char_u *)&p_tw, PV_TW, (char_u *)&p_tw, PV_TW,
{(char_u *)0L, (char_u *)0L} SCRIPTID_INIT}, {(char_u *)0L, (char_u *)0L} SCRIPTID_INIT},
@ -4157,11 +4145,6 @@ did_set_string_option (
else if (check_opt_strings(*varp, p_ff_values, FALSE) != OK) else if (check_opt_strings(*varp, p_ff_values, FALSE) != OK)
errmsg = e_invarg; errmsg = e_invarg;
else { else {
/* may also change 'textmode' */
if (get_fileformat(curbuf) == EOL_DOS)
curbuf->b_p_tx = TRUE;
else
curbuf->b_p_tx = FALSE;
redraw_titles(); redraw_titles();
/* update flag in swap file */ /* update flag in swap file */
ml_setflags(curbuf); ml_setflags(curbuf);
@ -5272,16 +5255,14 @@ set_bool_option (
return (char_u *)N_("E590: A preview window already exists"); return (char_u *)N_("E590: A preview window already exists");
} }
} }
// When 'textauto' is set or reset also change 'fileformats'.
} else if ((int *)varp == &p_ta) {
set_string_option_direct((char_u *)"ffs",
-1,
p_ta ? (char_u *)DFLT_FFS_VIM : (char_u *)"",
OPT_FREE | opt_flags,
0);
} }
/* when 'textmode' is set or reset also change 'fileformat' */
else if ((int *)varp == &curbuf->b_p_tx) {
set_fileformat(curbuf->b_p_tx ? EOL_DOS : EOL_UNIX, opt_flags);
}
/* when 'textauto' is set or reset also change 'fileformats' */
else if ((int *)varp == &p_ta)
set_string_option_direct((char_u *)"ffs", -1,
p_ta ? (char_u *)DFLT_FFS_VIM : (char_u *)"",
OPT_FREE | opt_flags, 0);
/* /*
* When 'lisp' option changes include/exclude '-' in * When 'lisp' option changes include/exclude '-' in
@ -6844,7 +6825,6 @@ static char_u *get_varp(struct vimoption *p)
case PV_SW: return (char_u *)&(curbuf->b_p_sw); case PV_SW: return (char_u *)&(curbuf->b_p_sw);
case PV_TS: return (char_u *)&(curbuf->b_p_ts); case PV_TS: return (char_u *)&(curbuf->b_p_ts);
case PV_TW: return (char_u *)&(curbuf->b_p_tw); case PV_TW: return (char_u *)&(curbuf->b_p_tw);
case PV_TX: return (char_u *)&(curbuf->b_p_tx);
case PV_UDF: return (char_u *)&(curbuf->b_p_udf); case PV_UDF: return (char_u *)&(curbuf->b_p_udf);
case PV_WM: return (char_u *)&(curbuf->b_p_wm); case PV_WM: return (char_u *)&(curbuf->b_p_wm);
case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap); case PV_KMAP: return (char_u *)&(curbuf->b_p_keymap);
@ -7030,7 +7010,6 @@ void buf_copy_options(buf_T *buf, int flags)
if (!buf->b_p_initialized) { if (!buf->b_p_initialized) {
free_buf_options(buf, TRUE); free_buf_options(buf, TRUE);
buf->b_p_ro = FALSE; /* don't copy readonly */ buf->b_p_ro = FALSE; /* don't copy readonly */
buf->b_p_tx = p_tx;
buf->b_p_fenc = vim_strsave(p_fenc); buf->b_p_fenc = vim_strsave(p_fenc);
buf->b_p_ff = vim_strsave(p_ff); buf->b_p_ff = vim_strsave(p_ff);
buf->b_p_bh = empty_option; buf->b_p_bh = empty_option;