@@ -280,30 +280,31 @@ function s:isModifiedSinceLastCall()
280280 let posPrev = s: posLast
281281 let nLinesPrev = s: nLinesLast
282282 let textPrev = s: textLast
283- let postTextPrev = s: postTextLast
284283 endif
285284 let s: posLast = getpos (' .' )
286285 let s: nLinesLast = line (' $' )
287- let s: textLast = s: getCurrentText ()
288- let s: postTextLast = s: getPostText ()
286+ let s: textLast = getline (' .' )
289287 if ! exists (' posPrev' )
290288 return 1
291289 elseif posPrev[1 ] != s: posLast [1 ] || nLinesPrev != s: nLinesLast
292290 return (posPrev[1 ] - s: posLast [1 ] == nLinesPrev - s: nLinesLast )
293- elseif textPrev == # s: textLast || postTextPrev !=# s: postTextLast
291+ elseif textPrev == # s: textLast
294292 return 0
295- elseif has (' gui' ) && has (' multi_byte' ) && ! has (' win32' ) && ! has (' win64' )
296- " NOTE: auto-popup causes a strange behavior when XIM is working
297- return empty (s: textLast ) || char2nr (matchstr (s: textLast , ' .$' )) < 0x80
293+ elseif posPrev[2 ] > s: posLast [2 ]
294+ return 1
295+ elseif has (' gui_running' ) && has (' multi_byte' )
296+ " NOTE: auto-popup causes a strange behavior when IME/XIM is working
297+ return posPrev[2 ] + 1 == s: posLast [2 ]
298298 endif
299- return 1
299+ return posPrev[ 2 ] != s: posLast [ 2 ]
300300endfunction
301301
302302"
303- function s: makeCurrentBehaviorSet (behavsLast, cursorMoved )
304- if exists (' behavsLast[s:iBehavs].repeat' ) && behavsLast[s: iBehavs ].repeat
305- let behavs = [ behavsLast[s: iBehavs ] ]
306- elseif a: cursorMoved
303+ function s: makeCurrentBehaviorSet ()
304+ let modified = s: isModifiedSinceLastCall ()
305+ if exists (' s:behavsCurrent[s:iBehavs].repeat' ) && s: behavsCurrent [s: iBehavs ].repeat
306+ let behavs = [ s: behavsCurrent [s: iBehavs ] ]
307+ elseif modified
307308 let behavs = copy (exists (' g:acp_behavior[&filetype]' )
308309 \ ? g: acp_behavior [&filetype ]
309310 \ : g: acp_behavior [' *' ])
@@ -336,8 +337,7 @@ function s:feedPopup()
336337 return ' '
337338 endif
338339 endif
339- let s: behavsCurrent = s: makeCurrentBehaviorSet (
340- \ s: behavsCurrent , s: isModifiedSinceLastCall ())
340+ let s: behavsCurrent = s: makeCurrentBehaviorSet ()
341341 if empty (s: behavsCurrent )
342342 call s: finishPopup (1 )
343343 return ' '
0 commit comments