Merge branch 'micronn-pager-wrap'

This commit is contained in:
Michael Lazar
2019-02-02 19:16:27 -05:00
4 changed files with 9 additions and 1 deletions

View File

@@ -269,6 +269,7 @@ class Config(object):
'oauth_redirect_port': partial(config.getint, 'rtv'), 'oauth_redirect_port': partial(config.getint, 'rtv'),
'oauth_scope': lambda x: rtv[x].split(','), 'oauth_scope': lambda x: rtv[x].split(','),
'max_comment_cols': partial(config.getint, 'rtv'), 'max_comment_cols': partial(config.getint, 'rtv'),
'max_pager_cols': partial(config.getint, 'rtv'),
'hide_username': partial(config.getboolean, 'rtv'), 'hide_username': partial(config.getboolean, 'rtv'),
'flash': partial(config.getboolean, 'rtv') 'flash': partial(config.getboolean, 'rtv')
} }

View File

@@ -181,6 +181,9 @@ class SubmissionPage(Page):
n_rows, n_cols = self.term.stdscr.getmaxyx() n_rows, n_cols = self.term.stdscr.getmaxyx()
if self.config['max_pager_cols'] is not None:
n_cols = min(n_cols, self.config['max_pager_cols'])
data = self.get_selected_item() data = self.get_selected_item()
if data['type'] == 'Submission': if data['type'] == 'Submission':
text = '\n\n'.join((data['permalink'], data['text'])) text = '\n\n'.join((data['permalink'], data['text']))

View File

@@ -46,6 +46,9 @@ enable_media = False
; Maximum number of columns for a comment ; Maximum number of columns for a comment
max_comment_cols = 120 max_comment_cols = 120
; Maximum number of columns for pager
;max_pager_cols = 70
; Hide username if logged in, display "Logged in" instead ; Hide username if logged in, display "Logged in" instead
hide_username = False hide_username = False

View File

@@ -151,10 +151,11 @@ def test_config_from_file():
'subreddit': 'cfb', 'subreddit': 'cfb',
'enable_media': True, 'enable_media': True,
'max_comment_cols': 150, 'max_comment_cols': 150,
'max_pager_cols': 120,
'hide_username': True, 'hide_username': True,
'theme': 'molokai', 'theme': 'molokai',
'flash': True, 'flash': True,
'autologin': True 'autologin': True,
} }
bindings = { bindings = {