jenkins-bot merged this change.

View Change

Approvals: Dvorapa: Looks good to me, but someone else must approve D3r1ck01: Looks good to me, approved jenkins-bot: Verified
[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.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib6f4db6e721b4cfcdef43ea24d68e42aa9011489
Gerrit-Change-Number: 592684
Gerrit-PatchSet: 1
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: D3r1ck01 <xsavitar.wiki@aol.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: jenkins-bot (75)