summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2004-12-31 20:58:58 +0000
committerBram Moolenaar <Bram@vim.org>2004-12-31 20:58:58 +0000
commitdef9e829de8bcaf723568e5780c47557e83f99f0 (patch)
treed454cc29b2c6118f26f6911b4dcfcc34847f7b10 /src
parentdfccaf0f00e8308eae09cb8f012fce3e56097f0f (diff)
downloadvim-def9e829de8bcaf723568e5780c47557e83f99f0.zip
updated for version 7.0027
Diffstat (limited to 'src')
-rw-r--r--src/ex_cmds2.c10
-rw-r--r--src/fold.c24
-rw-r--r--src/gui_kde.cc64
-rw-r--r--src/ops.c26
-rw-r--r--src/proto/gui_motif.pro3
-rw-r--r--src/search.c11
6 files changed, 109 insertions, 29 deletions
diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c
index a1831332a..2600a1b24 100644
--- a/src/ex_cmds2.c
+++ b/src/ex_cmds2.c
@@ -6548,10 +6548,12 @@ get_mess_lang()
}
#endif
-#if !defined(LC_MESSAGES) \
- && (((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
- && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE))) \
- || defined(FEAT_EVAL))
+/* Complicated #if; matches with where get_mess_env() is used below. */
+#if (defined(FEAT_EVAL) && !((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
+ && defined(LC_MESSAGES))) \
+ || ((defined(HAVE_LOCALE_H) || defined(X_LOCALE)) \
+ && (defined(FEAT_GETTEXT) || defined(FEAT_MBYTE)) \
+ && !defined(LC_MESSAGES))
static char_u *get_mess_env __ARGS((void));
/*
diff --git a/src/fold.c b/src/fold.c
index 6c3334e2f..0380516d9 100644
--- a/src/fold.c
+++ b/src/fold.c
@@ -2001,6 +2001,7 @@ foldtext_cleanup(str)
char_u *cms_end; /* last part of the comment or NULL */
int cms_elen = 0; /* length of cms_end */
char_u *s;
+ char_u *p;
int len;
int did1 = FALSE;
int did2 = FALSE;
@@ -2033,25 +2034,34 @@ foldtext_cleanup(str)
{
len = 0;
if (STRNCMP(s, curwin->w_p_fmr, foldstartmarkerlen) == 0)
- {
len = foldstartmarkerlen;
- if (VIM_ISDIGIT(s[len]))
- ++len;
- }
else if (STRNCMP(s, foldendmarker, foldendmarkerlen) == 0)
- {
len = foldendmarkerlen;
+ if (len > 0)
+ {
if (VIM_ISDIGIT(s[len]))
++len;
+
+ /* May remove 'commentstring' start. Useful when it's a double
+ * quote and we already removed a double quote. */
+ for (p = s; p > str && vim_iswhite(p[-1]); --p)
+ ;
+ if (p >= str + cms_slen
+ && STRNCMP(p - cms_slen, cms_start, cms_slen) == 0)
+ {
+ len += (s - p) + cms_slen;
+ s = p - cms_slen;
+ }
}
else if (cms_end != NULL)
{
- if (!did1 && STRNCMP(s, cms_start, cms_slen) == 0)
+ if (!did1 && cms_slen > 0 && STRNCMP(s, cms_start, cms_slen) == 0)
{
len = cms_slen;
did1 = TRUE;
}
- else if (!did2 && STRNCMP(s, cms_end, cms_elen) == 0)
+ else if (!did2 && cms_elen > 0
+ && STRNCMP(s, cms_end, cms_elen) == 0)
{
len = cms_elen;
did2 = TRUE;
diff --git a/src/gui_kde.cc b/src/gui_kde.cc
index 62c4ba61a..bbe57f006 100644
--- a/src/gui_kde.cc
+++ b/src/gui_kde.cc
@@ -488,6 +488,57 @@ gui_mch_destroy_scrollbar(scrollbar_T *sb)//{{{
*/
/*
+ * Convert the Vim-style filter specification 's' to the KDE-style
+ * filter specification.
+ * Vim-style: {label}\t{pattern1};{pattern2}\n
+ * KDE-style: {pattern1} {pattern2}|{label}\n
+ *
+ * The newly constructed filter is returned in allocated memory and
+ * must be freed by the calling program.
+ */
+ static char *
+convert_filter(char_u *s)
+{
+ char *res;
+ unsigned i;
+ unsigned pattern_len;
+ char *filter_label;
+ char *filter_pattern;
+
+ // The conversion generates a string of equal length to the original
+ // pattern, so allocate enough memory to hold the original string.
+ res = new char[STRLEN(s) + 1];
+ s = vim_strsave(s);
+ if (res != NULL && s != NULL)
+ {
+ // Make sure the first byte is a NUL so that strcat()
+ // will append at the beginning of the string.
+ res[0] = '\0';
+ filter_label = strtok((char *) s, "\t");
+ while (filter_label != NULL)
+ {
+ filter_pattern = strtok( 0L, "\n");
+ if (filter_pattern != NULL)
+ {
+ pattern_len = (unsigned) STRLEN(filter_pattern);
+ for (i = 0; i < pattern_len; ++i)
+ if (filter_pattern[i] == ';')
+ filter_pattern[i] = ' ';
+
+ strcat(res, filter_pattern);
+ strcat(res, "|");
+ strcat(res, filter_label);
+ strcat(res, "\n");
+ }
+ filter_label = strtok(0L, "\t");
+ }
+ }
+ if (s)
+ vim_free(s);
+ return res;
+}
+
+/*
* Put up a file requester.
* Returns the selected name in allocated memory, or NULL for Cancel.
* saving, select file to write
@@ -508,14 +559,7 @@ gui_mch_browse(int saving,//{{{
{
char *filt_glob;
- if (filter != (char_u *)0x0)
- {
- filter = vim_strsave(filter);
- strtok((char *)filter, "(");
- filt_glob = strtok(0L, ")");
- }
- else
- filt_glob = (char *)filter;
+ filt_glob = convert_filter(filter);
gui_mch_mousehide(FALSE);
@@ -526,8 +570,8 @@ gui_mch_browse(int saving,//{{{
else
s = KFileDialog::getSaveFileName();
- if (filter)
- vim_free(filter);
+ if (filt_glob)
+ delete filt_glob;
if (s.isNull())
return NULL;
diff --git a/src/ops.c b/src/ops.c
index dec5d07c9..1cbb928d2 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -5958,6 +5958,9 @@ cursor_pos_info()
if (VIsual_active
&& lnum >= min_pos.lnum && lnum <= max_pos.lnum)
{
+ char_u *s = NULL;
+ long len = 0L;
+
switch (VIsual_mode)
{
case Ctrl_V:
@@ -5968,12 +5971,12 @@ cursor_pos_info()
# ifdef FEAT_VIRTUALEDIT
virtual_op = MAYBE;
# endif
- char_count_cursor += line_count_info(bd.textstart,
- &word_count_cursor, (long)bd.textlen, eol_size);
+ s = bd.textstart;
+ len = (long)bd.textlen;
break;
case 'V':
- char_count_cursor += line_count_info(ml_get(lnum),
- &word_count_cursor, (long)MAXCOL, eol_size);
+ s = ml_get(lnum);
+ len = MAXCOL;
break;
case 'v':
{
@@ -5982,12 +5985,21 @@ cursor_pos_info()
colnr_T end_col = (lnum == max_pos.lnum)
? max_pos.col - start_col + 1 : MAXCOL;
- char_count_cursor +=
- line_count_info(ml_get(lnum) + start_col,
- &word_count_cursor, (long)end_col, eol_size);
+ s = ml_get(lnum) + start_col;
+ len = end_col;
}
break;
}
+ if (s != NULL)
+ {
+ char_count_cursor += line_count_info(s,
+ &word_count_cursor, len, eol_size);
+ if (lnum == curbuf->b_ml.ml_line_count
+ && !curbuf->b_p_eol
+ && curbuf->b_p_bin
+ && STRLEN(s) < len)
+ char_count_cursor -= eol_size;
+ }
}
else
#endif
diff --git a/src/proto/gui_motif.pro b/src/proto/gui_motif.pro
index cd5d8ab7a..ab5226c9e 100644
--- a/src/proto/gui_motif.pro
+++ b/src/proto/gui_motif.pro
@@ -3,6 +3,7 @@ void gui_x11_create_widgets __ARGS((void));
void gui_x11_destroy_widgets __ARGS((void));
void gui_mch_set_text_area_pos __ARGS((int x, int y, int w, int h));
void gui_x11_set_back_color __ARGS((void));
+void manage_centered __ARGS((Widget dialog_child));
XmFontList gui_motif_create_fontlist __ARGS((XFontStruct *font));
XmFontList gui_motif_fontset2fontlist __ARGS((XFontSet *fontset));
void gui_mch_enable_menu __ARGS((int flag));
@@ -34,6 +35,8 @@ void gui_mch_set_footer __ARGS((char_u *s));
void gui_mch_show_toolbar __ARGS((int showit));
int gui_mch_compute_toolbar_height __ARGS((void));
void gui_mch_get_toolbar_colors __ARGS((Pixel *bgp, Pixel *fgp, Pixel *bsp, Pixel *tsp, Pixel *hsp));
+void gui_motif_menu_fontlist __ARGS((Widget id));
void gui_mch_find_dialog __ARGS((exarg_T *eap));
void gui_mch_replace_dialog __ARGS((exarg_T *eap));
+void gui_motif_synch_fonts __ARGS((void));
/* vim: set ft=c : */
diff --git a/src/search.c b/src/search.c
index 6a915e170..1d1bc3b31 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2367,6 +2367,7 @@ findsent(dir, count)
int startlnum;
int noskip = FALSE; /* do not skip blanks */
int cpo_J;
+ int found_dot;
pos = curwin->w_cursor;
if (dir == FORWARD)
@@ -2404,9 +2405,17 @@ findsent(dir, count)
decl(&pos);
/* go back to the previous non-blank char */
+ found_dot = FALSE;
while ((c = gchar_pos(&pos)) == ' ' || c == '\t' ||
(dir == BACKWARD && vim_strchr((char_u *)".!?)]\"'", c) != NULL))
{
+ if (vim_strchr((char_u *)".!?", c) != NULL)
+ {
+ /* Only skip over a '.', '!' and '?' once. */
+ if (found_dot)
+ break;
+ found_dot = TRUE;
+ }
if (decl(&pos) == -1)
break;
/* when going forward: Stop in front of empty line */
@@ -3315,7 +3324,7 @@ extend:
if (start_blank)
--ncount;
}
- if (ncount)
+ if (ncount > 0)
findsent_forward(ncount, TRUE);
else
decl(&curwin->w_cursor);