From fd58ee559bf64dde85a4e6f27a973f0053037edb Mon Sep 17 00:00:00 2001 From: lucas8 Date: Wed, 16 Sep 2015 18:36:31 +0200 Subject: [PATCH] Fix error when displaying string with quotes. Mostly happen when extracting an attachment with a quote in its name. An error is printed but the attachment is extracted, because the error happen when printing its name. --- plugin/notmuch.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugin/notmuch.rb b/plugin/notmuch.rb index c35b497..f5de0fe 100644 --- a/plugin/notmuch.rb +++ b/plugin/notmuch.rb @@ -38,7 +38,13 @@ def get_config end def vim_puts(s) - VIM::command("echo '#{s.to_s}'") + if s.index "'" == nil + VIM::command("echo '#{s.to_s}'") + elsif s.index '"' == nil + VIM::command("echo \"#{s.to_s}\"") + else + VIM::command("echo \"#{s.gsub(/"/,"").to_s}\"") + end end def vim_err(s)