summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-01-25 22:12:55 +0000
committerBram Moolenaar <Bram@vim.org>2005-01-25 22:12:55 +0000
commit8f999f1999cc6f4ccaafab36df25b6d6b1d70117 (patch)
treea5f5ed9ea42204f8c229101ced7e3758032871fb /src
parentdf3267e4e1872b2964c8882d9231bafff430f956 (diff)
updated for version 7.0044
Diffstat (limited to 'src')
-rw-r--r--src/edit.c18
-rw-r--r--src/gui_gtk.c6
-rw-r--r--src/option.c7
-rw-r--r--src/option.h8
-rw-r--r--src/structs.h117
5 files changed, 132 insertions, 24 deletions
diff --git a/src/edit.c b/src/edit.c
index 9b3f442e5d..cb2d82a8c1 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -3383,7 +3383,7 @@ ins_complete(c)
temp = complete_col - temp;
}
if (p_ic)
- complete_pat = str_foldcase(tmp_ptr, temp);
+ complete_pat = str_foldcase(tmp_ptr, temp, NULL, 0);
else
complete_pat = vim_strnsave(tmp_ptr, temp);
if (complete_pat == NULL)
@@ -3482,7 +3482,7 @@ ins_complete(c)
if (temp < 0) /* cursor in indent: empty pattern */
temp = 0;
if (p_ic)
- complete_pat = str_foldcase(tmp_ptr, temp);
+ complete_pat = str_foldcase(tmp_ptr, temp, NULL, 0);
else
complete_pat = vim_strnsave(tmp_ptr, temp);
if (complete_pat == NULL)
@@ -6111,15 +6111,15 @@ ins_reg()
++no_u_sync;
if (regname == '=')
{
-#ifdef USE_IM_CONTROL
+# ifdef USE_IM_CONTROL
int im_on = im_get_status();
-#endif
+# endif
regname = get_expr_register();
-#ifdef USE_IM_CONTROL
+# ifdef USE_IM_CONTROL
/* Restore the Input Method. */
if (im_on)
im_set_active(TRUE);
-#endif
+# endif
}
if (regname == NUL)
need_redraw = TRUE; /* remove the '"' */
@@ -6141,6 +6141,12 @@ ins_reg()
vim_beep();
need_redraw = TRUE; /* remove the '"' */
}
+ else if (stop_insert_mode)
+ /* When the '=' register was used and a function was invoked that
+ * did ":stopinsert" then stuff_empty() returns FALSE but we won't
+ * insert anything, need to remove the '"' */
+ need_redraw = TRUE;
+
#ifdef FEAT_EVAL
}
--no_u_sync;
diff --git a/src/gui_gtk.c b/src/gui_gtk.c
index 75103087b3..45271de07f 100644
--- a/src/gui_gtk.c
+++ b/src/gui_gtk.c
@@ -867,7 +867,8 @@ gui_gtk_set_mnemonics(int enable)
gtk_label_set_text_with_mnemonic(GTK_LABEL(menu->label),
(const char *)name);
vim_free(name);
-# elif defined(GTK_USE_ACCEL)
+# else
+# if defined(GTK_USE_ACCEL)
name = translate_mnemonic_tag(menu->name, TRUE);
if (name != NULL)
{
@@ -889,6 +890,7 @@ gui_gtk_set_mnemonics(int enable)
gtk_label_parse_uline(GTK_LABEL(menu->label), (const char *)name);
vim_free(name);
}
+# endif
# endif
}
}
@@ -1880,7 +1882,7 @@ gui_mch_dialog( int type, /* type of dialog */
"clicked",
accel_group,
accel_key, 0,
- 0);
+ (GtkAccelFlags)0);
}
# else
(void)gtk_label_parse_uline(GTK_LABEL(label), (const gchar *)p);
diff --git a/src/option.c b/src/option.c
index 2bfeec3a20..df2f8f547f 100644
--- a/src/option.c
+++ b/src/option.c
@@ -5245,7 +5245,8 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
{
if (errbuf != NULL)
{
- sprintf((char *)errbuf, _("E526: Missing number after <%s>"),
+ sprintf((char *)errbuf,
+ _("E526: Missing number after <%s>"),
transchar_byte(*(s - 1)));
errmsg = errbuf;
}
@@ -9382,7 +9383,7 @@ compatible_set()
# if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
/* Borland C++ screws up loop optimisation here (negri) */
-# pragma option -O-l
+ #pragma option -O-l
# endif
/*
@@ -9403,7 +9404,7 @@ fill_breakat_flags()
}
# if defined(__BORLANDC__) && (__BORLANDC__ < 0x500)
-# pragma option -O.l
+ #pragma option -O.l
# endif
#endif
diff --git a/src/option.h b/src/option.h
index e6f0c0b421..1fb5488d39 100644
--- a/src/option.h
+++ b/src/option.h
@@ -28,10 +28,10 @@
# define DFLT_EFM "%f>%l:%c:%t:%n:%m,%f:%l: %t%*\\D%n: %m,%f %l %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f:%l:%m,%f|%l| %m"
#else
# if defined(MSDOS) || defined(WIN3264)
-# define DFLT_EFM "%f(%l) : %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f(%l) : %m,%*[^ ] %f %l: %m,%f:%l:%m,%f|%l| %m"
+# define DFLT_EFM "%f(%l) : %t%*\\D%n: %m,%*[^\"]\"%f\"%*\\D%l: %m,%f(%l) : %m,%*[^ ] %f %l: %m,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,%f|%l| %m"
# else
# if defined(__EMX__) /* put most common here (i.e. gcc format) at front */
-# define DFLT_EFM "%f:%l:%m,%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%f(%l:%c) : %m,%f|%l| %m"
+# define DFLT_EFM "%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%f(%l:%c) : %m,%f|%l| %m"
# else
# if defined(__QNX__)
# define DFLT_EFM "%f(%l):%*[^WE]%t%*\\D%n:%m,%f|%l| %m"
@@ -40,9 +40,9 @@
# define DFLT_EFM "%A%p^,%C%%CC-%t-%m,%Cat line number %l in file %f,%f|%l| %m"
# else /* Unix, probably */
# ifdef EBCDIC
-#define DFLT_EFM "%*[^ ] %*[^ ] %f:%l%*[ ]%m,%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory `%f',%X%*\\a[%*\\d]: Leaving directory `%f',%DMaking %*\\a in %f,%f|%l| %m"
+#define DFLT_EFM "%*[^ ] %*[^ ] %f:%l%*[ ]%m,%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory `%f',%X%*\\a[%*\\d]: Leaving directory `%f',%DMaking %*\\a in %f,%f|%l| %m"
# else
-#define DFLT_EFM "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory `%f',%X%*\\a[%*\\d]: Leaving directory `%f',%DMaking %*\\a in %f,%f|%l| %m"
+#define DFLT_EFM "%*[^\"]\"%f\"%*\\D%l: %m,\"%f\"%*\\D%l: %m,%-G%f:%l: (Each undeclared identifier is reported only once,%-G%f:%l: for each function it appears in.),%f:%l:%c:%m,%f(%l):%m,%f:%l:%m,\"%f\"\\, line %l%*\\D%c%*[^ ] %m,%D%*\\a[%*\\d]: Entering directory `%f',%X%*\\a[%*\\d]: Leaving directory `%f',%DMaking %*\\a in %f,%f|%l| %m"
# endif
# endif
# endif
diff --git a/src/structs.h b/src/structs.h
index a5e9e8d9ca..19cfbe5751 100644
--- a/src/structs.h
+++ b/src/structs.h
@@ -712,7 +712,7 @@ typedef struct keyentry keyentry_T;
struct keyentry
{
- keyentry_T *next; /* next keyword in the hash list */
+ keyentry_T *ke_next; /* next entry with identical "keyword[]" */
struct sp_syn k_syn; /* struct passed to in_id_list() */
short *next_list; /* ID list for next match (if non-zero) */
short flags; /* see syntax.c */
@@ -921,7 +921,7 @@ typedef struct hashitem_S
{
long_u hi_hash; /* cached hash number of hi_key */
char_u *hi_key;
-} hashitem;
+} hashitem_T;
/* The address of "hash_removed" is used as a magic number for hi_key to
* indicate a removed item. */
@@ -941,10 +941,107 @@ typedef struct hashtable_S
int ht_locked; /* counter for hash_lock() */
int ht_error; /* when set growing failed, can't add more
items before growing works */
- hashitem *ht_array; /* points to the array, allocated when it's
+ hashitem_T *ht_array; /* points to the array, allocated when it's
not "ht_smallarray" */
- hashitem ht_smallarray[HT_INIT_SIZE]; /* initial array */
-} hashtable;
+ hashitem_T ht_smallarray[HT_INIT_SIZE]; /* initial array */
+} hashtab_T;
+
+typedef long_u hash_T; /* Type for hi_hash */
+
+
+#if SIZEOF_INT <= 3 /* use long if int is smaller than 32 bits */
+typedef long varnumber_T;
+#else
+typedef int varnumber_T;
+#endif
+
+typedef struct listvar_S list_T;
+typedef struct dictvar_S dict_T;
+
+/*
+ * Structure to hold an internal variable without a name.
+ */
+typedef struct
+{
+ char v_type; /* see below: VAR_NUMBER, VAR_STRING, etc. */
+ union
+ {
+ varnumber_T v_number; /* number value */
+ char_u *v_string; /* string value (can be NULL!) */
+ list_T *v_list; /* list value (can be NULL!) */
+ dict_T *v_dict; /* dict value (can be NULL!) */
+ } vval;
+} typval_T;
+
+/* Values for "v_type". */
+#define VAR_UNKNOWN 0
+#define VAR_NUMBER 1 /* "v_number" is used */
+#define VAR_STRING 2 /* "v_string" is used */
+#define VAR_FUNC 3 /* "v_string" is function name */
+#define VAR_LIST 4 /* "v_list" is used */
+#define VAR_DICT 5 /* "v_dict" is used */
+
+/*
+ * Structure to hold an item of a list: an internal variable without a name.
+ */
+typedef struct listitem_S listitem_T;
+
+struct listitem_S
+{
+ listitem_T *li_next; /* next item in list */
+ listitem_T *li_prev; /* previous item in list */
+ typval_T li_tv; /* type and value of the variable */
+};
+
+/*
+ * Struct used by those that are using an item in a list.
+ */
+typedef struct listwatch_S listwatch_T;
+
+struct listwatch_S
+{
+ listitem_T *lw_item; /* item being watched */
+ listwatch_T *lw_next; /* next watcher */
+};
+
+/*
+ * Structure to hold info about a list.
+ */
+struct listvar_S
+{
+ int lv_refcount; /* reference count */
+ listitem_T *lv_first; /* first item, NULL if none */
+ listitem_T *lv_last; /* last item, NULL if none */
+ listwatch_T *lv_watch; /* first watcher, NULL if none */
+};
+
+/*
+ * Structure to hold an item of a Dictionary.
+ * Also used for a variable.
+ * The key is copied into "di_key" to avoid an extra alloc/free for it.
+ */
+struct dictitem_S
+{
+ typval_T di_tv; /* type and value of the variable */
+ char_u di_flags; /* flags (only used for variable) */
+ char_u di_key[1]; /* key (actually longer!) */
+};
+
+typedef struct dictitem_S dictitem_T;
+
+#define DI_FLAGS_RO 1 /* "di_flags" value: read-only variable */
+#define DI_FLAGS_RO_SBX 2 /* "di_flags" value: read-only in the sandbox */
+#define DI_FLAGS_FIX 4 /* "di_flags" value: fixed variable, not allocated */
+
+/*
+ * Structure to hold info about a Dictionary.
+ */
+struct dictvar_S
+{
+ int dv_refcount; /* reference count */
+ hashtab_T dv_hashtab; /* hashtab that refers to the items */
+};
+
/*
* buffer: structure that holds information about one file
@@ -1259,7 +1356,8 @@ struct file_buffer
#endif
#ifdef FEAT_EVAL
- hashtable b_vars; /* internal variables, local to buffer */
+ dictitem_T b_bufvar; /* variable for "b:" Dictionary */
+ dict_T b_vars; /* internal variables, local to buffer */
#endif
/* When a buffer is created, it starts without a swap file. b_may_swap is
@@ -1297,8 +1395,8 @@ struct file_buffer
#endif
#ifdef FEAT_SYN_HL
- keyentry_T **b_keywtab; /* syntax keywords hash table */
- keyentry_T **b_keywtab_ic; /* idem, ignore case */
+ hashtab_T b_keywtab; /* syntax keywords hash table */
+ hashtab_T b_keywtab_ic; /* idem, ignore case */
int b_syn_ic; /* ignore case for :syn cmds */
garray_T b_syn_patterns; /* table for syntax patterns */
garray_T b_syn_clusters; /* table for syntax clusters */
@@ -1603,7 +1701,8 @@ struct window
#endif
#ifdef FEAT_EVAL
- hashtable w_vars; /* internal variables, local to window */
+ dictitem_T w_winvar; /* variable for "w:" Dictionary */
+ dict_T w_vars; /* internal variables, local to window */
#endif
#if defined(FEAT_RIGHTLEFT) && defined(FEAT_FKMAP)