From a600855c319c5034545f9ad4f71cd875d640ebf6 Mon Sep 17 00:00:00 2001 From: Olivier Mangin Date: Wed, 24 May 2017 13:45:24 -0400 Subject: [PATCH] Fix calls to edit_file with wrong editor in conf and note commands. Also replaces fix from PR #63. --- pubs/commands/conf_cmd.py | 2 +- pubs/commands/note_cmd.py | 2 +- pubs/uis.py | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pubs/commands/conf_cmd.py b/pubs/commands/conf_cmd.py index 2fe1574..1f5ba44 100644 --- a/pubs/commands/conf_cmd.py +++ b/pubs/commands/conf_cmd.py @@ -15,7 +15,7 @@ def command(conf, args): while True: # get modif from user - content.edit_file(conf['main']['edit_cmd'], config.get_confpath()) + ui.edit_file(config.get_confpath()) new_conf = config.load_conf(check=False) try: diff --git a/pubs/commands/note_cmd.py b/pubs/commands/note_cmd.py index d157238..8e1fab1 100644 --- a/pubs/commands/note_cmd.py +++ b/pubs/commands/note_cmd.py @@ -20,5 +20,5 @@ def command(conf, args): rp = repo.Repository(conf) citekey = resolve_citekey(rp, args.citekey, ui=ui, exit_on_fail=True) notepath = rp.databroker.real_notepath(citekey) - content.edit_file(conf['main']['edit_cmd'], notepath, temporary=False) + ui.edit_file(notepath, temporary=False) rp.close() diff --git a/pubs/uis.py b/pubs/uis.py index dfb5cd6..3409782 100644 --- a/pubs/uis.py +++ b/pubs/uis.py @@ -5,7 +5,7 @@ import sys import locale import codecs -from .content import editor_input +from .content import editor_input, edit_file from . import color from . import config from .p3 import _get_raw_stdout, _get_raw_stderr, input, ustr @@ -188,3 +188,6 @@ class InputUI(PrintUI): def editor_input(self, initial="", suffix='.tmp'): return editor_input(self.editor, initial=initial, suffix=suffix) + + def edit_file(self, path, temporary): + edit_file(self.editor, path, temporary=temporary)