Skip to content

Commit

Permalink
move unicode detection to a separate function
Browse files Browse the repository at this point in the history
this will ease transition to a commandline option override
  • Loading branch information
anarcat committed Dec 6, 2013
1 parent 5901ec3 commit b59778b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/oping.c
Original file line number Diff line number Diff line change
Expand Up @@ -635,6 +635,11 @@ static void time_calc (struct timespec *ts_dest, /* {{{ */
} /* }}} void time_calc */

#if USE_NCURSES
static int unicode_locale() /* {{{ */
{
return _nc_unicode_locale();
} /* }}} int unicode_locale */

static int update_prettyping_graph (ping_context_t *ctx, /* {{{ */
double latency, unsigned int sequence)
{
Expand All @@ -650,7 +655,7 @@ static int update_prettyping_graph (ping_context_t *ctx, /* {{{ */
x_max = getmaxx (ctx->window);
x_pos = ((sequence - 1) % (x_max - 4)) + 2;

if (_nc_unicode_locale())
if (unicode_locale())
{
hist_symbols_num = hist_symbols_utf8_num;
}
Expand All @@ -676,7 +681,7 @@ static int update_prettyping_graph (ping_context_t *ctx, /* {{{ */
assert (index_colors < hist_colors_num);

index_symbols = intensity % hist_symbols_num;
if (_nc_unicode_locale())
if (unicode_locale())
{
color = hist_colors_utf8[index_colors];
symbol = hist_symbols_utf8[index_symbols];
Expand All @@ -691,7 +696,7 @@ static int update_prettyping_graph (ping_context_t *ctx, /* {{{ */
wattron (ctx->window, A_BOLD);

wattron (ctx->window, COLOR_PAIR(color));
if (_nc_unicode_locale())
if (unicode_locale())
{
mvwprintw (ctx->window,
/* y = */ 3,
Expand Down

0 comments on commit b59778b

Please sign in to comment.