shithub: fc

Download patch

ref: 22c7b70edbd06cfb6c7d32ed3d5fc7aa371058da
parent: 25c64d5eb622d0bb801bf3bc2453b4cb075ee63b
author: glenda <glenda@krsna>
date: Mon Aug 18 21:06:04 EDT 2025

more-fixes

--- a/fc.c
+++ b/fc.c
@@ -2200,51 +2200,12 @@
 	}
 
 	Point p = addpt(b->r.min, Pt(config.box_text_margin, config.box_label_offset_y));
-	char *text_to_draw = (sheet.editing == idx) ? sheet.editbuf : b->content;
-	int max_width = Dx(b->r) - (2 * config.box_text_margin);
-	int line_height = font->height;
-	char *text = text_to_draw;
-	char *line_start = text;
-	char line_buffer[MAXCONTENT];
 
-	while (*line_start) {
-		char *word_ptr = line_start;
-		char *line_end = line_start;
-		
-		while (*word_ptr) {
-			char *word_start = word_ptr;
-			while(*word_ptr && !isspace(*word_ptr))
-				word_ptr++;
-			
-			int word_len = word_ptr - line_start;
-			if(word_len >= MAXCONTENT) break;
-
-			strncpy(line_buffer, line_start, word_len);
-			line_buffer[word_len] = '\0';
-
-			if(stringwidth(font, line_buffer) > max_width) {
-				if(line_end == line_start)
-					line_end = word_start;
-				break;
-			}
-			line_end = word_ptr;
-
-			while(*word_ptr && isspace(*word_ptr))
-				word_ptr++;
-		}
-		
-		int len = line_end - line_start;
-		stringn(dst, p, colors[0], ZP, font, line_start, len);
-		p.y += line_height;
-		
-		if (p.y > b->r.max.y - config.box_text_margin - line_height)
-			break;
-
-		line_start = line_end;
-		while(*line_start && isspace(*line_start))
-			line_start++;
+	if(sheet.editing == idx){
+		string(dst, p, colors[0], ZP, font, sheet.editbuf);
+	} else {
+		string(dst, p, colors[0], ZP, font, b->content);
 	}
-
 	if (b->type == T_FORMULA && config.show_formula_indicator){
 		string(dst, Pt(b->r.max.x - config.formula_indicator_offset, b->r.min.y + 2),
 			colors[3], ZP, font, "=");
--