updated for version 7.0219
diff --git a/src/netbeans.c b/src/netbeans.c
index 889ad3c..ded4901 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -100,8 +100,6 @@
 static int cmdno;			/* current command number for reply */
 static int haveConnection = FALSE;	/* socket is connected and
 					   initialization is done */
-static int oldFire = 1;
-
 #ifdef FEAT_GUI_MOTIF
 static void netbeans_Xt_connect __ARGS((void *context));
 #endif
@@ -1439,13 +1437,7 @@
 	}
 	else if (streq((char *)cmd, "insert"))
 	{
-	    pos_T	*pos;
-	    pos_T	mypos;
 	    char_u	*to_free;
-	    char_u	*nl;
-	    linenr_T	lnum;
-	    pos_T	old_w_cursor;
-	    int		old_b_changed;
 
 	    if (skip >= SKIP_STOP)
 	    {
@@ -1475,115 +1467,127 @@
 	    }
 	    else if (args != NULL)
 	    {
-		/*
-		 * We need to detect EOL style
-		 * because addAnno passes char-offset
-		 */
-		int    ff_detected = EOL_UNKNOWN;
-		int    buf_was_empty = (buf->bufp->b_ml.ml_flags & ML_EMPTY);
-		char_u lbuf[4096];  /* size of largest insert sent by exted */
-		int    lbuf_len = 0;
+		int	ff_detected = EOL_UNKNOWN;
+		int	buf_was_empty = (buf->bufp->b_ml.ml_flags & ML_EMPTY);
+		size_t	len = 0;
+		int	added = 0;
+		int	oldFire = netbeansFireChanges;
+		int	old_b_changed;
+		char_u	*nl;
+		linenr_T lnum;
+		linenr_T lnum_start;
+		pos_T	*pos;
 
-		oldFire = netbeansFireChanges;
 		netbeansFireChanges = 0;
-		lbuf[0] = '\0';
 
+		/* Jump to the buffer where we insert.  After this "curbuf"
+		 * can be used. */
 		nb_set_curbuf(buf->bufp);
 		old_b_changed = curbuf->b_changed;
 
+		/* Convert the specified character offset into a lnum/col
+		 * position. */
 		pos = off2pos(curbuf, off);
 		if (pos != NULL)
 		{
-		    if (pos->lnum == 0)
-			pos->lnum = 1;
+		    if (pos->lnum <= 0)
+			lnum_start = 1;
+		    else
+			lnum_start = pos->lnum;
 		}
 		else
 		{
-		    /* if the given position is not found, assume we want
+		    /* If the given position is not found, assume we want
 		     * the end of the file.  See setLocAndSize HACK. */
-		    pos = &mypos;
-		    pos->col = 0;
-#ifdef FEAT_VIRTUALEDIT
-		    pos->coladd = 0;
-#endif
-		    pos->lnum = curbuf->b_ml.ml_line_count;
-		}
-		lnum = pos->lnum;
-		old_w_cursor = curwin->w_cursor;
-		curwin->w_cursor = *pos;
-
-		if (curbuf->b_start_eol == FALSE
-			&& lnum > 0
-			&& lnum <= curbuf->b_ml.ml_line_count)
-		{
-		    /* Append to a partial line */
-		    char_u *partial = ml_get(lnum);
-
-		    STRCPY(lbuf, partial);
-		    lbuf_len = STRLEN(partial);
-		    ml_delete(lnum, FALSE);
-		    buf_was_empty = (curbuf->b_ml.ml_flags & ML_EMPTY);
+		    if (buf_was_empty)
+			lnum_start = 1;	    /* above empty line */
+		    else
+			lnum_start = curbuf->b_ml.ml_line_count + 1;
 		}
 
+		/* "lnum" is the line where we insert: either append to it or
+		 * insert a new line above it. */
+		lnum = lnum_start;
+
+		/* Loop over the "\n" separated lines of the argument. */
 		doupdate = 1;
-		while (*args)
+		while (*args != NUL)
 		{
-		    nl = (char_u *)strchr((char *)args, '\n');
-		    if (nl != NULL)
+		    nl = vim_strchr(args, '\n');
+		    if (nl == NULL)
 		    {
-			STRNCAT(lbuf, args, nl - args);
-			lbuf[lbuf_len + nl - args] = '\0';
-			args += nl - args + 1;
+			/* Incomplete line, probably truncated.  Next "insert"
+			 * command should append to this one. */
+			len = STRLEN(args);
 		    }
 		    else
 		    {
-			STRCPY(lbuf, args);
-			args += STRLEN(lbuf);
+			len = nl - args;
+
+			/*
+			 * We need to detect EOL style, because the commands
+			 * use a character offset.
+			 */
+			if (nl > args && nl[-1] == '\r')
+			{
+			    ff_detected = EOL_DOS;
+			    --len;
+			}
+			else
+			    ff_detected = EOL_UNIX;
+		    }
+		    args[len] = NUL;
+
+		    if (lnum == lnum_start
+			    && ((pos != NULL && pos->col > 0)
+				|| (lnum == 1 && buf_was_empty)))
+		    {
+			char_u *oldline = ml_get(lnum);
+			char_u *newline;
+
+			/* Insert halfway a line.  For simplicity we assume we
+			 * need to append to the line. */
+			newline = alloc_check(STRLEN(oldline) + len + 1);
+			if (newline != NULL)
+			{
+			    STRCPY(newline, oldline);
+			    STRCAT(newline, args);
+			    ml_replace(lnum, newline, FALSE);
+			}
+		    }
+		    else
+		    {
+			/* Append a new line.  Not that we always do this,
+			 * also when the text doesn't end in a "\n". */
+			ml_append((linenr_T)(lnum - 1), args, len + 1, FALSE);
+			++added;
 		    }
 
-		    /*
-		     * EOL detecting. Not sure how to deal with '\n' on Mac.
-		     */
-		    if (buf_was_empty && nl && *(nl - 1) != '\r')
-			ff_detected = EOL_UNIX;
-
-		    /* nbdebug(("    INSERT[%d]: %s\n", lnum, lbuf)); */
-		    ml_append((linenr_T)(lnum++ - 1), lbuf,
-						     STRLEN(lbuf) + 1, FALSE);
-		    lbuf[0] = '\0';	/* empty buffer */
-		    lbuf_len = 0;
+		    if (nl == NULL)
+			break;
+		    ++lnum;
+		    args = nl + 1;
 		}
 
-		if (*(args - 1) == '\n')
-		{
-		    curbuf->b_p_eol = TRUE;
-		    curbuf->b_start_eol = TRUE;
-		}
-		else
-		{
-		    curbuf->b_p_eol = FALSE;
-		    curbuf->b_start_eol = FALSE;
-		}
+		/* Adjust the marks below the inserted lines. */
+		appended_lines_mark(lnum_start - 1, (long)added);
 
-		appended_lines_mark(pos->lnum - 1, lnum - pos->lnum);
-
-		/* We can change initial ff without consequences
-		 * Isn't it a kind of hacking?
+		/*
+		 * When starting with an empty buffer set the fileformat.
+		 * This is just guessing...
 		 */
 		if (buf_was_empty)
 		{
 		    if (ff_detected == EOL_UNKNOWN)
+#if defined(MSDOS) || defined(MSWIN) || defined(OS2)
 			ff_detected = EOL_DOS;
+#else
+			ff_detected = EOL_UNIX;
+#endif
 		    set_fileformat(ff_detected, OPT_LOCAL);
 		    curbuf->b_start_ffc = *curbuf->b_p_ff;
-
-		    /* Safety check: only delete empty line */
-		    if (*ml_get(curbuf->b_ml.ml_line_count) == NUL)
-			ml_delete(curbuf->b_ml.ml_line_count, FALSE);
 		}
 
-		curwin->w_cursor = old_w_cursor;
-
 		/*
 		 * XXX - GRP - Is the next line right? If I've inserted
 		 * text the buffer has been updated but not written. Will
@@ -1592,6 +1596,7 @@
 		curbuf->b_changed = old_b_changed; /* logically unchanged */
 		netbeansFireChanges = oldFire;
 
+		/* Undo info is invalid now... */
 		u_blockfree(curbuf);
 		u_clearall(curbuf);
 	    }
diff --git a/src/normal.c b/src/normal.c
index c59b01f..a2e3e7f 100644
--- a/src/normal.c
+++ b/src/normal.c
@@ -4155,7 +4155,7 @@
 	if (curwin->w_cursor.lnum >= old_pos.lnum)
 	    t = FAIL;	/* match after start is failure too */
 
-	if (thisblock)
+	if (thisblock && t != FAIL)
 	{
 	    pos_T	*pos;
 
diff --git a/src/os_mac.h b/src/os_mac.h
index 82d91a8..22fd164 100644
--- a/src/os_mac.h
+++ b/src/os_mac.h
@@ -40,37 +40,11 @@
 /*
  * Unix interface
  */
-#if defined(__MWERKS__) /* for CodeWarrior */
-# include <unistd.h>
-# include <utsname.h>
-# include <unix.h>
-#endif
 #if defined(__APPLE_CC__) /* for Project Builder and ... */
 # include <unistd.h>
-#endif
 /* Get stat.h or something similar. Comment: How come some OS get in in vim.h */
-#if defined(__MWERKS__)
-# include <stat.h>
-#endif
-#if defined(__APPLE_CC__)
 # include <sys/stat.h>
-#endif
-#if defined(__MRC__) || defined(__SC__) /* for Apple MPW Compilers */
-/* There's no stat.h for MPW? */
-# ifdef powerc
-#  pragma options align=power
-# endif
-  struct stat
-  {
-    UInt32 st_mtime;
-    UInt32 st_mode;
-    UInt32 st_size;
-  };
-# ifdef powerc
-#  pragma options align=reset
-# endif
-#endif
-#if defined(__APPLE_CC__) /* && defined(HAVE_CURSE) */
+/* && defined(HAVE_CURSE) */
 /* The curses.h from MacOS X provides by default some BACKWARD compatibilty
  * definition which can cause us problem later on. So we undefine a few of them. */
 # include <curses.h>
@@ -84,29 +58,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
-#ifdef MACOS_X
-# include <dirent.h>
-#endif
-
-/*
- * Incompatibility checks
- */
-
-/* Got problem trying to use shared library in 68k */
-#if !defined(__POWERPC__) && !defined(__i386__) && defined(FEAT_PYTHON)
-# undef FEAT_PYTHON
-# warning Auto-disabling Python. Not yet supported in 68k.
-#endif
-
-#if !defined(__POWERPC__) && !defined(__ppc__) && !defined(__i386__)
-# if !__option(enumsalwaysint)
-#  error "You must compile with enums always int!"
-# endif
-# if defined(__MWERKS__) && !defined(__fourbyteints__)
-#  error "You must compile the project with 4-byte ints"
-/* MPW ints are always 4 byte long */
-# endif
-#endif
+#include <dirent.h>
 
 /*
  * MacOS specific #define
@@ -120,13 +72,7 @@
  */
 /* When compiled under MacOS X (including CARBON version)
  * we use the Unix File path style.  Also when UNIX is defined. */
-#if defined(UNIX) || (defined(TARGET_API_MAC_OSX) && TARGET_API_MAC_OSX)
-# undef COLON_AS_PATHSEP
 # define USE_UNIXFILENAME
-#else
-# define COLON_AS_PATHSEP
-# define DONT_ADD_PATHSEP_TO_DIR
-#endif
 
 
 /*
@@ -176,67 +122,35 @@
  */
 
 #ifndef SYS_VIMRC_FILE
-# ifdef COLON_AS_PATHSEP
-#  define SYS_VIMRC_FILE "$VIM:vimrc"
-# else
 #  define SYS_VIMRC_FILE "$VIM/vimrc"
-# endif
 #endif
 #ifndef SYS_GVIMRC_FILE
-# ifdef COLON_AS_PATHSEP
-#  define SYS_GVIMRC_FILE "$VIM:gvimrc"
-# else
 #  define SYS_GVIMRC_FILE "$VIM/gvimrc"
-# endif
 #endif
 #ifndef SYS_MENU_FILE
-# ifdef COLON_AS_PATHSEP
-#  define SYS_MENU_FILE	"$VIMRUNTIME:menu.vim"
-# else
 #  define SYS_MENU_FILE	"$VIMRUNTIME/menu.vim"
-# endif
 #endif
 #ifndef SYS_OPTWIN_FILE
-# ifdef COLON_AS_PATHSEP
-#  define SYS_OPTWIN_FILE "$VIMRUNTIME:optwin.vim"
-# else
 #  define SYS_OPTWIN_FILE "$VIMRUNTIME/optwin.vim"
-# endif
 #endif
 #ifndef EVIM_FILE
-# ifdef COLON_AS_PATHSEP
-#  define EVIM_FILE	"$VIMRUNTIME:evim.vim"
-# else
 #  define EVIM_FILE	"$VIMRUNTIME/evim.vim"
-# endif
 #endif
 
 #ifdef FEAT_GUI
 # ifndef USR_GVIMRC_FILE
-#  ifdef COLON_AS_PATHSEP
-#   define USR_GVIMRC_FILE "$VIM:.gvimrc"
-#  else
 #   define USR_GVIMRC_FILE "~/.gvimrc"
-#  endif
 # endif
 # ifndef GVIMRC_FILE
 #  define GVIMRC_FILE	"_gvimrc"
 # endif
 #endif
 #ifndef USR_VIMRC_FILE
-# ifdef COLON_AS_PATHSEP
-#  define USR_VIMRC_FILE	"$VIM:.vimrc"
-# else
 #  define USR_VIMRC_FILE	"~/.vimrc"
-# endif
 #endif
 
 #ifndef USR_EXRC_FILE
-# ifdef COLON_AS_PATHSEP
-#  define USR_EXRC_FILE	"$VIM:.exrc"
-# else
 #  define USR_EXRC_FILE	"~/.exrc"
-# endif
 #endif
 
 #ifndef VIMRC_FILE
@@ -248,11 +162,7 @@
 #endif
 
 #ifndef DFLT_HELPFILE
-# ifdef COLON_AS_PATHSEP
-#  define DFLT_HELPFILE	"$VIMRUNTIME:doc:help.txt"
-# else
 #  define DFLT_HELPFILE	"$VIMRUNTIME/doc/help.txt"
-# endif
 #endif
 
 #ifndef FILETYPE_FILE
@@ -275,20 +185,12 @@
 #endif
 
 #ifndef SYNTAX_FNAME
-# ifdef COLON_AS_PATHSEP
-#  define SYNTAX_FNAME	"$VIMRUNTIME:syntax:%s.vim"
-# else
 #  define SYNTAX_FNAME	"$VIMRUNTIME/syntax/%s.vim"
-# endif
 #endif
 
 #ifdef FEAT_VIMINFO
 # ifndef VIMINFO_FILE
-#  ifdef COLON_AS_PATHSEP
-#   define VIMINFO_FILE	"$VIM:viminfo"
-#  else
 #   define VIMINFO_FILE	"~/.viminfo"
-#  endif
 # endif
 #endif /* FEAT_VIMINFO */
 
@@ -301,21 +203,13 @@
 #endif
 
 #ifndef DFLT_VDIR
-# ifdef COLON_AS_PATHSEP
-#  define DFLT_VDIR	"$VIM:vimfiles:view"	/* default for 'viewdir' */
-# else
 #  define DFLT_VDIR	"$VIM/vimfiles/view"	/* default for 'viewdir' */
-# endif
 #endif
 
 #define DFLT_ERRORFILE		"errors.err"
 
 #ifndef DFLT_RUNTIMEPATH
-# ifdef COLON_AS_PATHSEP
-#  define DFLT_RUNTIMEPATH	"$VIM:vimfiles,$VIMRUNTIME,$VIM:vimfiles:after"
-# else
 #  define DFLT_RUNTIMEPATH	"~/.vim,$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after,~/.vim/after"
-# endif
 #endif
 
 /*
@@ -414,7 +308,3 @@
 #  define TRACE			1 ? (void)0 : printf
 # endif
 #endif
-
-#ifdef MACOS_CLASSIC
-#  define TRACE			1 ? (int)0 : printf
-#endif
diff --git a/src/spell.c b/src/spell.c
index 090b77f..036f60c 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -9756,6 +9756,7 @@
 	selected = prompt_for_number(&mouse_used);
 	if (mouse_used)
 	    selected -= lines_left;
+	lines_left = Rows;	/* avoid more prompt */
     }
 
     if (selected > 0 && selected <= sug.su_ga.ga_len && u_save_cursor() == OK)
diff --git a/src/vim.h b/src/vim.h
index 93c9446..0a08cd6 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -325,11 +325,7 @@
 #ifdef BACKSLASH_IN_FILENAME
 # define PATH_ESC_CHARS ((char_u *)" \t*?[{`%#")
 #else
-# ifdef COLON_AS_PATHSEP
-#  define PATH_ESC_CHARS ((char_u *)" \t*?[{`$%#/")
-# else
-#  define PATH_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|")
-# endif
+# define PATH_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|")
 # define SHELL_ESC_CHARS ((char_u *)" \t*?[{`$\\%#'\"|<>();&!")
 #endif