[meld] melddoc: Handle spaces in filenames with external editor (bgo#732089)



commit 8b1e4a1c2ed4652ea354d2964f1786c103a00503
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Tue Jun 24 06:51:35 2014 +1000

    melddoc: Handle spaces in filenames with external editor (bgo#732089)

 meld/melddoc.py |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/meld/melddoc.py b/meld/melddoc.py
index 60f3a30..83c59ac 100644
--- a/meld/melddoc.py
+++ b/meld/melddoc.py
@@ -15,6 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 import logging
+import pipes
 import shlex
 import string
 import subprocess
@@ -40,12 +41,12 @@ def make_custom_editor_command(path, line=0):
     replacements = [tok[1] for tok in fmt.parse(custom_command)]
 
     if not any(replacements):
-        cmd = " ".join([custom_command, path])
+        return [custom_command, path]
     elif not all(r in (None, 'file', 'line') for r in replacements):
-        cmd = " ".join([custom_command, path])
         log.error("Unsupported fields found", )
+        return [custom_command, path]
     else:
-        cmd = custom_command.format(file=path, line=line)
+        cmd = custom_command.format(file=pipes.quote(path), line=line)
     return shlex.split(cmd)
 
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]