Changeset 2226 in josm


Ignore:
Timestamp:
2009-10-03T11:28:33+02:00 (15 years ago)
Author:
stoecker
Message:

fixed #3544 - patch by singularita gmail com - fix search dialog history

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/openstreetmap/josm/actions/search/SearchAction.java

    r2212 r2226  
    2929public class SearchAction extends JosmAction{
    3030
    31     public static final int SEARCH_HISTORY_SIZE = 10;
     31    public static final int DEFAULT_SEARCH_HISTORY_SIZE = 10;
     32
    3233
    3334    public static enum SearchMode {
     
    158159    public static void searchWithHistory(SearchSetting s) {
    159160        if(searchHistory.isEmpty() || !s.equals(searchHistory.getFirst())) {
    160             searchHistory.addFirst(s);
    161         }
    162         while (searchHistory.size() > SEARCH_HISTORY_SIZE) {
     161            searchHistory.addFirst(new SearchSetting(s));
     162        }
     163        while (searchHistory.size() > Main.pref.getInteger("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE)) {
    163164            searchHistory.removeLast();
    164165        }
     
    280281        }
    281282
     283        public SearchSetting(SearchSetting original) {
     284            super();
     285            this.caseSensitive = original.caseSensitive;
     286            this.regexSearch = original.regexSearch;
     287            this.mode = original.mode;
     288            this.text = original.text;
     289        }
     290
    282291        @Override
    283292        public String toString() {
Note: See TracChangeset for help on using the changeset viewer.