aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/getchar.c52
-rw-r--r--src/nvim/option.c21
-rw-r--r--src/nvim/option_defs.h1
-rw-r--r--src/nvim/options.lua3
-rw-r--r--src/nvim/optionstr.c18
5 files changed, 3 insertions, 92 deletions
diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c
index ea541dbca4..605705e0e3 100644
--- a/src/nvim/getchar.c
+++ b/src/nvim/getchar.c
@@ -2073,39 +2073,6 @@ static int handle_mapping(int *keylenp, const bool *timedout, int *mapdepth)
}
}
- // Check for match with 'pastetoggle'
- if (*p_pt != NUL && mp == NULL && (State & (MODE_INSERT | MODE_NORMAL))) {
- bool match = typebuf_match_len((uint8_t *)p_pt, &mlen);
- if (match) {
- // write chars to script file(s)
- if (mlen > typebuf.tb_maplen) {
- gotchars(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_maplen,
- (size_t)(mlen - typebuf.tb_maplen));
- }
-
- del_typebuf(mlen, 0); // remove the chars
- set_option_value_give_err("paste", !p_paste, NULL, 0);
- if (!(State & MODE_INSERT)) {
- msg_col = 0;
- msg_row = Rows - 1;
- msg_clr_eos(); // clear ruler
- }
- status_redraw_all();
- redraw_statuslines();
- showmode();
- setcursor();
- *keylenp = keylen;
- return map_result_retry;
- }
- // Need more chars for partly match.
- if (mlen == typebuf.tb_len) {
- keylen = KEYLEN_PART_KEY;
- } else if (max_mlen < mlen) {
- // no match, may have to check for termcode at next character
- max_mlen = mlen + 1;
- }
- }
-
if ((mp == NULL || max_mlen > mp_match_len) && keylen != KEYLEN_PART_MAP) {
// When no matching mapping found or found a non-matching mapping that
// matches at least what the matching mapping matched:
@@ -2116,13 +2083,6 @@ static int handle_mapping(int *keylenp, const bool *timedout, int *mapdepth)
|| (typebuf.tb_buf[typebuf.tb_off + 1] == KS_MODIFIER && typebuf.tb_len < 4))) {
// Incomplete modifier sequence: cannot decide whether to simplify yet.
keylen = KEYLEN_PART_KEY;
- } else if (keylen == KEYLEN_PART_KEY && !*timedout) {
- // If 'pastetoggle' matched partially, don't simplify.
- // When the last characters were not typed, don't wait for a typed character to
- // complete 'pastetoggle'.
- if (typebuf.tb_len == typebuf.tb_maplen) {
- keylen = 0;
- }
} else {
// Try to include the modifier into the key.
keylen = check_simplify_modifier(max_mlen + 1);
@@ -2923,18 +2883,6 @@ int fix_input_buffer(uint8_t *buf, int len)
return len;
}
-static bool typebuf_match_len(const uint8_t *str, int *mlen)
-{
- int i;
- for (i = 0; i < typebuf.tb_len && str[i]; i++) {
- if (str[i] != typebuf.tb_buf[typebuf.tb_off + i]) {
- break;
- }
- }
- *mlen = i;
- return str[i] == NUL; // matched the whole string
-}
-
/// Get command argument for <Cmd> key
char *getcmdkeycmd(int promptc, void *cookie, int indent, bool do_concat)
{
diff --git a/src/nvim/option.c b/src/nvim/option.c
index e4baddbeef..f9b7aa9f99 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -2918,11 +2918,7 @@ getoption_T get_option_value(const char *name, long *numval, char **stringval, u
return gov_hidden_string;
}
if (stringval != NULL) {
- if ((char **)varp == &p_pt) { // 'pastetoggle'
- *stringval = str2special_save(*(char **)(varp), false, false);
- } else {
- *stringval = xstrdup(*(char **)(varp));
- }
+ *stringval = xstrdup(*(char **)(varp));
}
return gov_string;
}
@@ -3532,17 +3528,7 @@ static int put_setstring(FILE *fd, char *cmd, char *name, char **valuep, uint64_
char_u *part = NULL;
if (*valuep != NULL) {
- // Output 'pastetoggle' as key names. For other
- // options some characters have to be escaped with
- // CTRL-V or backslash
- if (valuep == &p_pt) {
- char_u *s = (char_u *)(*valuep);
- while (*s != NUL) {
- if (put_escstr(fd, (char *)str2special((const char **)&s, false, false), 2) == FAIL) {
- return FAIL;
- }
- }
- } else if ((flags & P_EXPAND) != 0) {
+ if ((flags & P_EXPAND) != 0) {
size_t size = (size_t)strlen(*valuep) + 1;
// replace home directory in the whole option value into "buf"
@@ -4990,9 +4976,6 @@ static void option_value2string(vimoption_T *opp, int scope)
NameBuff[0] = NUL;
} else if (opp->flags & P_EXPAND) {
home_replace(NULL, varp, NameBuff, MAXPATHL, false);
- // Translate 'pastetoggle' into special key names.
- } else if ((char **)opp->var == &p_pt) {
- str2specialbuf((const char *)p_pt, NameBuff, MAXPATHL);
} else {
xstrlcpy(NameBuff, varp, MAXPATHL);
}
diff --git a/src/nvim/option_defs.h b/src/nvim/option_defs.h
index 470eae2090..de289fe54e 100644
--- a/src/nvim/option_defs.h
+++ b/src/nvim/option_defs.h
@@ -613,7 +613,6 @@ EXTERN char *p_nf; ///< 'nrformats'
EXTERN char *p_opfunc; // 'operatorfunc'
EXTERN char *p_para; // 'paragraphs'
EXTERN int p_paste; // 'paste'
-EXTERN char *p_pt; // 'pastetoggle'
EXTERN char *p_pex; // 'patchexpr'
EXTERN char *p_pm; // 'patchmode'
EXTERN char *p_path; // 'path'
diff --git a/src/nvim/options.lua b/src/nvim/options.lua
index a4ee114f39..bb673a2c58 100644
--- a/src/nvim/options.lua
+++ b/src/nvim/options.lua
@@ -1685,9 +1685,8 @@ return {
},
{
full_name='pastetoggle', abbreviation='pt',
- short_desc=N_("key code that causes 'paste' to toggle"),
+ short_desc=N_("No description"),
type='string', scope={'global'},
- varname='p_pt',
defaults={if_true=""}
},
{
diff --git a/src/nvim/optionstr.c b/src/nvim/optionstr.c
index 5127bb2097..cba95377a2 100644
--- a/src/nvim/optionstr.c
+++ b/src/nvim/optionstr.c
@@ -1306,22 +1306,6 @@ static void did_set_foldcolumn(char **varp, char **errmsg)
}
}
-static void did_set_pastetoggle(void)
-{
- // 'pastetoggle': translate key codes like in a mapping
- if (*p_pt) {
- char *p = NULL;
- (void)replace_termcodes(p_pt,
- strlen(p_pt),
- &p, REPTERM_FROM_PART | REPTERM_DO_LT, NULL,
- CPO_TO_CPO_FLAGS);
- if (p != NULL) {
- free_string_option(p_pt);
- p_pt = p;
- }
- }
-}
-
static void did_set_backspace(char **errmsg)
{
if (ascii_isdigit(*p_bs)) {
@@ -1778,8 +1762,6 @@ static char *did_set_string_option_for(buf_T *buf, win_T *win, int opt_idx, char
did_set_opt_strings(*varp, p_sloc_values, false, &errmsg);
} else if (gvarp == &win->w_allbuf_opt.wo_fdc) { // 'foldcolumn'
did_set_foldcolumn(varp, &errmsg);
- } else if (varp == &p_pt) { // 'pastetoggle'
- did_set_pastetoggle();
} else if (varp == &p_bs) { // 'backspace'
did_set_backspace(&errmsg);
} else if (varp == &p_bo) {