jenkins-bot merged this change.
[cleanup] Simplify texteditor choices
Change-Id: Ib6f4db6e721b4cfcdef43ea24d68e42aa9011489
---
M scripts/replace.py
1 file changed, 6 insertions(+), 11 deletions(-)
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)
To view, visit change 592684. To unsubscribe, or for help writing mail filters, visit settings.