summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2010-07-10 16:36:59 +0200
committerBram Moolenaar <Bram@vim.org>2010-07-10 16:36:59 +0200
commit622925875cb9d7f04a764ed8e002e45c3a141e94 (patch)
tree93ae71a2e76b31a927953bb0735f649fb51d6702
parent9c754c4542066bbdf608738b36cf8878dbfd61d6 (diff)
Fix bug: spell menu moved cursor, causing Copy not to work. Spell replacement
didn't work in 'compatible' mode.
-rw-r--r--runtime/doc/todo.txt9
-rw-r--r--runtime/menu.vim12
-rw-r--r--runtime/spell/README.txt22
3 files changed, 33 insertions, 10 deletions
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 038cb571f6..b08d40e367 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1089,13 +1089,13 @@ Patch to support horizontal scroll wheel in GTK. Untested. (Bjorn Winckler,
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 @@ Patches to include:
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)
diff --git a/runtime/menu.vim b/runtime/menu.vim
index 5b5246507c..a9eb818797 100644
--- 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
diff --git a/runtime/spell/README.txt b/runtime/spell/README.txt
index 40837a6005..d427a3c152 100644
--- a/runtime/spell/README.txt
+++ b/runtime/spell/README.txt
@@ -22,6 +22,11 @@ patch and running Vim to generate the .spl file. To do this all in one go use
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 @@ This procedure should work well:
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.