mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 21:51:50 +00:00 
			
		
		
		
	Assume that the user knows when he wants to end the line; don't insert
something he didn't select or complete.
This commit is contained in:
		
							parent
							
								
									50e90e265f
								
							
						
					
					
						commit
						67bd62fd6c
					
				
					 2 changed files with 4 additions and 15 deletions
				
			
		|  | @ -27,7 +27,7 @@ class AutoComplete: | ||||||
| 
 | 
 | ||||||
|     menudefs = [ |     menudefs = [ | ||||||
|         ('edit', [ |         ('edit', [ | ||||||
|             ("Show completions", "<<force-open-completions>>"), |             ("Show Completions", "<<force-open-completions>>"), | ||||||
|         ]) |         ]) | ||||||
|     ] |     ] | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -283,20 +283,9 @@ def keypress_event(self, event): | ||||||
|             self._selection_changed() |             self._selection_changed() | ||||||
|             return "break" |             return "break" | ||||||
| 
 | 
 | ||||||
|         elif keysym == "Return" and not state: |         elif keysym == "Return": | ||||||
|             # If start is a prefix of the selection, or there was an indication |             self.hide_window() | ||||||
|             # that the user used the completion window, put the selected |             return | ||||||
|             # completion in the text, and close the list. |  | ||||||
|             # Otherwise, close the window and let the event through. |  | ||||||
|             cursel = int(self.listbox.curselection()[0]) |  | ||||||
|             if self.completions[cursel][:len(self.start)] == self.start or \ |  | ||||||
|                self.userwantswindow: |  | ||||||
|                 self._change_start(self.completions[cursel]) |  | ||||||
|                 self.hide_window() |  | ||||||
|                 return "break" |  | ||||||
|             else: |  | ||||||
|                 self.hide_window() |  | ||||||
|                 return |  | ||||||
| 
 | 
 | ||||||
|         elif (self.mode == AutoComplete.COMPLETE_ATTRIBUTES and keysym in |         elif (self.mode == AutoComplete.COMPLETE_ATTRIBUTES and keysym in | ||||||
|               ("period", "space", "parenleft", "parenright", "bracketleft", |               ("period", "space", "parenleft", "parenright", "bracketleft", | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Kurt B. Kaiser
						Kurt B. Kaiser