[issue18725] Multiline shortening

2013-10-16 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Serhiy, you forgot to add shorten to __all__.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-10-16 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 0bd257cd3e88 by Serhiy Storchaka in branch 'default':
Add shorten to __all_ (issues #18585 and #18725).
http://hg.python.org/cpython/rev/0bd257cd3e88

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-10-16 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Vajrasky. It's Antoine forgot. ;)

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-10-15 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 2e8c424dc638 by Serhiy Storchaka in branch 'default':
Issue #18725: The textwrap module now supports truncating multiline text.
http://hg.python.org/cpython/rev/2e8c424dc638

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-10-15 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Antoine has approved this on IRC.

Thank you Ezio and Antoine for your reviews.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-10-06 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

In updated patch fixed a bug with final spaces.

--
assignee:  - serhiy.storchaka
Added file: http://bugs.python.org/file31971/textwrap_max_lines_2.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-10-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Could anyone please review the patch?

--
keywords: +needs review

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-09-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is a patch. It get rid of TextWrap.shorten() because TextWrap.fill() 
supersedes it and because placeholder now a parameter of TextWrap. Module 
level shorten() is left but I doubt about it.

--
keywords: +patch
stage: test needed - patch review
Added file: http://bugs.python.org/file31736/textwrap_max_lines.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-08-13 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Functions in the textwrap module works with multiline text except a newly added 
(in issue18585) the shorten() function. Wrapping and shortening a multiline 
text using existing textwrap function is not a trivial job.

I propose to add two new parameters to the TextWrap class and wrap() and fill() 
functions: max_lines and placeholder. If the max_lines argument is specified 
then wrapped text truncated to max_lines and the last line shortened to the 
width argument.

print(textwrap('Lorem ipsum dolor sit amet, consectetur adipisicing elit, 
sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.', 
width=40, max_lines=3))
Lorem ipsum dolor sit amet, consectetur
adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore (...)

The shorten() function then will be just a particular case of fill() with 
max_lines=1.

--
components: Library (Lib)
messages: 195065
nosy: barry, ezio.melotti, georg.brandl, pitrou, python-dev, r.david.murray, 
serhiy.storchaka, stevenjd, vajrasky
priority: normal
severity: normal
status: open
title: Multiline shortening
type: enhancement
versions: Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-08-13 Thread Antoine Pitrou

Antoine Pitrou added the comment:

Sounds like a reasonable enhancement to me.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-08-13 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
stage:  - test needed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-08-13 Thread Vajrasky Kok

Vajrasky Kok added the comment:

What about newline keyword argument?

Are we forcing the newline to be '\n'? Alternate newlines will be useful for 
Windows platform ('\r\n') and HTML platform ('br /').

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18725] Multiline shortening

2013-08-13 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

fill(...) is just '\n'.join(wrap(...)). Directly use wrap() if you need 
nonstandard newlines.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18725
___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com