Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
cpython
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
cpython
Commits
c6fde729
Kaydet (Commit)
c6fde729
authored
Ock 19, 2008
tarafından
Georg Brandl
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fix #1146: TextWrap vs words 1-character shorter than the width.
Patch by Quentin Gallet-Gilles.
üst
14404b68
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
1 deletion
+22
-1
test_textwrap.py
Lib/test/test_textwrap.py
+13
-0
textwrap.py
Lib/textwrap.py
+6
-1
NEWS
Misc/NEWS
+3
-0
No files found.
Lib/test/test_textwrap.py
Dosyayı görüntüle @
c6fde729
...
@@ -398,6 +398,19 @@ How *do* you spell that odd word, anyways?
...
@@ -398,6 +398,19 @@ How *do* you spell that odd word, anyways?
' o'
],
' o'
],
subsequent_indent
=
' '
*
15
)
subsequent_indent
=
' '
*
15
)
# bug 1146. Prevent a long word to be wrongly wrapped when the
# preceding word is exactly one character shorter than the width
self
.
check_wrap
(
self
.
text
,
12
,
[
'Did you say '
,
'"supercalifr'
,
'agilisticexp'
,
'ialidocious?'
,
'" How *do*'
,
'you spell'
,
'that odd'
,
'word,'
,
'anyways?'
])
def
test_nobreak_long
(
self
):
def
test_nobreak_long
(
self
):
# Test with break_long_words disabled
# Test with break_long_words disabled
self
.
wrapper
.
break_long_words
=
0
self
.
wrapper
.
break_long_words
=
0
...
...
Lib/textwrap.py
Dosyayı görüntüle @
c6fde729
...
@@ -173,7 +173,12 @@ class TextWrapper:
...
@@ -173,7 +173,12 @@ class TextWrapper:
Handle a chunk of text (most likely a word, not whitespace) that
Handle a chunk of text (most likely a word, not whitespace) that
is too long to fit in any line.
is too long to fit in any line.
"""
"""
space_left
=
max
(
width
-
cur_len
,
1
)
# Figure out when indent is larger than the specified width, and make
# sure at least one character is stripped off on every pass
if
width
<
1
:
space_left
=
1
else
:
space_left
=
width
-
cur_len
# If we're allowed to break long words, then do so: put as much
# If we're allowed to break long words, then do so: put as much
# of the next chunk onto the current line as will fit.
# of the next chunk onto the current line as will fit.
...
...
Misc/NEWS
Dosyayı görüntüle @
c6fde729
...
@@ -369,6 +369,9 @@ Core and builtins
...
@@ -369,6 +369,9 @@ Core and builtins
Library
Library
-------
-------
- #1146: fix how textwrap breaks a long word that would start in the
last column of a line.
- #1693149: trace.py --ignore-module - accept multiple comma-separated
- #1693149: trace.py --ignore-module - accept multiple comma-separated
modules to be given.
modules to be given.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment