lukerandall / haskellmode-vim

An unpacked copy of the haskellmode vimball. Ping me if it needs updating.
http://projects.haskell.org/haskellmode-vim/
BSD 3-Clause "New" or "Revised" License
135 stars 21 forks source link

silently exec'ing the browser corrupts screen display #1

Closed pbrisbin closed 13 years ago

pbrisbin commented 13 years ago

Hello,

I've had one nagging issue with this plugin, when I launch my browser via the *Doc commands, the vim window becomes corrupt. All the text disappears and only reappears as I move the cursor over each line. I found that this could be avoided by not launching the browser silently. I'm not sure the source of the problem (likely not you), but I like this workaround for now.

In case you're interested, here is a small patch which allows another option to choose if the browser should be launched as is currently or without the silent. I just put g:haddock_browser_nosilent = 1 in my vimrc.

diff --git a/haskell_doc.vim b/haskell_doc.vim
index 8669e87..0c1810b 100644
--- a/haskell_doc.vim
+++ b/haskell_doc.vim
@@ -177,7 +177,11 @@ function! DocBrowser(url)
   endif
   " start browser to open url, according to specified format
   let url = a:url=~'^\(file://\|http://\)' ? a:url : 'file://'.a:url
-  silent exe '!'.printf(g:haddock_browser_callformat,g:haddock_browser,escape(url,'#%')) 
+  if (exists("g:haddock_browser_nosilent") && g:haddock_browser_nosilent)
+    exe '!'.printf(g:haddock_browser_callformat,g:haddock_browser,escape(url,'#%'))
+  else
+    silent exe '!'.printf(g:haddock_browser_callformat,g:haddock_browser,escape(url,'#%')) 
+  endif
 endfunction

 "Doc/Doct are an old interface for documentation lookup

I'm no expert in vim so there's likely a more elegant solution out there.

Thanks!

lukerandall commented 13 years ago

Hey

Thanks for submitting this. Would you like to generate a patch for this so that it when I apply it it correctly attributes you as the author?

pbrisbin commented 13 years ago

Cool, as long as you approve the approach I can fork/pull req soon. I'll add a note about the new option in the helptext, but feel free to reword when you pull in.

lukerandall commented 13 years ago

Sounds good. I'm happy with it as I don't see it adversely affecting anyone. I'm not sure that I'd be able to get it upstreamed though, but that's a separate issue :)

lukerandall commented 13 years ago

Just out of interest, what version of Vim are you using, and on what platform?

pbrisbin commented 13 years ago

I'm using 7.3 on 64bit Arch linux. I can provide vim --version if you'd like (it's long). I installed gvim for the xclipboard support but only ever use the cli executable (and launch chrome there from).

pbrisbin commented 13 years ago

Also, doh. I didn't realize this wasn't the "official" repo for the script. I probably wouldn't have submitted either of these issues had I known this was just a periodically updated mirror... Feel free to just close the other one. I also wouldn't worry about applying my changes if you don't want to manage the possible conflicts next time you update from upstream.

lukerandall commented 13 years ago

I merged the pull request you sent as I think it will likely be useful to others who face the same issue.