mirror of
				https://github.com/nicbarker/clay.git
				synced 2025-11-03 16:16:18 +00:00 
			
		
		
		
	Fix a bug that could cause double newlines in text blocks
This commit is contained in:
		
							parent
							
								
									9f0cf751da
								
							
						
					
					
						commit
						efec6ab1de
					
				
							
								
								
									
										2
									
								
								clay.h
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								clay.h
									
									
									
									
									
								
							| 
						 | 
					@ -1639,7 +1639,9 @@ Clay__MeasureTextCacheItem *Clay__MeasureTextCached(Clay_String *text, Clay_Text
 | 
				
			||||||
                previousWord = Clay__AddMeasuredWord(CLAY__INIT(Clay__MeasuredWord) { .startOffset = start, .length = length + 1, .width = dimensions.width, .next = -1 }, previousWord);
 | 
					                previousWord = Clay__AddMeasuredWord(CLAY__INIT(Clay__MeasuredWord) { .startOffset = start, .length = length + 1, .width = dimensions.width, .next = -1 }, previousWord);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (current == '\n') {
 | 
					            if (current == '\n') {
 | 
				
			||||||
 | 
					                if (length > 1) {
 | 
				
			||||||
                    previousWord = Clay__AddMeasuredWord(CLAY__INIT(Clay__MeasuredWord) { .startOffset = start, .length = length, .width = dimensions.width, .next = -1 }, previousWord);
 | 
					                    previousWord = Clay__AddMeasuredWord(CLAY__INIT(Clay__MeasuredWord) { .startOffset = start, .length = length, .width = dimensions.width, .next = -1 }, previousWord);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
                previousWord = Clay__AddMeasuredWord(CLAY__INIT(Clay__MeasuredWord) { .startOffset = end + 1, .length = 0, .width = 0, .next = -1 }, previousWord);
 | 
					                previousWord = Clay__AddMeasuredWord(CLAY__INIT(Clay__MeasuredWord) { .startOffset = end + 1, .length = 0, .width = 0, .next = -1 }, previousWord);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            measuredWidth += dimensions.width;
 | 
					            measuredWidth += dimensions.width;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue