jenkins-bot merged this change.

View Change

Approvals: Dvorapa: Looks good to me, but someone else must approve Dalba: Looks good to me, approved jenkins-bot: Verified
[IMPR] Wrap formatted options of an option bar to prevent ugly line breaks

e.g. a lot of input_choice options may break inside the option text;
this patch solves this.

Change-Id: I0e8f7398592795e0277e84437e783acd044e8d50
---
M pywikibot/bot_choice.py
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pywikibot/bot_choice.py b/pywikibot/bot_choice.py
index ddc04ec..db6b1bd 100755
--- a/pywikibot/bot_choice.py
+++ b/pywikibot/bot_choice.py
@@ -7,6 +7,8 @@
#
from __future__ import absolute_import, unicode_literals

+from textwrap import fill
+
import pywikibot


@@ -40,7 +42,8 @@
formatted_options = []
for option in options:
formatted_options.append(option.format(default=default))
- return '{0} ({1})'.format(text, ', '.join(formatted_options))
+ return fill('{0} ({1})'.format(text, ', '.join(formatted_options)),
+ width=77)

@property
def stop(self):

To view, visit change 428927. To unsubscribe, visit settings.

Gerrit-Project: pywikibot/core
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I0e8f7398592795e0277e84437e783acd044e8d50
Gerrit-Change-Number: 428927
Gerrit-PatchSet: 2
Gerrit-Owner: Xqt <info@gno.de>
Gerrit-Reviewer: Dalba <dalba.wiki@gmail.com>
Gerrit-Reviewer: Dvorapa <dvorapa@seznam.cz>
Gerrit-Reviewer: Framawiki <framawiki@tools.wmflabs.org>
Gerrit-Reviewer: John Vandenberg <jayvdb@gmail.com>
Gerrit-Reviewer: Xqt <info@gno.de>
Gerrit-Reviewer: Zoranzoki21 <zorandori4444@gmail.com>
Gerrit-Reviewer: jenkins-bot <>