Skip to content

Commit 4b57f3e

Browse files
committed
don't re-split arguments
1 parent 38d866f commit 4b57f3e

1 file changed

Lines changed: 6 additions & 7 deletions

File tree

editor.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,19 @@ def get_default_editors():
3636

3737
def get_editor_args(editor):
3838
if editor in ['vim', 'gvim', 'vim.basic', 'vim.tiny']:
39-
return '-f -o'
39+
return ['-f', '-o']
4040

4141
elif editor == 'emacs':
42-
return '-nw'
42+
return ['-nw']
4343

4444
elif editor == 'gedit':
45-
return '-w --new-window'
45+
return ['-w', '--new-window']
4646

4747
elif editor == 'nano':
48-
return '-R'
48+
return ['-R']
4949

5050
else:
51-
return ''
51+
return []
5252

5353

5454
def get_platform_editor_var():
@@ -80,8 +80,7 @@ def get_tty_filename():
8080

8181
def edit(filename=None, contents=None, use_tty=None):
8282
editor = get_editor()
83-
args = get_editor_args(os.path.basename(os.path.realpath(editor)))
84-
args = [editor] + args.split(' ')
83+
args = [editor] + get_editor_args(os.path.basename(os.path.realpath(editor)))
8584

8685
if use_tty is None:
8786
use_tty = sys.stdin.isatty() and not sys.stdout.isatty()

0 commit comments

Comments
 (0)