Evgeny Podjachev avatar Evgeny Podjachev committed 5a44e56

Fixed adding new line after closing history menu by Enter.

Comments (0)

Files changed (1)

 "
 " Version:		1.4.0
 "
-" ChangeLog:	1.4.0:	Added command YATEStationary to look into several tags
+" ChangeLog:	1.4.1:	Better work with history popup.
+"
+" 				1.4.0:	Added command YATEStationary to look into several tags
 "						without reopen YATE buffer.
 " 						Fixed conflict if already there is mapping on Q.
 "
 	exe 'normal dd$'
 
 	if (!exists("s:tags_list")) || (!len(s:tags_list))
-		autocmd CursorMovedI <buffer> call <SID>OnCursorMoved(1)
+		autocmd CursorMovedI <buffer> call <SID>OnCursorMoved(1, 0)
 		return
 	endif
 
 		cal append(counter,str)
 	endfor
 
-	autocmd CursorMovedI <buffer> call <SID>OnCursorMoved(1)
+	autocmd CursorMovedI <buffer> call <SID>OnCursorMoved(1, 0)
 endfun
 
 fun! <SID>ShowHistory()
 	cal <SID>GenerateTagsList(getline('.'),1)
 endfun
 
-fun <SID>OnCursorMoved(ins_mode)
+fun <SID>OnCursorMoved(ins_mode, force_update)
 	if line('.') > 1
 		setlocal cul
 		setlocal noma
 
 		if g:YATE_enable_real_time_search
 			let str=getline('.')
-			if s:user_line!=str 
+			if s:user_line!=str || a:force_update
 				if strlen(str)>=g:YATE_min_symbols_to_search
 					let save_cursor = winsaveview()
 					cal <SID>GenerateTagsList(str,0)
 
 		exe "inoremap <silent> <buffer> <Tab> <C-O>:cal <SID>GenerateTagsListCB()<CR>"
 
-		exe printf("inoremap <expr> <buffer> <Enter> pumvisible() ? '<CR><C-O>:cal <SID>GotoTagE(%d)<CR>' : '<C-O>:cal <SID>GotoTagE(%d)<CR>'", a:stationary, a:stationary)
+		exe printf("inoremap <expr> <buffer> <Enter> pumvisible() ? '<CR><Up><End><C-O>:call <SID>OnCursorMoved(1, 1)<CR>' : '<C-O>:cal <SID>GotoTagE(%d)<CR>'", a:stationary)
 		exe printf("noremap <silent> <buffer> <Enter> :cal <SID>GotoTag('e', %d)<CR>", a:stationary)
 
 		exe printf("noremap <silent> <buffer> <2-leftmouse> :cal <SID>GotoTag('e', %d)<CR>", a:stationary)
 
 			autocmd BufUnload <buffer> exe 'let s:yate_winnr=-1'
 			autocmd BufLeave <buffer> call <SID>OnBufLeave()
-			autocmd CursorMoved <buffer> call <SID>OnCursorMoved(0)
-			autocmd CursorMovedI <buffer> call <SID>OnCursorMoved(1)
+			autocmd CursorMoved <buffer> call <SID>OnCursorMoved(0, 0)
+			autocmd CursorMovedI <buffer> call <SID>OnCursorMoved(1, 0)
 			autocmd VimResized <buffer> call <SID>PrintTagsList()
 			autocmd BufEnter <buffer> call <SID>OnBufEnter()
 		endif
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.