jenkins-bot has submitted this change and it was merged. ( https://gerrit.wikimedia.org/r/592684 )
Change subject: [cleanup] Simplify texteditor choices ......................................................................
[cleanup] Simplify texteditor choices
Change-Id: Ib6f4db6e721b4cfcdef43ea24d68e42aa9011489 --- M scripts/replace.py 1 file changed, 6 insertions(+), 11 deletions(-)
Approvals: Dvorapa: Looks good to me, but someone else must approve D3r1ck01: Looks good to me, approved jenkins-bot: Verified
diff --git a/scripts/replace.py b/scripts/replace.py index 49da2b5..cf4060c 100755 --- a/scripts/replace.py +++ b/scripts/replace.py @@ -777,21 +777,16 @@ if choice == 'm': context = context * 3 if context else 3 continue - if choice == 'e': + if choice in ('e', 'l'): text_editor = editor.TextEditor() - as_edited = text_editor.edit(original_text) + edit_text = original_text if choice == 'e' else new_text + as_edited = text_editor.edit(edit_text) # if user didn't press Cancel if as_edited and as_edited != new_text: new_text = as_edited - continue - if choice == 'l': - text_editor = editor.TextEditor() - as_edited = text_editor.edit(new_text) - # if user didn't press Cancel - if as_edited and as_edited != new_text: - new_text = as_edited - # prevent changes from being applied again - last_text = new_text + if choice == 'l': + # prevent changes from being applied again + last_text = new_text continue if choice == 'b': pywikibot.bot.open_webbrowser(page)
pywikibot-commits@lists.wikimedia.org