Skip to content

Commit

Permalink
Closes #108 (Fix default behavior of double_width)
Browse files Browse the repository at this point in the history
  • Loading branch information
firecat53 committed Feb 11, 2015
1 parent 2696480 commit 8b1b473
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bin/tabview
Expand Up @@ -47,7 +47,7 @@ def arg_parse():
help="Specify column width. 'max' or 'mode' (default) "
"for variable widths, or an integer value for "
"fixed column width.")
parser.add_argument('--double_width', action='store_true',
parser.add_argument('--double_width', action='store_true', default=False,
help="Force full handling of double-width characters "
"for large files (with a performance penalty)")
return parser.parse_known_args()
Expand Down
6 changes: 3 additions & 3 deletions tabview/tabview.py
Expand Up @@ -136,9 +136,9 @@ def _init_double_width(self, dw):
"""
self.double_width = dw
# Enable double with character processing for small files
if self.double_width is None:
if self.double_width is False:
self.double_width = len(self.data) * self.num_data_columns < 65000
if self.double_width:
if self.double_width is True:
self._cell_len = self.__cell_len_dw
else:
self._cell_len = len
Expand Down Expand Up @@ -1002,7 +1002,7 @@ def main(stdscr, *args, **kwargs):

def view(data, enc=None, start_pos=(0, 0), column_width=20, column_gap=2,
trunc_char='…', column_widths=None, search_str=None,
double_width=None):
double_width=False):
"""The curses.wrapper passes stdscr as the first argument to main +
passes to main any other arguments passed to wrapper. Initializes
and then puts screen back in a normal state after closing or
Expand Down

3 comments on commit 8b1b473

@wavexx
Copy link
Member

@wavexx wavexx commented on 8b1b473 Feb 14, 2015

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously, with double_width=None, you would get the auto behavior and T/F would always force the choice. With this change, double_width=False is auto, and 'None' disables double-width. Is this intended?

@firecat53
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would assume (wrongly perhaps :) ) if the doc string calls for a boolean, then people would either supply True or False. I guess changing line 139 to:

if not self.double_width:

would be more generous in allowing the 'auto' behavior?

@wavexx
Copy link
Member

@wavexx wavexx commented on 8b1b473 Feb 15, 2015 via email

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.