Patch 8.1.2331
Problem: The option.c file is still very big.
Solution: Move a few functions to where they fit better. (Yegappan
Lakshmanan, closes #4895)
Files: src/option.c, src/proto/
option.pro, src/change.c,
src/proto/
change.pro, src/ex_getln.c, src/proto/
ex_getln.pro,
src/globals.h, src/gui.c, src/proto/
gui.pro, src/ui.c,
src/proto/
ui.pro, src/term.c, src/proto/
term.pro, src/indent.c,
src/proto/
indent.pro
*** ../vim-8.1.2330/src/option.c 2019-11-12 22:33:32.085004082 +0100
--- src/option.c 2019-11-21 22:07:12.588402635 +0100
***************
*** 37,43 ****
static void set_options_default(int opt_flags);
static void set_string_default_esc(char *name, char_u *val, int escape);
- static char_u *term_bg_default(void);
static char_u *option_expand(int opt_idx, char_u *val);
static void didset_options(void);
static void didset_options2(void);
--- 37,42 ----
***************
*** 800,839 ****
}
/*
- * Return "dark" or "light" depending on the kind of terminal.
- * This is just guessing! Recognized are:
- * "linux" Linux console
- * "screen.linux" Linux console with screen
- * "cygwin.*" Cygwin shell
- * "putty.*" Putty program
- * We also check the COLORFGBG environment variable, which is set by
- * rxvt and derivatives. This variable contains either two or three
- * values separated by semicolons; we want the last value in either
- * case. If this value is 0-6 or 8, our background is dark.
- */
- static char_u *
- term_bg_default(void)
- {
- #if defined(MSWIN)
- /* DOS console is nearly always black */
- return (char_u *)"dark";
- #else
- char_u *p;
-
- if (STRCMP(T_NAME, "linux") == 0
- || STRCMP(T_NAME, "screen.linux") == 0
- || STRNCMP(T_NAME, "cygwin", 6) == 0
- || STRNCMP(T_NAME, "putty", 5) == 0
- || ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL
- && (p = vim_strrchr(p, ';')) != NULL
- && ((p[1] >= '0' && p[1] <= '6') || p[1] == '8')
- && p[2] == NUL))
- return (char_u *)"dark";
- return (char_u *)"light";
- #endif
- }
-
- /*
* Initialize the options, part three: After reading the .vimrc
*/
void
--- 799,804 ----
***************
*** 1057,1087 ****
}
#endif
- #ifdef FEAT_GUI
- static char_u *
- gui_bg_default(void)
- {
- if (gui_get_lightness(gui.back_pixel) < 127)
- return (char_u *)"dark";
- return (char_u *)"light";
- }
-
- /*
- * Option initializations that can only be done after opening the GUI window.
- */
- void
- init_gui_options(void)
- {
- /* Set the 'background' option according to the lightness of the
- * background color, unless the user has set it already. */
- if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0)
- {
- set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0);
- highlight_changed();
- }
- }
- #endif
-
#ifdef FEAT_TITLE
/*
* 'title' and 'icon' only default to true if they have not been set or reset
--- 1022,1027 ----
***************
*** 2177,2205 ****
return *arg;
}
- #if defined(FEAT_CMDWIN) || defined(PROTO)
- /*
- * Check value of 'cedit' and set cedit_key.
- * Returns NULL if value is OK, error message otherwise.
- */
- char *
- check_cedit(void)
- {
- int n;
-
- if (*p_cedit == NUL)
- cedit_key = -1;
- else
- {
- n = string_to_key(p_cedit, FALSE);
- if (vim_isprintc(n))
- return e_invarg;
- cedit_key = n;
- }
- return NULL;
- }
- #endif
-
#ifdef FEAT_TITLE
/*
* When changing 'title', 'titlestring', 'icon' or 'iconstring', call
--- 2117,2122 ----
***************
*** 2508,2606 ****
return TRUE;
}
- #if defined(FEAT_CLIPBOARD) || defined(PROTO)
- /*
- * Extract the items in the 'clipboard' option and set global values.
- * Return an error message or NULL for success.
- */
- char *
- check_clipboard_option(void)
- {
- int new_unnamed = 0;
- int new_autoselect_star = FALSE;
- int new_autoselect_plus = FALSE;
- int new_autoselectml = FALSE;
- int new_html = FALSE;
- regprog_T *new_exclude_prog = NULL;
- char *errmsg = NULL;
- char_u *p;
-
- for (p = p_cb; *p != NUL; )
- {
- if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
- {
- new_unnamed |= CLIP_UNNAMED;
- p += 7;
- }
- else if (STRNCMP(p, "unnamedplus", 11) == 0
- && (p[11] == ',' || p[11] == NUL))
- {
- new_unnamed |= CLIP_UNNAMED_PLUS;
- p += 11;
- }
- else if (STRNCMP(p, "autoselect", 10) == 0
- && (p[10] == ',' || p[10] == NUL))
- {
- new_autoselect_star = TRUE;
- p += 10;
- }
- else if (STRNCMP(p, "autoselectplus", 14) == 0
- && (p[14] == ',' || p[14] == NUL))
- {
- new_autoselect_plus = TRUE;
- p += 14;
- }
- else if (STRNCMP(p, "autoselectml", 12) == 0
- && (p[12] == ',' || p[12] == NUL))
- {
- new_autoselectml = TRUE;
- p += 12;
- }
- else if (STRNCMP(p, "html", 4) == 0 && (p[4] == ',' || p[4] == NUL))
- {
- new_html = TRUE;
- p += 4;
- }
- else if (STRNCMP(p, "exclude:", 8) == 0 && new_exclude_prog == NULL)
- {
- p += 8;
- new_exclude_prog = vim_regcomp(p, RE_MAGIC);
- if (new_exclude_prog == NULL)
- errmsg = e_invarg;
- break;
- }
- else
- {
- errmsg = e_invarg;
- break;
- }
- if (*p == ',')
- ++p;
- }
- if (errmsg == NULL)
- {
- clip_unnamed = new_unnamed;
- clip_autoselect_star = new_autoselect_star;
- clip_autoselect_plus = new_autoselect_plus;
- clip_autoselectml = new_autoselectml;
- clip_html = new_html;
- vim_regfree(clip_exclude_prog);
- clip_exclude_prog = new_exclude_prog;
- #ifdef FEAT_GUI_GTK
- if (gui.in_use)
- {
- gui_gtk_set_selection_targets();
- gui_gtk_set_dnd_targets();
- }
- #endif
- }
- else
- vim_regfree(new_exclude_prog);
-
- return errmsg;
- }
- #endif
-
#if defined(FEAT_EVAL) || defined(PROTO)
/*
* Set the script_ctx for an option, taking care of setting the buffer- or
--- 2425,2430 ----
***************
*** 6983,7042 ****
#endif
/*
- * Read the 'wildmode' option, fill wim_flags[].
- */
- int
- check_opt_wim(void)
- {
- char_u new_wim_flags[4];
- char_u *p;
- int i;
- int idx = 0;
-
- for (i = 0; i < 4; ++i)
- new_wim_flags[i] = 0;
-
- for (p = p_wim; *p; ++p)
- {
- for (i = 0; ASCII_ISALPHA(p[i]); ++i)
- ;
- if (p[i] != NUL && p[i] != ',' && p[i] != ':')
- return FAIL;
- if (i == 7 && STRNCMP(p, "longest", 7) == 0)
- new_wim_flags[idx] |= WIM_LONGEST;
- else if (i == 4 && STRNCMP(p, "full", 4) == 0)
- new_wim_flags[idx] |= WIM_FULL;
- else if (i == 4 && STRNCMP(p, "list", 4) == 0)
- new_wim_flags[idx] |= WIM_LIST;
- else if (i == 8 && STRNCMP(p, "lastused", 8) == 0)
- new_wim_flags[idx] |= WIM_BUFLASTUSED;
- else
- return FAIL;
- p += i;
- if (*p == NUL)
- break;
- if (*p == ',')
- {
- if (idx == 3)
- return FAIL;
- ++idx;
- }
- }
-
- /* fill remaining entries with last flag */
- while (idx < 3)
- {
- new_wim_flags[idx + 1] = new_wim_flags[idx];
- ++idx;
- }
-
- /* only when there are no errors, wim_flags[] is changed */
- for (i = 0; i < 4; ++i)
- wim_flags[i] = new_wim_flags[i];
- return OK;
- }
-
- /*
* Check if backspacing over something is allowed.
*/
int
--- 6807,6812 ----
***************
*** 7057,7113 ****
}
/*
- * Save the current values of 'fileformat' and 'fileencoding', so that we know
- * the file must be considered changed when the value is different.
- */
- void
- save_file_ff(buf_T *buf)
- {
- buf->b_start_ffc = *buf->b_p_ff;
- buf->b_start_eol = buf->b_p_eol;
- buf->b_start_bomb = buf->b_p_bomb;
-
- /* Only use free/alloc when necessary, they take time. */
- if (buf->b_start_fenc == NULL
- || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0)
- {
- vim_free(buf->b_start_fenc);
- buf->b_start_fenc = vim_strsave(buf->b_p_fenc);
- }
- }
-
- /*
- * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
- * from when editing started (save_file_ff() called).
- * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was
- * changed and 'binary' is not set.
- * Also when 'endofline' was changed and 'fixeol' is not set.
- * When "ignore_empty" is true don't consider a new, empty buffer to be
- * changed.
- */
- int
- file_ff_differs(buf_T *buf, int ignore_empty)
- {
- /* In a buffer that was never loaded the options are not valid. */
- if (buf->b_flags & BF_NEVERLOADED)
- return FALSE;
- if (ignore_empty
- && (buf->b_flags & BF_NEW)
- && buf->b_ml.ml_line_count == 1
- && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL)
- return FALSE;
- if (buf->b_start_ffc != *buf->b_p_ff)
- return TRUE;
- if ((buf->b_p_bin || !buf->b_p_fixeol) && buf->b_start_eol != buf->b_p_eol)
- return TRUE;
- if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb)
- return TRUE;
- if (buf->b_start_fenc == NULL)
- return (*buf->b_p_fenc != NUL);
- return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0);
- }
-
- /*
* Return the effective 'scrolloff' value for the current window, using the
* global value when appropriate.
*/
--- 6827,6832 ----
***************
*** 7128,7275 ****
}
/*
- * Check matchpairs option for "*initc".
- * If there is a match set "*initc" to the matching character and "*findc" to
- * the opposite character. Set "*backwards" to the direction.
- * When "switchit" is TRUE swap the direction.
- */
- void
- find_mps_values(
- int *initc,
- int *findc,
- int *backwards,
- int switchit)
- {
- char_u *ptr;
-
- ptr = curbuf->b_p_mps;
- while (*ptr != NUL)
- {
- if (has_mbyte)
- {
- char_u *prev;
-
- if (mb_ptr2char(ptr) == *initc)
- {
- if (switchit)
- {
- *findc = *initc;
- *initc = mb_ptr2char(ptr + mb_ptr2len(ptr) + 1);
- *backwards = TRUE;
- }
- else
- {
- *findc = mb_ptr2char(ptr + mb_ptr2len(ptr) + 1);
- *backwards = FALSE;
- }
- return;
- }
- prev = ptr;
- ptr += mb_ptr2len(ptr) + 1;
- if (mb_ptr2char(ptr) == *initc)
- {
- if (switchit)
- {
- *findc = *initc;
- *initc = mb_ptr2char(prev);
- *backwards = FALSE;
- }
- else
- {
- *findc = mb_ptr2char(prev);
- *backwards = TRUE;
- }
- return;
- }
- ptr += mb_ptr2len(ptr);
- }
- else
- {
- if (*ptr == *initc)
- {
- if (switchit)
- {
- *backwards = TRUE;
- *findc = *initc;
- *initc = ptr[2];
- }
- else
- {
- *backwards = FALSE;
- *findc = ptr[2];
- }
- return;
- }
- ptr += 2;
- if (*ptr == *initc)
- {
- if (switchit)
- {
- *backwards = FALSE;
- *findc = *initc;
- *initc = ptr[-2];
- }
- else
- {
- *backwards = TRUE;
- *findc = ptr[-2];
- }
- return;
- }
- ++ptr;
- }
- if (*ptr == ',')
- ++ptr;
- }
- }
-
- #if defined(FEAT_LINEBREAK) || defined(PROTO)
- /*
- * This is called when 'breakindentopt' is changed and when a window is
- * initialized.
- */
- int
- briopt_check(win_T *wp)
- {
- char_u *p;
- int bri_shift = 0;
- long bri_min = 20;
- int bri_sbr = FALSE;
-
- p = wp->w_p_briopt;
- while (*p != NUL)
- {
- if (STRNCMP(p, "shift:", 6) == 0
- && ((p[6] == '-' && VIM_ISDIGIT(p[7])) || VIM_ISDIGIT(p[6])))
- {
- p += 6;
- bri_shift = getdigits(&p);
- }
- else if (STRNCMP(p, "min:", 4) == 0 && VIM_ISDIGIT(p[4]))
- {
- p += 4;
- bri_min = getdigits(&p);
- }
- else if (STRNCMP(p, "sbr", 3) == 0)
- {
- p += 3;
- bri_sbr = TRUE;
- }
- if (*p != ',' && *p != NUL)
- return FAIL;
- if (*p == ',')
- ++p;
- }
-
- wp->w_p_brishift = bri_shift;
- wp->w_p_brimin = bri_min;
- wp->w_p_brisbr = bri_sbr;
-
- return OK;
- }
- #endif
-
- /*
* Get the local or global value of 'backupcopy'.
*/
unsigned int
--- 6847,6852 ----
*** ../vim-8.1.2330/src/proto/
option.pro 2019-11-12 22:33:32.085004082 +0100
--- src/proto/
option.pro 2019-11-21 22:07:48.791675110 +0100
***************
*** 7,18 ****
void set_init_2(void);
void set_init_3(void);
void set_helplang_default(char_u *lang);
- void init_gui_options(void);
void set_title_defaults(void);
int do_set(char_u *arg, int opt_flags);
void did_set_option(int opt_idx, int opt_flags, int new_value, int value_checked);
int string_to_key(char_u *arg, int multi_byte);
- char *check_cedit(void);
void did_set_title(void);
void set_options_bin(int oldval, int newval, int opt_flags);
void check_options(void);
--- 7,16 ----
***************
*** 21,27 ****
int was_set_insecurely(char_u *opt, int opt_flags);
void redraw_titles(void);
int valid_name(char_u *val, char *allowed);
- char *check_clipboard_option(void);
void set_option_sctx_idx(int opt_idx, int opt_flags, sctx_T script_ctx);
void set_term_option_sctx_idx(char *name, int opt_idx);
void check_redraw(long_u flags);
--- 19,24 ----
***************
*** 71,84 ****
int option_was_set(char_u *name);
int reset_option_was_set(char_u *name);
void fill_breakat_flags(void);
- int check_opt_wim(void);
int can_bs(int what);
- void save_file_ff(buf_T *buf);
- int file_ff_differs(buf_T *buf, int ignore_empty);
long get_scrolloff_value(void);
long get_sidescrolloff_value(void);
- void find_mps_values(int *initc, int *findc, int *backwards, int switchit);
- int briopt_check(win_T *wp);
unsigned int get_bkc_value(buf_T *buf);
char_u *get_showbreak_value(win_T *win);
dict_T *get_winbuf_options(int bufopt);
--- 68,76 ----
*** ../vim-8.1.2330/src/change.c 2019-11-17 17:06:25.820081750 +0100
--- src/change.c 2019-11-21 21:07:43.574270419 +0100
***************
*** 868,873 ****
--- 868,924 ----
}
/*
+ * Save the current values of 'fileformat' and 'fileencoding', so that we know
+ * the file must be considered changed when the value is different.
+ */
+ void
+ save_file_ff(buf_T *buf)
+ {
+ buf->b_start_ffc = *buf->b_p_ff;
+ buf->b_start_eol = buf->b_p_eol;
+ buf->b_start_bomb = buf->b_p_bomb;
+
+ /* Only use free/alloc when necessary, they take time. */
+ if (buf->b_start_fenc == NULL
+ || STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0)
+ {
+ vim_free(buf->b_start_fenc);
+ buf->b_start_fenc = vim_strsave(buf->b_p_fenc);
+ }
+ }
+
+ /*
+ * Return TRUE if 'fileformat' and/or 'fileencoding' has a different value
+ * from when editing started (save_file_ff() called).
+ * Also when 'endofline' was changed and 'binary' is set, or when 'bomb' was
+ * changed and 'binary' is not set.
+ * Also when 'endofline' was changed and 'fixeol' is not set.
+ * When "ignore_empty" is true don't consider a new, empty buffer to be
+ * changed.
+ */
+ int
+ file_ff_differs(buf_T *buf, int ignore_empty)
+ {
+ /* In a buffer that was never loaded the options are not valid. */
+ if (buf->b_flags & BF_NEVERLOADED)
+ return FALSE;
+ if (ignore_empty
+ && (buf->b_flags & BF_NEW)
+ && buf->b_ml.ml_line_count == 1
+ && *ml_get_buf(buf, (linenr_T)1, FALSE) == NUL)
+ return FALSE;
+ if (buf->b_start_ffc != *buf->b_p_ff)
+ return TRUE;
+ if ((buf->b_p_bin || !buf->b_p_fixeol) && buf->b_start_eol != buf->b_p_eol)
+ return TRUE;
+ if (!buf->b_p_bin && buf->b_start_bomb != buf->b_p_bomb)
+ return TRUE;
+ if (buf->b_start_fenc == NULL)
+ return (*buf->b_p_fenc != NUL);
+ return (STRCMP(buf->b_start_fenc, buf->b_p_fenc) != 0);
+ }
+
+ /*
* Insert string "p" at the cursor position. Stops at a NUL byte.
* Handles Replace mode and multi-byte characters.
*/
*** ../vim-8.1.2330/src/proto/
change.pro 2019-10-01 17:01:56.346282798 +0200
--- src/proto/
change.pro 2019-11-21 21:57:21.958985443 +0100
***************
*** 15,20 ****
--- 15,22 ----
void deleted_lines_mark(linenr_T lnum, long count);
void changed_lines(linenr_T lnum, colnr_T col, linenr_T lnume, long xtra);
void unchanged(buf_T *buf, int ff, int always_inc_changedtick);
+ void save_file_ff(buf_T *buf);
+ int file_ff_differs(buf_T *buf, int ignore_empty);
void ins_bytes(char_u *p);
void ins_bytes_len(char_u *p, int len);
void ins_char(int c);
*** ../vim-8.1.2330/src/ex_getln.c 2019-10-27 05:12:38.284773720 +0100
--- src/ex_getln.c 2019-11-21 21:55:00.599131052 +0100
***************
*** 52,57 ****
--- 52,59 ----
#ifdef FEAT_CMDWIN
static int open_cmdwin(void);
+
+ static int cedit_key INIT(= -1); // key value of 'cedit' option
#endif
***************
*** 2460,2465 ****
--- 2462,2521 ----
#endif
/*
+ * Read the 'wildmode' option, fill wim_flags[].
+ */
+ int
+ check_opt_wim(void)
+ {
+ char_u new_wim_flags[4];
+ char_u *p;
+ int i;
+ int idx = 0;
+
+ for (i = 0; i < 4; ++i)
+ new_wim_flags[i] = 0;
+
+ for (p = p_wim; *p; ++p)
+ {
+ for (i = 0; ASCII_ISALPHA(p[i]); ++i)
+ ;
+ if (p[i] != NUL && p[i] != ',' && p[i] != ':')
+ return FAIL;
+ if (i == 7 && STRNCMP(p, "longest", 7) == 0)
+ new_wim_flags[idx] |= WIM_LONGEST;
+ else if (i == 4 && STRNCMP(p, "full", 4) == 0)
+ new_wim_flags[idx] |= WIM_FULL;
+ else if (i == 4 && STRNCMP(p, "list", 4) == 0)
+ new_wim_flags[idx] |= WIM_LIST;
+ else if (i == 8 && STRNCMP(p, "lastused", 8) == 0)
+ new_wim_flags[idx] |= WIM_BUFLASTUSED;
+ else
+ return FAIL;
+ p += i;
+ if (*p == NUL)
+ break;
+ if (*p == ',')
+ {
+ if (idx == 3)
+ return FAIL;
+ ++idx;
+ }
+ }
+
+ /* fill remaining entries with last flag */
+ while (idx < 3)
+ {
+ new_wim_flags[idx + 1] = new_wim_flags[idx];
+ ++idx;
+ }
+
+ /* only when there are no errors, wim_flags[] is changed */
+ for (i = 0; i < 4; ++i)
+ wim_flags[i] = new_wim_flags[i];
+ return OK;
+ }
+
+ /*
* Return TRUE when the text must not be changed and we can't switch to
* another window or buffer. Used when editing the command line, evaluating
* 'balloonexpr', etc.
***************
*** 4028,4033 ****
--- 4084,4110 ----
#if defined(FEAT_CMDWIN) || defined(PROTO)
/*
+ * Check value of 'cedit' and set cedit_key.
+ * Returns NULL if value is OK, error message otherwise.
+ */
+ char *
+ check_cedit(void)
+ {
+ int n;
+
+ if (*p_cedit == NUL)
+ cedit_key = -1;
+ else
+ {
+ n = string_to_key(p_cedit, FALSE);
+ if (vim_isprintc(n))
+ return e_invarg;
+ cedit_key = n;
+ }
+ return NULL;
+ }
+
+ /*
* Open a window on the current command line and history. Allow editing in
* the window. Returns when the window is closed.
* Returns:
*** ../vim-8.1.2330/src/proto/
ex_getln.pro 2019-09-04 17:48:11.712877356 +0200
--- src/proto/
ex_getln.pro 2019-11-21 22:08:13.863193444 +0100
***************
*** 2,7 ****
--- 2,8 ----
void cmdline_init(void);
char_u *getcmdline(int firstc, long count, int indent, int do_concat);
char_u *getcmdline_prompt(int firstc, char_u *prompt, int attr, int xp_context, char_u *xp_arg);
+ int check_opt_wim(void);
int text_locked(void);
void text_locked_msg(void);
char *get_text_locked_msg(void);
***************
*** 35,40 ****
--- 36,42 ----
int get_cmdline_type(void);
int get_cmdline_firstc(void);
int get_list_range(char_u **str, int *num1, int *num2);
+ char *check_cedit(void);
char_u *script_get(exarg_T *eap, char_u *cmd);
void get_user_input(typval_T *argvars, typval_T *rettv, int inputdialog, int secret);
/* vim: set ft=c : */
*** ../vim-8.1.2330/src/globals.h 2019-11-21 17:13:12.628361301 +0100
--- src/globals.h 2019-11-21 21:54:28.943159440 +0100
***************
*** 1249,1255 ****
EXTERN int km_startsel INIT(= FALSE);
#ifdef FEAT_CMDWIN
- EXTERN int cedit_key INIT(= -1); // key value of 'cedit' option
EXTERN int cmdwin_type INIT(= 0); // type of cmdline window or 0
EXTERN int cmdwin_result INIT(= 0); // result of cmdline window or 0
#endif
--- 1249,1254 ----
*** ../vim-8.1.2330/src/gui.c 2019-11-21 17:13:12.624361334 +0100
--- src/gui.c 2019-11-21 21:56:45.727025368 +0100
***************
*** 4742,4747 ****
--- 4742,4770 ----
+ ((rgb & 0xff) * 114)) / 1000;
}
+ char_u *
+ gui_bg_default(void)
+ {
+ if (gui_get_lightness(gui.back_pixel) < 127)
+ return (char_u *)"dark";
+ return (char_u *)"light";
+ }
+
+ /*
+ * Option initializations that can only be done after opening the GUI window.
+ */
+ void
+ init_gui_options(void)
+ {
+ /* Set the 'background' option according to the lightness of the
+ * background color, unless the user has set it already. */
+ if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0)
+ {
+ set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0);
+ highlight_changed();
+ }
+ }
+
#if defined(FEAT_GUI_X11) || defined(PROTO)
void
gui_new_scrollbar_colors(void)
*** ../vim-8.1.2330/src/proto/
gui.pro 2019-11-04 22:52:08.366798096 +0100
--- src/proto/
gui.pro 2019-11-21 21:57:33.278972614 +0100
***************
*** 49,54 ****
--- 49,56 ----
void gui_check_colors(void);
guicolor_T gui_get_color(char_u *name);
int gui_get_lightness(guicolor_T pixel);
+ char_u *gui_bg_default(void);
+ void init_gui_options(void);
void gui_new_scrollbar_colors(void);
void gui_focus_change(int in_focus);
void gui_mouse_moved(int x, int y);
*** ../vim-8.1.2330/src/ui.c 2019-11-21 17:13:12.628361301 +0100
--- src/ui.c 2019-11-21 22:00:32.874750091 +0100
***************
*** 1944,1950 ****
}
#endif
! #endif /* FEAT_CLIPBOARD */
/*****************************************************************************
* Functions that handle the input buffer.
--- 1944,2041 ----
}
#endif
! /*
! * Extract the items in the 'clipboard' option and set global values.
! * Return an error message or NULL for success.
! */
! char *
! check_clipboard_option(void)
! {
! int new_unnamed = 0;
! int new_autoselect_star = FALSE;
! int new_autoselect_plus = FALSE;
! int new_autoselectml = FALSE;
! int new_html = FALSE;
! regprog_T *new_exclude_prog = NULL;
! char *errmsg = NULL;
! char_u *p;
!
! for (p = p_cb; *p != NUL; )
! {
! if (STRNCMP(p, "unnamed", 7) == 0 && (p[7] == ',' || p[7] == NUL))
! {
! new_unnamed |= CLIP_UNNAMED;
! p += 7;
! }
! else if (STRNCMP(p, "unnamedplus", 11) == 0
! && (p[11] == ',' || p[11] == NUL))
! {
! new_unnamed |= CLIP_UNNAMED_PLUS;
! p += 11;
! }
! else if (STRNCMP(p, "autoselect", 10) == 0
! && (p[10] == ',' || p[10] == NUL))
! {
! new_autoselect_star = TRUE;
! p += 10;
! }
! else if (STRNCMP(p, "autoselectplus", 14) == 0
! && (p[14] == ',' || p[14] == NUL))
! {
! new_autoselect_plus = TRUE;
! p += 14;
! }
! else if (STRNCMP(p, "autoselectml", 12) == 0
! && (p[12] == ',' || p[12] == NUL))
! {
! new_autoselectml = TRUE;
! p += 12;
! }
! else if (STRNCMP(p, "html", 4) == 0 && (p[4] == ',' || p[4] == NUL))
! {
! new_html = TRUE;
! p += 4;
! }
! else if (STRNCMP(p, "exclude:", 8) == 0 && new_exclude_prog == NULL)
! {
! p += 8;
! new_exclude_prog = vim_regcomp(p, RE_MAGIC);
! if (new_exclude_prog == NULL)
! errmsg = e_invarg;
! break;
! }
! else
! {
! errmsg = e_invarg;
! break;
! }
! if (*p == ',')
! ++p;
! }
! if (errmsg == NULL)
! {
! clip_unnamed = new_unnamed;
! clip_autoselect_star = new_autoselect_star;
! clip_autoselect_plus = new_autoselect_plus;
! clip_autoselectml = new_autoselectml;
! clip_html = new_html;
! vim_regfree(clip_exclude_prog);
! clip_exclude_prog = new_exclude_prog;
! #ifdef FEAT_GUI_GTK
! if (gui.in_use)
! {
! gui_gtk_set_selection_targets();
! gui_gtk_set_dnd_targets();
! }
! #endif
! }
! else
! vim_regfree(new_exclude_prog);
!
! return errmsg;
! }
!
! #endif // FEAT_CLIPBOARD
/*****************************************************************************
* Functions that handle the input buffer.
*** ../vim-8.1.2330/src/proto/
ui.pro 2019-09-21 20:46:14.728275744 +0200
--- src/proto/
ui.pro 2019-11-21 22:00:50.810726138 +0100
***************
*** 35,40 ****
--- 35,41 ----
void clip_gen_set_selection(Clipboard_T *cbd);
void clip_gen_request_selection(Clipboard_T *cbd);
int clip_gen_owner_exists(Clipboard_T *cbd);
+ char *check_clipboard_option(void);
int vim_is_input_buf_full(void);
int vim_is_input_buf_empty(void);
int vim_free_in_input_buf(void);
***************
*** 43,49 ****
void set_input_buf(char_u *p);
void add_to_input_buf(char_u *s, int len);
void add_to_input_buf_csi(char_u *str, int len);
- void push_raw_key(char_u *s, int len);
void trash_input_buf(void);
int read_from_input_buf(char_u *buf, long maxlen);
void fill_input_buf(int exit_on_error);
--- 44,49 ----
*** ../vim-8.1.2330/src/term.c 2019-11-17 17:06:25.828081709 +0100
--- src/term.c 2019-11-21 22:02:43.526569752 +0100
***************
*** 2898,2903 ****
--- 2898,2937 ----
term_color(T_CSB, n);
}
+ /*
+ * Return "dark" or "light" depending on the kind of terminal.
+ * This is just guessing! Recognized are:
+ * "linux" Linux console
+ * "screen.linux" Linux console with screen
+ * "cygwin.*" Cygwin shell
+ * "putty.*" Putty program
+ * We also check the COLORFGBG environment variable, which is set by
+ * rxvt and derivatives. This variable contains either two or three
+ * values separated by semicolons; we want the last value in either
+ * case. If this value is 0-6 or 8, our background is dark.
+ */
+ char_u *
+ term_bg_default(void)
+ {
+ #if defined(MSWIN)
+ /* DOS console is nearly always black */
+ return (char_u *)"dark";
+ #else
+ char_u *p;
+
+ if (STRCMP(T_NAME, "linux") == 0
+ || STRCMP(T_NAME, "screen.linux") == 0
+ || STRNCMP(T_NAME, "cygwin", 6) == 0
+ || STRNCMP(T_NAME, "putty", 5) == 0
+ || ((p = mch_getenv((char_u *)"COLORFGBG")) != NULL
+ && (p = vim_strrchr(p, ';')) != NULL
+ && ((p[1] >= '0' && p[1] <= '6') || p[1] == '8')
+ && p[2] == NUL))
+ return (char_u *)"dark";
+ return (char_u *)"light";
+ #endif
+ }
+
#if defined(FEAT_TERMGUICOLORS) || defined(PROTO)
#define RED(rgb) (((long_u)(rgb) >> 16) & 0xFF)
*** ../vim-8.1.2330/src/proto/
term.pro 2019-10-13 16:43:35.960359646 +0200
--- src/proto/
term.pro 2019-11-21 22:03:15.350313444 +0100
***************
*** 25,30 ****
--- 25,31 ----
void term_set_winsize(int height, int width);
void term_fg_color(int n);
void term_bg_color(int n);
+ char_u *term_bg_default(void);
void term_fg_rgb_color(guicolor_T rgb);
void term_bg_rgb_color(guicolor_T rgb);
void term_settitle(char_u *title);
*** ../vim-8.1.2330/src/indent.c 2019-11-16 13:50:18.777646751 +0100
--- src/indent.c 2019-11-21 22:07:19.576259155 +0100
***************
*** 839,844 ****
--- 839,888 ----
#if defined(FEAT_LINEBREAK) || defined(PROTO)
/*
+ * This is called when 'breakindentopt' is changed and when a window is
+ * initialized.
+ */
+ int
+ briopt_check(win_T *wp)
+ {
+ char_u *p;
+ int bri_shift = 0;
+ long bri_min = 20;
+ int bri_sbr = FALSE;
+
+ p = wp->w_p_briopt;
+ while (*p != NUL)
+ {
+ if (STRNCMP(p, "shift:", 6) == 0
+ && ((p[6] == '-' && VIM_ISDIGIT(p[7])) || VIM_ISDIGIT(p[6])))
+ {
+ p += 6;
+ bri_shift = getdigits(&p);
+ }
+ else if (STRNCMP(p, "min:", 4) == 0 && VIM_ISDIGIT(p[4]))
+ {
+ p += 4;
+ bri_min = getdigits(&p);
+ }
+ else if (STRNCMP(p, "sbr", 3) == 0)
+ {
+ p += 3;
+ bri_sbr = TRUE;
+ }
+ if (*p != ',' && *p != NUL)
+ return FAIL;
+ if (*p == ',')
+ ++p;
+ }
+
+ wp->w_p_brishift = bri_shift;
+ wp->w_p_brimin = bri_min;
+ wp->w_p_brisbr = bri_sbr;
+
+ return OK;
+ }
+
+ /*
* Return appropriate space number for breakindent, taking influencing
* parameters into account. Window must be specified, since it is not
* necessarily always the current one.
*** ../vim-8.1.2330/src/proto/
indent.pro 2019-10-09 22:52:49.000043746 +0200
--- src/proto/
indent.pro 2019-11-21 22:07:39.371860695 +0100
***************
*** 18,23 ****
--- 18,24 ----
int get_indent_str_vtab(char_u *ptr, int ts, int *vts, int list);
int set_indent(int size, int flags);
int get_number_indent(linenr_T lnum);
+ int briopt_check(win_T *wp);
int get_breakindent_win(win_T *wp, char_u *line);
int inindent(int extra);
void op_reindent(oparg_T *oap, int (*how)(void));
*** ../vim-8.1.2330/src/version.c 2019-11-21 20:55:22.221163407 +0100
--- src/version.c 2019-11-21 22:08:22.635029011 +0100
***************
*** 739,740 ****
--- 739,742 ----
{ /* Add new patch number below this line */
+ /**/
+ 2331,
/**/
--
To be rich is not the end, but only a change of worries.
/// Bram Moolenaar -- Br...@Moolenaar.net --
http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features --
http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language --
http://www.Zimbu.org ///
\\\ help me help AIDS victims --
http://ICCF-Holland.org ///