Takeshi NISHIDA avatar Takeshi NISHIDA committed 117cbad

Changed to avoid a strange behavior with Microsoft IME

Comments (0)

Files changed (2)

     let posPrev = s:posLast
     let nLinesPrev = s:nLinesLast
     let textPrev = s:textLast
-    let postTextPrev = s:postTextLast
   endif
   let s:posLast = getpos('.')
   let s:nLinesLast = line('$')
-  let s:textLast = s:getCurrentText()
-  let s:postTextLast = s:getPostText()
+  let s:textLast = getline('.')
   if !exists('posPrev')
     return 1
   elseif posPrev[1] != s:posLast[1] || nLinesPrev != s:nLinesLast
     return (posPrev[1] - s:posLast[1] == nLinesPrev - s:nLinesLast)
-  elseif textPrev ==# s:textLast || postTextPrev !=# s:postTextLast
+  elseif textPrev ==# s:textLast
     return 0
-  elseif has('gui') && has('multi_byte') && !has('win32') && !has('win64')
-    " NOTE: auto-popup causes a strange behavior when XIM is working
-    return empty(s:textLast) || char2nr(matchstr(s:textLast, '.$')) < 0x80
+  elseif posPrev[2] > s:posLast[2]
+    return 1
+  elseif has('gui_running') && has('multi_byte')
+    " NOTE: auto-popup causes a strange behavior when IME/XIM is working
+    return posPrev[2] + 1 == s:posLast[2]
   endif
-  return 1
+  return posPrev[2] != s:posLast[2]
 endfunction
 
 "
-function s:makeCurrentBehaviorSet(behavsLast, cursorMoved)
-  if exists('behavsLast[s:iBehavs].repeat') && behavsLast[s:iBehavs].repeat
-    let behavs = [ behavsLast[s:iBehavs] ]
-  elseif a:cursorMoved
+function s:makeCurrentBehaviorSet()
+  let modified = s:isModifiedSinceLastCall()
+  if exists('s:behavsCurrent[s:iBehavs].repeat') && s:behavsCurrent[s:iBehavs].repeat
+    let behavs = [ s:behavsCurrent[s:iBehavs] ]
+  elseif modified
     let behavs = copy(exists('g:acp_behavior[&filetype]')
           \           ? g:acp_behavior[&filetype]
           \           : g:acp_behavior['*'])
       return ''
     endif
   endif
-  let s:behavsCurrent = s:makeCurrentBehaviorSet(
-        \ s:behavsCurrent, s:isModifiedSinceLastCall())
+  let s:behavsCurrent = s:makeCurrentBehaviorSet()
   if empty(s:behavsCurrent)
     call s:finishPopup(1)
     return ''
 ==============================================================================
 CHANGELOG                                                      *acp-changelog*
 
+2.12.1
+  - Changed to avoid a strange behavior with Microsoft IME.
+
 2.12
   - Added g:acp_behaviorKeywordIgnores option.
   - Added g:acp_behaviorUserDefinedMeets option and removed
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.