Skip to content

Commit 2776156

Browse files
committed
Directly sum up lengths
There is no need to build the complete string.
1 parent 49255d6 commit 2776156

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

bpython/curtsiesfrontend/repl.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1536,15 +1536,15 @@ def number_of_padding_chars_on_current_cursor_line(self):
15361536
15371537
Should return zero unless there are fullwidth characters."""
15381538
full_line = self.current_cursor_line_without_suggestion
1539-
line_with_padding = "".join(
1540-
line.s
1539+
line_with_padding_len = sum(
1540+
len(line.s)
15411541
for line in paint.display_linize(
15421542
self.current_cursor_line_without_suggestion.s, self.width
15431543
)
15441544
)
15451545

15461546
# the difference in length here is how much padding there is
1547-
return len(line_with_padding) - len(full_line)
1547+
return line_with_padding_len - len(full_line)
15481548

15491549
def paint(
15501550
self,

0 commit comments

Comments
 (0)