Ticket #3544: shfix.patch

File shfix.patch, 1.5 KB (added by bilbo, 16 years ago)

bugfix + settable history size

  • src/org/openstreetmap/josm/actions/search/SearchAction.java

     
    2828
    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;
    3232
     33
    3334    public static enum SearchMode {
    3435        replace, add, remove, in_selection
    3536    }
     
    157158     */
    158159    public static void searchWithHistory(SearchSetting s) {
    159160        if(searchHistory.isEmpty() || !s.equals(searchHistory.getFirst())) {
    160             searchHistory.addFirst(s);
     161            searchHistory.addFirst(new SearchSetting(s));
    161162        }
    162         while (searchHistory.size() > SEARCH_HISTORY_SIZE) {
     163        while (searchHistory.size() > Main.pref.getInteger("search.history-size", DEFAULT_SEARCH_HISTORY_SIZE)) {
    163164            searchHistory.removeLast();
    164165        }
    165166        lastSearch = s;
     
    279280            this.text = text;
    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() {
    284293            String cs = caseSensitive ? tr("CS") : tr("CI");