Skip to content

Commit 3c7f071

Browse files
use correct width of non-english character in Button
1 parent d997aab commit 3c7f071

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/prompt_toolkit/widgets/base.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,8 @@ def get_style() -> str:
438438
def _get_text_fragments(self) -> StyleAndTextTuples:
439439
width = self.width - (
440440
get_cwidth(self.left_symbol) + get_cwidth(self.right_symbol)
441+
) + (
442+
len(self.text) - get_cwidth(self.text)
441443
)
442444
text = (f"{{:^{width}}}").format(self.text)
443445

0 commit comments

Comments
 (0)