commit 4898ef0c1cc92eee1a6c61535a33e26e94b143a7
parent 86a8baae96e3e352e7486bb8f61584be42339e15
Author: lumidify <nobody@lumidify.org>
Date:   Sun, 17 May 2020 20:19:08 +0200
Fix several typos
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/text_buffer.c b/text_buffer.c
@@ -259,14 +259,14 @@ ltk_render_text_line_new(
 						int x = cur_border - (local_border - cur->glyphs[i].x_abs);
 						ltk_draw_glyph(&cur->glyphs[i], sl->img, x, cur->glyphs[i].y_abs, fg);
 					}
-					cur_border -= local_border - cur->glyphs[0].x_abs;
+					cur_border -= local_border - cur->glyphs[end_index].x_abs;
 				} else {
-					for (int i = end_index; i < cur->num_glyphs && cur_len < sl->len; i++) {
+					for (int i = end_index; i <= start_index && cur_len < sl->len; i++) {
 						cur_len++;
 						int x = cur_border + (cur->glyphs[i].x_abs - cur->glyphs[end_index].x_abs);
 						ltk_draw_glyph(&cur->glyphs[i], sl->img, x, cur->glyphs[i].y_abs, fg);
 					}
-					cur_border += local_border - cur->glyphs[0].x_abs;
+					cur_border += local_border - cur->glyphs[end_index].x_abs;
 				}
 			} else {
 				start_index = cur == sl->run ? sl->glyph_index : 0;
@@ -277,7 +277,7 @@ ltk_render_text_line_new(
 				else
 					end_index = start_index + sl->len - cur_len - 1;
 				if (par_is_rtl) {
-					for (int i = end_index; i >= 0 && cur_len < sl->len; i--) {
+					for (int i = end_index; i >= start_index && cur_len < sl->len; i--) {
 						cur_len++;
 						int x = cur_border - (cur->glyphs[end_index].x_abs + cur->glyphs[end_index].x_advance - cur->glyphs[i].x_abs);
 						ltk_draw_glyph(&cur->glyphs[i], sl->img, x, cur->glyphs[i].y_abs, fg);