Code

better wrapping: add a cursor and respect inner borders
authorAntoine Beaupré <anarcat@koumbit.org>
Tue, 3 Dec 2013 04:15:13 +0000 (23:15 -0500)
committerAntoine Beaupré <anarcat@koumbit.org>
Tue, 3 Dec 2013 04:15:13 +0000 (23:15 -0500)
src/oping.c

index ccaafe057744cd90d14a0e04d986dbcde782b1a0..0649d0044bd681497a6d3e59607f8b1d71a0729e 100644 (file)
@@ -686,9 +686,10 @@ static int update_stats_from_context (ping_context_t *ctx, pingobj_iter_t *iter)
                         wattron (ctx->window, COLOR_PAIR(color));
                         mvwprintw (ctx->window,
                                    /* y = */ 3,
-                                   /* x = */ (1 + sequence) % maxx,
+                                   /* x = */ ( (sequence - 1) % (maxx - 4) ) + 2,
                                    bars[index]);
                        wattroff (ctx->window, COLOR_PAIR(color));
+                        wprintw (ctx->window, " ");
                }
                else
                {
@@ -698,9 +699,10 @@ static int update_stats_from_context (ping_context_t *ctx, pingobj_iter_t *iter)
                 wattron (ctx->window, COLOR_PAIR(OPING_RED) | A_BOLD);
                 mvwprintw (ctx->window,
                            /* y = */ 3,
-                           /* x = */ (1 + sequence) % maxx,
+                           /* x = */ ( (sequence - 1) % (maxx - 4) ) + 2,
                            "!");
                 wattroff (ctx->window, COLOR_PAIR(OPING_RED) | A_BOLD);
+                wprintw (ctx->window, " ");
         }
        wrefresh (ctx->window);