Skip to content

Commit 60be9a1

Browse files
committed
Revert "Use width aware slice"
Reverted due to performance impact when outputting large strings. This reverts commit ef91741.
1 parent 01b1921 commit 60be9a1

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

bpython/curtsiesfrontend/replpainter.py

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,11 @@ def display_linize(msg, columns, blank_line=False):
2525
"""Returns lines obtained by splitting msg over multiple lines.
2626
2727
Warning: if msg is empty, returns an empty list of lines"""
28-
msg = fmtstr(msg)
29-
try:
30-
display_lines = ([msg.width_aware_slice(slice(start, end))
31-
for start, end in zip(
32-
range(0, msg.width, columns),
33-
range(columns, msg.width + columns, columns))]
34-
if msg else ([''] if blank_line else []))
35-
except ValueError:
36-
display_lines = ['']
28+
display_lines = ([msg[start:end]
29+
for start, end in zip(
30+
range(0, len(msg), columns),
31+
range(columns, len(msg) + columns, columns))]
32+
if msg else ([''] if blank_line else []))
3733
return display_lines
3834

3935

0 commit comments

Comments
 (0)