On Aug 26, 8:01 pm, ZyX <[email protected]> wrote: > Reply to message «getchar() blocks the output», > sent 17:50:08 26 August 2011, Friday > by sinbad: > > > basically i want to display a list of choices for the user and based > > on the users input i will take some action. so the lines 7-8 will > > actually list the users with some choices in a new window. but the > > window is not getting opened because of getchar(), according to > > the code that's what suppose to happen. why getchar() is blocking > > output, is there any way around this. > > In this code getchar() is not blocking an output, &lazyredraw option should be > the cause. If you want to use buffer and not :echo or input()/inputlist(), > then > you should put explicit :redraw before getchar() call. Or :redraw! if without > a > bang does not work. > > Original message: > > > > > > > > > hi, > > > i've the following function. > > > 1 fun! Dosome() > > 2 vertical botright new > > 3 setlocal buftype=nofile bufhidden=wipe nobuflisted noswapfile > > 4 setlocal nowrap > > 5 setlocal nonu > > 6 > > 7 for m in g:list > > 8 let txt = printf("%s %-50s %-4d %-50s", m[0], m[1]. "()", > > m[2], m[3]) > > 9 put =txt > > 10 endfor > > 11 > > 12 let char = getchar() > > 13 setlocal nomodifiable > > 14 silent! "'".char > > 15 endfun > > > basically i want to display a list of choices for the user and based > > on the users input i will take some action. so the lines 7-8 will > > actually list the users with some choices in a new window. but the > > window is not getting opened because of getchar(), according to > > the code that's what suppose to happen. why getchar() is blocking > > output, is there any way around this. > > > thanks > > > > signature.asc > < 1KViewDownload
thanks ZyX, redraw() did the trick. -- You received this message from the "vim_use" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php
