diff options
author | Bram Moolenaar <Bram@vim.org> | 2020-09-05 15:48:51 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2020-09-05 15:48:51 +0200 |
commit | 8b5866ded6036f7adece26b6d16962bbd2d47842 (patch) | |
tree | a473e6759fd5a5dc6436a6502c0d51ddb077805a /src/edit.c | |
parent | 7dfc5ce7cf4a7f63370d7dce2e13f7410ca0230a (diff) | |
download | vim-git-8b5866ded6036f7adece26b6d16962bbd2d47842.tar.gz |
patch 8.2.1597: the channel source file is too bigv8.2.1597
Problem: The channel source file is too big.
Solution: Move job related code to a new source file.
Diffstat (limited to 'src/edit.c')
-rw-r--r-- | src/edit.c | 84 |
1 files changed, 9 insertions, 75 deletions
diff --git a/src/edit.c b/src/edit.c index 41154389e..2cc0ce05c 100644 --- a/src/edit.c +++ b/src/edit.c @@ -24,9 +24,6 @@ static int compl_busy = FALSE; static void ins_ctrl_v(void); -#ifdef FEAT_JOB_CHANNEL -static void init_prompt(int cmdchar_todo); -#endif static void insert_special(int, int, int); static void redo_literal(int c); static void start_arrow_common(pos_T *end_insert_pos, int change); @@ -1683,82 +1680,19 @@ edit_putchar(int c, int highlight) } } -#if defined(FEAT_JOB_CHANNEL) || defined(PROTO) -/* - * Return the effective prompt for the specified buffer. - */ - char_u * -buf_prompt_text(buf_T* buf) -{ - if (buf->b_prompt_text == NULL) - return (char_u *)"% "; - return buf->b_prompt_text; -} - /* - * Return the effective prompt for the current buffer. + * Set the insert start position for when using a prompt buffer. */ - char_u * -prompt_text(void) -{ - return buf_prompt_text(curbuf); -} - - -/* - * Prepare for prompt mode: Make sure the last line has the prompt text. - * Move the cursor to this line. - */ - static void -init_prompt(int cmdchar_todo) -{ - char_u *prompt = prompt_text(); - char_u *text; - - curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; - text = ml_get_curline(); - if (STRNCMP(text, prompt, STRLEN(prompt)) != 0) - { - // prompt is missing, insert it or append a line with it - if (*text == NUL) - ml_replace(curbuf->b_ml.ml_line_count, prompt, TRUE); - else - ml_append(curbuf->b_ml.ml_line_count, prompt, 0, FALSE); - curwin->w_cursor.lnum = curbuf->b_ml.ml_line_count; - coladvance((colnr_T)MAXCOL); - changed_bytes(curbuf->b_ml.ml_line_count, 0); - } - - // Insert always starts after the prompt, allow editing text after it. - if (Insstart_orig.lnum != curwin->w_cursor.lnum - || Insstart_orig.col != (int)STRLEN(prompt)) - { - Insstart.lnum = curwin->w_cursor.lnum; - Insstart.col = (int)STRLEN(prompt); - Insstart_orig = Insstart; - Insstart_textlen = Insstart.col; - Insstart_blank_vcol = MAXCOL; - arrow_used = FALSE; - } - - if (cmdchar_todo == 'A') - coladvance((colnr_T)MAXCOL); - if (cmdchar_todo == 'I' || curwin->w_cursor.col <= (int)STRLEN(prompt)) - curwin->w_cursor.col = (int)STRLEN(prompt); - // Make sure the cursor is in a valid position. - check_cursor(); -} - -/* - * Return TRUE if the cursor is in the editable position of the prompt line. - */ - int -prompt_curpos_editable() + void +set_insstart(linenr_T lnum, int col) { - return curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count - && curwin->w_cursor.col >= (int)STRLEN(prompt_text()); + Insstart.lnum = lnum; + Insstart.col = col; + Insstart_orig = Insstart; + Insstart_textlen = Insstart.col; + Insstart_blank_vcol = MAXCOL; + arrow_used = FALSE; } -#endif /* * Undo the previous edit_putchar(). |