Add config option for word delimiters
Let the user configure word boundaries other than ' ', only works with the portable character set.
This commit is contained in:
		
				
					committed by
					
						
						Hiltjo Posthuma
					
				
			
			
				
	
			
			
			
						parent
						
							32f2564dbb
						
					
				
				
					commit
					120e840107
				
			@ -15,3 +15,9 @@ static const char *outbgcolor  = "#00ffff";
 | 
				
			|||||||
static const char *outfgcolor  = "#000000";
 | 
					static const char *outfgcolor  = "#000000";
 | 
				
			||||||
/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
 | 
					/* -l option; if nonzero, dmenu uses vertical list with given number of lines */
 | 
				
			||||||
static unsigned int lines      = 0;
 | 
					static unsigned int lines      = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*
 | 
				
			||||||
 | 
					 * Characters not considered part of a word while deleting words
 | 
				
			||||||
 | 
					 * for example: " /?\"&[]"
 | 
				
			||||||
 | 
					 */
 | 
				
			||||||
 | 
					static const char worddelimiters[] = " ";
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								dmenu.c
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								dmenu.c
									
									
									
									
									
								
							@ -314,9 +314,11 @@ keypress(XKeyEvent *ev)
 | 
				
			|||||||
			insert(NULL, 0 - cursor);
 | 
								insert(NULL, 0 - cursor);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case XK_w: /* delete word */
 | 
							case XK_w: /* delete word */
 | 
				
			||||||
			while (cursor > 0 && text[nextrune(-1)] == ' ')
 | 
								while (cursor > 0 && strchr(worddelimiters,
 | 
				
			||||||
 | 
								       text[nextrune(-1)]))
 | 
				
			||||||
				insert(NULL, nextrune(-1) - cursor);
 | 
									insert(NULL, nextrune(-1) - cursor);
 | 
				
			||||||
			while (cursor > 0 && text[nextrune(-1)] != ' ')
 | 
								while (cursor > 0 && !strchr(worddelimiters,
 | 
				
			||||||
 | 
								       text[nextrune(-1)]))
 | 
				
			||||||
				insert(NULL, nextrune(-1) - cursor);
 | 
									insert(NULL, nextrune(-1) - cursor);
 | 
				
			||||||
			break;
 | 
								break;
 | 
				
			||||||
		case XK_y: /* paste selection */
 | 
							case XK_y: /* paste selection */
 | 
				
			||||||
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user