changeset 45:e474bae3795f

updated for version 7.0027
author vimboss
date Fri, 31 Dec 2004 20:58:58 +0000
parents af1bcb9a13c0
children 46d39f2eff86
files Filelist runtime/filetype.vim runtime/syntax/spec.vim src/ex_cmds2.c src/fold.c src/gui_kde.cc src/ops.c src/proto/gui_motif.pro src/search.c
diffstat 9 files changed, 119 insertions(+), 37 deletions(-) [+]
line wrap: on
line diff
--- a/Filelist
+++ b/Filelist
@@ -153,6 +153,7 @@ SRC_UNIX =	\
 		src/gui_kde_x11.cc \
 		src/kvim_iface.h \
 		src/gui_motif.c \
+		src/gui_xmdlg.c \
 		src/gui_x11.c \
 		src/hangulin.c \
 		src/if_xcmdsrv.c \
@@ -175,6 +176,7 @@ SRC_UNIX =	\
 		src/proto/gui_kde.pro \
 		src/proto/gui_kde_x11.pro \
 		src/proto/gui_motif.pro \
+		src/proto/gui_xmdlg.pro \
 		src/proto/gui_x11.pro \
 		src/proto/hangulin.pro \
 		src/proto/if_xcmdsrv.pro \
--- a/runtime/filetype.vim
+++ b/runtime/filetype.vim
@@ -1,7 +1,7 @@
 " Vim support file to detect file types
 "
 " Maintainer:	Bram Moolenaar <Bram@vim.org>
-" Last Change:	2004 Dec 17
+" Last Change:	2004 Dec 31
 
 " Listen very carefully, I will say this only once
 if exists("did_load_filetypes")
@@ -236,7 +236,7 @@ au BufNewFile,BufRead *.bdf			setf bdf
 au BufNewFile,BufRead *.bib			setf bib
 
 " BIND configuration
-au BufNewFile,BufRead named.conf		setf named
+au BufNewFile,BufRead named.conf,rndc.conf	setf named
 
 " BIND zone
 au BufNewFile,BufRead named.root		setf bindzone
@@ -1748,7 +1748,7 @@ au BufNewFile,BufRead *termcap*
 au BufNewFile,BufRead *vimrc*			setf vim
 
 " Subversion commit file
-au BufNewFile,BufRead svn-commit.*.tmp		setf svn
+au BufNewFile,BufRead svn-commit*.tmp		setf svn
 
 " X resources file
 au BufNewFile,BufRead Xresources*,*/app-defaults/*,*/Xresources/* setf xdefaults
--- a/runtime/syntax/spec.vim
+++ b/runtime/syntax/spec.vim
@@ -3,7 +3,7 @@
 " Language:    SPEC: Build/install scripts for Linux RPM packages
 " Maintainer:  Donovan Rebbechi elflord@pegasus.rutgers.edu
 " URL:	       http://pegasus.rutgers.edu/~elflord/vim/syntax/spec.vim
-" Last Change: Tue Oct  3 17:35:15 BRST 2000 <aurelio@conectiva.com.br>
+" Last Change: Fri Dec 3 11:54 EST 2004 Martin Dalecki
 
 " For version 5.x: Clear all syntax items
 " For version 6.x: Quit when a syntax file was already loaded
@@ -82,8 +82,8 @@ syn keyword specMacroNameLocal contained
 "   Scripts, Files and Changelog
 
 "One line macros - valid in all ScriptAreas
-"tip: remember do include new itens on specScriptArea's skip section
-syn region specSectionMacroArea oneline matchgroup=specSectionMacro start='^%\(define\|patch\d*\|setup\|configure\|GNUconfigure\|find_lang\|makeinstall\)\>' end='$' contains=specCommandOpts,specMacroIdentifier
+"tip: remember do include new items on specScriptArea's skip section
+syn region specSectionMacroArea oneline matchgroup=specSectionMacro start='^%\(define\|patch\d*\|setup\|configure\|GNUconfigure\|find_lang\|makeinstall\|include\)\>' end='$' contains=specCommandOpts,specMacroIdentifier
 syn region specSectionMacroBracketArea oneline matchgroup=specSectionMacro start='^%{\(configure\|GNUconfigure\|find_lang\|makeinstall\)}' end='$' contains=specCommandOpts,specMacroIdentifier
 
 "%% Files Section %%
--- 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));
 
 /*
--- 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;
+	else if (STRNCMP(s, foldendmarker, foldendmarkerlen) == 0)
+	    len = foldendmarkerlen;
+	if (len > 0)
 	{
-	    len = foldstartmarkerlen;
 	    if (VIM_ISDIGIT(s[len]))
 		++len;
-	}
-	else if (STRNCMP(s, foldendmarker, foldendmarkerlen) == 0)
-	{
-	    len = foldendmarkerlen;
-	    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;
--- a/src/gui_kde.cc
+++ b/src/gui_kde.cc
@@ -488,6 +488,57 @@ gui_mch_destroy_scrollbar(scrollbar_T *s
  */
 
 /*
+ * 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;
--- 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
--- 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 *
 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 : */
--- 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);