From b9379834497ed9c738751410377c28d1f1bd5b8e Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Wed, 3 Apr 2019 12:27:31 +0200
Subject: [PATCH] T: minor fix: ensure printing is inside the widget

---
 common/utils/T/tracer/gui/xy_plot.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/common/utils/T/tracer/gui/xy_plot.c b/common/utils/T/tracer/gui/xy_plot.c
index 0f15f4862a..c10b76c6ee 100644
--- a/common/utils/T/tracer/gui/xy_plot.c
+++ b/common/utils/T/tracer/gui/xy_plot.c
@@ -130,9 +130,13 @@ static void paint(gui *_gui, widget *_this)
           this->common.y + FLIP(y),
           this->common.x + this->vrule_width + 5,
           this->common.y + FLIP(y));
+      /* do not print out of the widget (take care of top) */
+      y = FLIP(y)-this->label_height/2+this->label_baseline;
+      if (y - this->label_baseline < 0)
+        y = this->label_baseline;
       x_draw_string(g->x, g->xwin, DEFAULT_FONT, FOREGROUND_COLOR,
           this->common.x + this->vrule_width - vwidth - 2,
-          this->common.y + FLIP(y)-this->label_height/2+this->label_baseline,
+          this->common.y + y,
           v);
     }
     break;
-- 
GitLab