mirror of
				https://github.com/quitesimpleorg/hs9001.git
				synced 2025-11-04 03:39:30 +01:00 
			
		
		
		
	history: Only start search when at least 2 chars have been entered
Starting search with the first character leads to a noticable delay. This hack ensures a more pleasant experience.
This commit is contained in:
		@@ -12,6 +12,10 @@ type history struct {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (h *history) GetHistoryByPrefix(prefix string) (ph []string) {
 | 
					func (h *history) GetHistoryByPrefix(prefix string) (ph []string) {
 | 
				
			||||||
 | 
						/* Hack for performance reasons */
 | 
				
			||||||
 | 
						if len(prefix) < 2 {
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	opts := searchopts{}
 | 
						opts := searchopts{}
 | 
				
			||||||
	opts.order = "DESC"
 | 
						opts.order = "DESC"
 | 
				
			||||||
	cmdqry := prefix + "%"
 | 
						cmdqry := prefix + "%"
 | 
				
			||||||
@@ -27,6 +31,10 @@ func (h *history) GetHistoryByPrefix(prefix string) (ph []string) {
 | 
				
			|||||||
	return
 | 
						return
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
func (h *history) GetHistoryByPattern(pattern string) (ph []string, pos []int) {
 | 
					func (h *history) GetHistoryByPattern(pattern string) (ph []string, pos []int) {
 | 
				
			||||||
 | 
						/* Hack for performance reasons */
 | 
				
			||||||
 | 
						if len(pattern) < 2 {
 | 
				
			||||||
 | 
							return
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
	opts := searchopts{}
 | 
						opts := searchopts{}
 | 
				
			||||||
	opts.order = "DESC"
 | 
						opts.order = "DESC"
 | 
				
			||||||
	cmdqry := "%" + pattern + "%"
 | 
						cmdqry := "%" + pattern + "%"
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user