Closed marlun closed 12 years ago
Here's a video of it happening: http://d.pr/v/Gflj
Whoa, that's bizzarre. How are you exiting vim? :wq
or ZZ
? It's as if you have a stuck key in there.
I'm exiting with ZZ but the same thing happends if I exit it using :wq
I've tried running vimgolf put 4ff83e9749534f000100003f in both iTerm2 and Terminal in OS X.
I've installed a seperate (from osx default) vim using homebrew and I've checked :version when in vimgolf and it's using the homebrew installed vim.
Perhaps an issue with Thor? Which version are you on, and can you try updating? gem update thor..
Updated Thor but still getting the same problem. I tried vimgolf on my other laptop, it had an earlier version which it told me to update so I did and then I tried and I'm getting the exact same problem on that laptop.
Here's the log on updating thor:
Updating installed gems
Updating thor
Successfully installed thor-0.15.4
Gems updated: thor
Installing ri documentation for thor-0.15.4...
Installing RDoc documentation for thor-0.15.4...
Can't reproduce here.. Upgraded to latest also, works fine. =/
igrigorik { ~ } > vimgolf put 4ff83e9749534f000100003f
Downloading Vimgolf challenge: 4ff83e9749534f000100003f
Launching VimGolf session for challenge: 4ff83e9749534f000100003f
Uh oh, looks like your entry does not match the desired output.
Would you like to see a [d]iff or [r]etry or [q]uit ?
n
You must choose one of [:diff, :retry, :quit].
? diff
Showing vimdiff of your attempt (left) and correct output (right)
2 files to edit
Would you like to see a [d]iff or [r]etry or [q]uit ?
q
Please try again! Your score for this (failed) attempt was: 3
I thought it could've been something in my .bashrc or .inputrc but I removed them and the result is the same.
I also tried changing my PATH so that vimgolf used the default OS X installation of vim but the same thing happend. Very weird.
I have the same issue here. If there's any helpful info I can provide, let me know. Here's my vim info for a start
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Jul 31 2011 19:27:29) Compiled by root@apple.com Normal version without GUI. Features included (+) or not (-): -arabic +autocmd -balloon_eval -browse +builtin_terms +byte_offset +cindent -clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments -conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi +file_in_path +find_in_path +float +folding -footer +fork() -gettext -hangul_input +iconv +insert_expand +jumplist -keymap -langmap +libcall +linebreak +lispindent +listcmds +localmap -lua +menu +mksession +modify_fname +mouse -mouseshape -mouse_dec -mouse_gpm -mouse_jsbterm -mouse_netterm -mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg -osfiletype +path_extra -perl +persistent_undo +postscript +printer -profile -python -python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs +smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save system vimrc file: "$VIM/vimrc" user vimrc file: "$HOME/.vimrc" user exrc file: "$HOME/.exrc" fall-back for $VIM: "/usr/share/vim" Compilation: gcc -c -I. -D_FORTIFY_SOURCE=0 -Iproto -DHAVE_CONFIG_H -arch i386 -arch x86_64 -g -Os -pipe Linking: gcc -arch i386 -arch x86_64 -o vim -lncurses
I don't think this is a Vim issue, this is likely a bug we may have introduced in the recent CLI refactoring: https://github.com/igrigorik/vimgolf/commit/14a69fd13b9f889acdbdde9c2df02d750d44aa2c /cc @fgalassi
Would one of you guys be willing to instrument your clients and print out what exactly what's happening in there?
The code we're after is likely in: https://github.com/igrigorik/vimgolf/blob/master/lib/vimgolf/ui.rb#L53
Can you add some extra logging in there to see what input you're actually getting? Perhaps it's the EOF rescue?
Yup, I'm seeing the EOFError
repeatedly. If I change the return statement in the rescue to return :quit
, it exits as expected.
Can you try replacing the body of that method with older version and see if that fixes it?
begin
require 'highline'
@hl ||= HighLine.new($stdin)
if not $stdin.tty?
@hl.ask(message)
elsif password
@hl.ask(message) {|q| q.echo = "*" }
else
@hl.ask(message) {|q| q.readline = true }
end
rescue EOFError
return ''
end
end
Would love to help but unfortunately I don't know what to do to "instrument my client"?
Adding HighLine.track_eof = false
in the initializer solves this for me. I'll try your code above.
With your code above, I get
Uh oh, something went wrong! Error: undefined local variable or method `password' for #<VimGolf::CLI::UI:0x106257c20>
guys, which version of ruby do you have?
ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]
I get the same error message when I switch the code and I also have
ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]
ok, i can reproduce the problem. It looks like it could be stock ruby on snow leopard and the highline ruby library, which vimgolf uses. I am going to look into this, but if you wanna try in the meantime i think installing ruby with homebrew gonna fix this
@marlun If you add HighLine.track_eof = false
in the initializer (right underneath @hl = ...
) at the top of the file, does that solve for you also?
@michaelmior like this:?
def initialize
super
@hl = HighLine.new($stdin)
HighLine.track_eof = false
end
yes it works. Need to look around on the web if there's some possible problem with that and check no regressions on linux, then i think i can pull. ok Ilya?
@marlun yes
@fgalassi @michaelmior Yes, adding that and having the original ask_question content seem to solve the problem :)
Ok works for me, pulled, thank you all.
(and never trust apple stock ruby)
Great, thanks for the help all of you! Now I can get back to fine tuning my vim skills.
Awesome, thanks for figuring this out guys! @fgalassi pull looks good, left a quick note about an additional message on exception.
Hi,
When I'm finished golfing and close vim there seems to be a loop asking me if I want to see a diff, retry or quit and the only way I can stop it is hitting ctrl-c. Looks like thiss:
If I try hitting d, r or q nothing happends, it just keeps asking. I'm on OSX 10.7.4.