changeset 2293:e0fabd886db6 vim73

Fix bug: spell menu moved cursor, causing Copy not to work. Spell replacement didn't work in 'compatible' mode.
author Bram Moolenaar <bram@vim.org>
date Sat, 10 Jul 2010 16:36:59 +0200
parents ea3c3f13385c
children 2209060c340d
files runtime/doc/todo.txt runtime/menu.vim runtime/spell/README.txt
diffstat 3 files changed, 33 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1089,13 +1089,13 @@ 2010 Jun 30)
 
 
 Vim 7.3:
-- :s messages concatenate (Tony)
-- Windows XP: copying only gets first letter of bad spelled word. (Cesar
-  Romani, 2010 Jul 7)
 - in August remove UF_VERSION_CRYPT_PREV and UF_VERSION_PREV.
 - Conceal feature: no update when moving to another window. (Dominique Pelle,
   2010 Jul 5)  Vince will look into it.
 Patches to include:
+- Make do_do_join() work faster.  Could at least do a binary search way of
+  doing this.  Hint from Dominique Pelle, Dec 10; Lee Naish, Dec 11.
+  Patch from Milan Vancura, 2010 May 16.
 - Patch for Lisp support with ECL (Mikael Jansson, 2008 Oct 25)
 - Gvimext patch to support wide file names. (Szabolcs Horvat 2008 Sep 10)
 - Patch to support netbeans for Mac. (Kazuki Sakamoto, 2009 Jun 25)
@@ -1133,9 +1133,6 @@ 6   In the quickfix window statusline ad
     Docs patch by Dominique Pelle, Mar 25
     Update 2009 Mar 28.
     Fix for invalid memory access. (Lech Lorens, 2009 Apr 17)
-- Make do_do_join() work faster.  Could at least do a binary search way of
-  doing this.  Hint from Dominique Pelle, Dec 10; Lee Naish, Dec 11.
-  Patch from Milan Vancura, 2010 May 16.
 - Fix for test29. (Milan Vancura, 2010 May 16)
 - Disable setting 'encoding' from a modeline?  It usually causes problems,
   can't do any good.  (Patch from Patrick Texier, 2008 Dec 9)
--- a/runtime/menu.vim
+++ b/runtime/menu.vim
@@ -901,7 +901,6 @@ if has("spell")
     let [w, a] = spellbadword()
     if col('.') > curcol		" don't use word after the cursor
       let w = ''
-      call cursor(0, curcol)	" put the cursor back where it was
     endif
     if w != ''
       if a == 'caps'
@@ -909,12 +908,13 @@ if has("spell")
       else
 	let s:suglist = spellsuggest(w, 10)
       endif
-      if len(s:suglist) <= 0
-	call cursor(0, curcol)	" put the cursor back where it was
-      else
+      if len(s:suglist) > 0
 	let s:changeitem = 'change\ "' . escape(w, ' .'). '"\ to'
 	let s:fromword = w
 	let pri = 1
+	" set 'cpo' to include the <CR>
+	let cpo_save = &cpo
+	set cpo&vim
 	for sug in s:suglist
 	  exe 'anoremenu 1.5.' . pri . ' PopUp.' . s:changeitem . '.' . escape(sug, ' .')
 		\ . ' :call <SID>SpellReplace(' . pri . ')<CR>'
@@ -928,12 +928,16 @@ if has("spell")
 	exe 'anoremenu 1.7 PopUp.' . s:ignoreitem . ' :spellgood! ' . w . '<CR>'
 
 	anoremenu 1.8 PopUp.-SpellSep- :
+	let &cpo = cpo_save
       endif
     endif
+    call cursor(0, curcol)	" put the cursor back where it was
   endfunc
 
   func! <SID>SpellReplace(n)
     let l = getline('.')
+    " Move the cursor to the start of the word.
+    call spellbadword()
     call setline('.', strpart(l, 0, col('.') - 1) . s:suglist[a:n - 1]
 	  \ . strpart(l, col('.') + len(s:fromword) - 1))
   endfunc
--- a/runtime/spell/README.txt
+++ b/runtime/spell/README.txt
@@ -22,6 +22,11 @@ patch and running Vim to generate the .s
 the Aap program (www.a-a-p.org).  It's simple to install, it only requires
 Python.
 
+Before generating spell files, verify your system has the required locale
+support.  Source the check_locales.vim script to find out.  If something is
+missing, see LOCALE below.
+
+
 You can also do it manually:
 1. Fetch the right spell file from:
    http://ftp.services.openoffice.org/pub/OpenOffice.org/contrib/dictionaries
@@ -88,3 +93,20 @@ 4. When OpenOffice makes a new zip file 
    files and finally move the .new.dic to .orig.dic and .new.aff to .orig.aff.
 
 5. Repeat step 4. regularly.
+
+
+LOCALE
+
+For proper spell file generation the required locale must be installed.
+Otherwise Vim doesn't know what are letters and upper-lower case differences.
+Modern systems use UTF-8, but we also generate spell files for 8-bit locales
+for users with older systems.
+
+On Ubuntu the default is to only support locales for your own language.  To
+add others you need to do this:
+	sudo vim /var/lib/locales/supported.d/local
+	    Add needed lines from /usr/share/i18n/SUPPORTED
+	sudo dpkg-reconfigure locales
+
+When using the check_locales.vim script, you need to exit Vim and restart it
+to pickup the newly installed locales.