Your message dated Fri, 11 Dec 2009 09:24:17 -0500
with message-id <[email protected]>
has caused the   report #560083,
regarding ftplugin/sql imap's <Left> and <Right>
to be marked as having been forwarded to the upstream software
author(s) David Fishburn <[email protected]>

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)


-- 
560083: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=560083
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
David,

The sql ftplugin was changed to always enable the omni_key_right &
omni_key_left maps and default them to <Right>/<Left> so they're
generally available.  Unfortunately, sqlcomplete still uses the previous
values of those variables (<C-Right>/<C-Left>) which means <Right>
doesn't behave properly in insert mode.

Attached patch pushes the pumvisible() logic into the sql ftplugin so it
can be sure the g:ftplugin_sql_omni_key_* variables are set and
therefore maintain the proper behavior for whichever keys are used.

Thanks,

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <[email protected]>
diff --git a/runtime/autoload/sqlcomplete.vim b/runtime/autoload/sqlcomplete.vim
index aae92e6..e631824 100644
--- a/runtime/autoload/sqlcomplete.vim
+++ b/runtime/autoload/sqlcomplete.vim
@@ -385,35 +385,17 @@ function! sqlcomplete#Map(type)
 endfunction
 
 function! sqlcomplete#DrillIntoTable()
-    " If the omni popup window is visible
-    if pumvisible()
-        call sqlcomplete#Map('column')
-        " C-Y, makes the currently highlighted entry active
-        " and trigger the omni popup to be redisplayed
-        call feedkeys("\<C-Y>\<C-X>\<C-O>")
-    else
-        if has('win32')
-            " If the popup is not visible, simple perform the normal
-            " <C-Right> behaviour
-            exec "normal! \<C-Right>"
-        endif
-    endif
+    call sqlcomplete#Map('column')
+    " C-Y, makes the currently highlighted entry active
+    " and trigger the omni popup to be redisplayed
+    call feedkeys("\<C-Y>\<C-X>\<C-O>")
     return ""
 endfunction
 
 function! sqlcomplete#DrillOutOfColumns()
-    " If the omni popup window is visible
-    if pumvisible()
-        call sqlcomplete#Map('tableReset')
-        " Trigger the omni popup to be redisplayed
-        call feedkeys("\<C-X>\<C-O>")
-    else
-        if has('win32')
-            " If the popup is not visible, simple perform the normal
-            " <C-Left> behaviour
-            exec "normal! \<C-Left>"
-        endif
-    endif
+    call sqlcomplete#Map('tableReset')
+    " Trigger the omni popup to be redisplayed
+    call feedkeys("\<C-X>\<C-O>")
     return ""
 endfunction
 
diff --git a/runtime/ftplugin/sql.vim b/runtime/ftplugin/sql.vim
index f41fb5b..0cf1233 100644
--- a/runtime/ftplugin/sql.vim
+++ b/runtime/ftplugin/sql.vim
@@ -446,13 +446,8 @@ if exists('&omnifunc')
         " The next 3 maps are only to be used while the completion window is
         " active due to the <CR> at the beginning of the map
         exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'L <C-Y><C-\><C-O>:call sqlcomplete#Map("column_csv")<CR><C-X><C-O>'
-        " <C-Right> is not recognized on most Unix systems, so only create
-        " these additional maps on the Windows platform.
-        " If you would like to use these maps, choose a different key and make
-        " the same map in your vimrc.
-        " if has('win32')
-        exec 'imap <buffer> '.g:ftplugin_sql_omni_key_right.' <C-R>=sqlcomplete#DrillIntoTable()<CR>'
-        exec 'imap <buffer> '.g:ftplugin_sql_omni_key_left.'  <C-R>=sqlcomplete#DrillOutOfColumns()<CR>'
+        exec 'imap <expr> <buffer> '.g:ftplugin_sql_omni_key_right." pumvisible() ? '<C-R>=sqlcomplete#DrillIntoTable()<CR>' : '".g:ftplugin_sql_omni_key_right."'"
+        exec 'imap <expr> <buffer> '.g:ftplugin_sql_omni_key_left." pumvisible() ? '<C-R>=sqlcomplete#DrillOutOfColumns()<CR>' : '".g:ftplugin_sql_omni_key_left."'"
         " endif
         " Remove any cached items useful for schema changes
         exec 'imap <buffer> '.g:ftplugin_sql_omni_key.'R <C-\><C-O>:call sqlcomplete#Map("resetCache")<CR><C-X><C-O>'

Attachment: signature.asc
Description: Digital signature


--- End Message ---

Reply via email to