mirror of
				git://git.code.sf.net/p/cdesktopenv/code
				synced 2025-03-09 15:50:02 +00:00 
			
		
		
		
	Fix the Alt+D and Alt+H keyboard shortcuts in emacs mode (#178)
This commit fixes the functionality of Alt+D and Alt+H in emacs mode.
These keyboard shortcuts are intended to work on whole words, but
after commit 13c3fb21 their functionality was reduced to deleting only
singular letters:
$ Test word <Alt+H>    # This should delete 'word', not just 'd'.
$ Foo <Alt+B> <Alt+D>  # This should delete 'Foo', not just 'F'.
Man page entries for reference:
  M-d       Delete current word.
  M-^H      (Meta-backspace) Delete previous word.
  M-h       Delete previous word.
src/cmd/ksh93/edit/emacs.c:
- 'count' cannot be overridden when handling Alt+D or Alt+H,
  so add the total number of repetitions to count (the number of
  repetitions can't be negative).
- If 'count' is a negative number, set it to one before adding the
  number of repetitions.
			
			
This commit is contained in:
		
							parent
							
								
									24598fed7c
								
							
						
					
					
						commit
						29b11bba3a
					
				
					 2 changed files with 8 additions and 5 deletions
				
			
		| 
						 | 
				
			
			@ -318,13 +318,13 @@ int ed_emacsread(void *context, int fd,char *buff,int scend, int reedit)
 | 
			
		|||
			killing = 0;
 | 
			
		||||
#endif
 | 
			
		||||
		oadjust = count = adjust;
 | 
			
		||||
		if(vt220_save_repeat)
 | 
			
		||||
		{
 | 
			
		||||
			count = vt220_save_repeat;
 | 
			
		||||
			vt220_save_repeat = 0;
 | 
			
		||||
		}
 | 
			
		||||
		if(count<0)
 | 
			
		||||
			count = 1;
 | 
			
		||||
		if(vt220_save_repeat>0)
 | 
			
		||||
		{
 | 
			
		||||
			count += vt220_save_repeat;
 | 
			
		||||
			vt220_save_repeat = 0;
 | 
			
		||||
		}
 | 
			
		||||
		adjust = -1;
 | 
			
		||||
		i = cur;
 | 
			
		||||
		if(c!='\t' && c!=ESC && !digit(c))
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue