Added kitchen functions for chopping unicode text.

This commit is contained in:
Michael Lazar
2015-05-02 17:23:22 -07:00
parent f0ec9ba712
commit d548e65166
3 changed files with 8 additions and 14 deletions

View File

@@ -7,6 +7,7 @@ from contextlib import contextmanager
import praw.errors
import requests
from kitchen.text.display import textual_width
from .helpers import open_editor
from .curses_helpers import (Color, show_notification, show_help, text_input,
@@ -474,8 +475,7 @@ class BasePage(object):
if self.reddit.user is not None:
username = self.reddit.user.name
# TODO: use unicode width here instead of length
s_col = (n_cols - len(username) - 1)
s_col = (n_cols - textual_width(username) - 1)
# Only print username if it fits in the empty space on the right
if (s_col - 1) >= len(sub_name):
n = (n_cols - s_col - 1)