fixed a problem when backporting dwm's drawtext()
This commit is contained in:
		
							parent
							
								
									17232f493b
								
							
						
					
					
						commit
						44e372bb31
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		
							
								
								
									
										2
									
								
								dmenu.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								dmenu.c
									
										
									
									
									
								
							| 
						 | 
					@ -226,7 +226,7 @@ drawtext(const char *text, unsigned long col[ColLast]) {
 | 
				
			||||||
	y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent;
 | 
						y = dc.y + (dc.h / 2) - (h / 2) + dc.font.ascent;
 | 
				
			||||||
	x = dc.x + (h / 2);
 | 
						x = dc.x + (h / 2);
 | 
				
			||||||
	/* shorten text if necessary */
 | 
						/* shorten text if necessary */
 | 
				
			||||||
	for(len = MIN(olen, sizeof buf); len && textnw(buf, len) > dc.w - h; len--);
 | 
						for(len = MIN(olen, sizeof buf); len && textnw(text, len) > dc.w - h; len--);
 | 
				
			||||||
	if(!len)
 | 
						if(!len)
 | 
				
			||||||
		return;
 | 
							return;
 | 
				
			||||||
	memcpy(buf, text, len);
 | 
						memcpy(buf, text, len);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue