mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	navbar: Append space at the end of filter for search convenience.
As long as the current narrow isn't already a search narrow or empty, we add a single space at the end of the current filter so that the user can just press the right arrow key and begin typing their search term, instead of having to add a space themselves.
This commit is contained in:
		@@ -311,7 +311,11 @@ exports.activate = function (raw_operators, opts) {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Put the narrow operators in the search bar.
 | 
					    // Put the narrow operators in the search bar.
 | 
				
			||||||
    $('#search_query').val(Filter.unparse(operators));
 | 
					    // we append a space to make searching more convenient in some cases.
 | 
				
			||||||
 | 
					    if (filter && !filter.is_search()) {
 | 
				
			||||||
 | 
					        $('#search_query').val(Filter.unparse(operators) + " ");
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    search.update_button_visibility();
 | 
					    search.update_button_visibility();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    compose_actions.on_narrow(opts);
 | 
					    compose_actions.on_narrow(opts);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,7 +87,12 @@ exports.exit_search = function () {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        // reset searchbox text
 | 
					        // reset searchbox text
 | 
				
			||||||
        const search_string = narrow_state.search_string();
 | 
					        const search_string = narrow_state.search_string();
 | 
				
			||||||
        $("#search_query").val(search_string);
 | 
					        // This does not need to be conditional like the corresponding
 | 
				
			||||||
 | 
					        // function call in narrow.activate because search filters are
 | 
				
			||||||
 | 
					        // not common narrows
 | 
				
			||||||
 | 
					        if (search_string !== "") {
 | 
				
			||||||
 | 
					            $("#search_query").val(search_string + " ");
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        // for "searching narrows", we redirect
 | 
					        // for "searching narrows", we redirect
 | 
				
			||||||
        window.location.replace(filter.generate_redirect_url());
 | 
					        window.location.replace(filter.generate_redirect_url());
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user