mirror of
https://github.com/vim/vim.git
synced 2025-09-27 04:14:06 -04:00
patch 8.2.1597: the channel source file is too big
Problem: The channel source file is too big. Solution: Move job related code to a new source file.
This commit is contained in:
84
src/edit.c
84
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,83 +1680,20 @@ edit_putchar(int c, int highlight)
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(FEAT_JOB_CHANNEL) || defined(PROTO)
|
||||
/*
|
||||
* Return the effective prompt for the specified buffer.
|
||||
* Set the insert start position for when using a prompt buffer.
|
||||
*/
|
||||
char_u *
|
||||
buf_prompt_text(buf_T* buf)
|
||||
void
|
||||
set_insstart(linenr_T lnum, int col)
|
||||
{
|
||||
if (buf->b_prompt_text == NULL)
|
||||
return (char_u *)"% ";
|
||||
return buf->b_prompt_text;
|
||||
Insstart.lnum = lnum;
|
||||
Insstart.col = col;
|
||||
Insstart_orig = Insstart;
|
||||
Insstart_textlen = Insstart.col;
|
||||
Insstart_blank_vcol = MAXCOL;
|
||||
arrow_used = FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Return the effective prompt for the current 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()
|
||||
{
|
||||
return curwin->w_cursor.lnum == curbuf->b_ml.ml_line_count
|
||||
&& curwin->w_cursor.col >= (int)STRLEN(prompt_text());
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Undo the previous edit_putchar().
|
||||
*/
|
||||
|
Reference in New Issue
Block a user