From b36f39c55e895c412e220487036d0e598d7b62de Mon Sep 17 00:00:00 2001 From: moculus Date: Sat, 21 Jul 2007 22:58:17 +0000 Subject: [PATCH] --HG-- branch : pmacs2 --- mode/replace.py | 8 ++++---- mode/search.py | 26 +++++++++++++------------- search.py => searchutil.py | 0 3 files changed, 17 insertions(+), 17 deletions(-) rename search.py => searchutil.py (100%) diff --git a/mode/replace.py b/mode/replace.py index 937eb57..0db301b 100644 --- a/mode/replace.py +++ b/mode/replace.py @@ -1,6 +1,6 @@ import re, sets, string -import color, method, minibuffer, mode2, search +import color, method, minibuffer, mode2, searchutil from point2 import Point class Replace(mode2.Fundamental): @@ -57,13 +57,13 @@ def _find_next(m, move=False): w = m.old_window c = w.logical_cursor() try: - r = re.compile(search.escape_literal(s)) + r = re.compile(searchutil.escape_literal(s)) except: (m.p1, m.p2) = (None, None) return False - #newc = search.find_next(r, w, move, start=c.add(1, 0)) - newc = search.find_next(r, w, move, start=c.add(0, 0)) + #newc = searchutil.find_next(r, w, move, start=c.add(1, 0)) + newc = searchutil.find_next(r, w, move, start=c.add(0, 0)) if newc: (m.p1, m.p2) = newc return True diff --git a/mode/search.py b/mode/search.py index 56e10f4..cfdc898 100644 --- a/mode/search.py +++ b/mode/search.py @@ -1,6 +1,6 @@ import re, sets, string -import color, method, minibuffer, mode2, search +import color, method, minibuffer, mode2, searchutil from point2 import Point selected_color = 'magenta' @@ -35,12 +35,12 @@ class Search(mode2.Fundamental): def _make_regex(w, s): try: if w.buffer.method.is_literal: - s = search.escape_literal(s) + s = searchutil.escape_literal(s) return re.compile(s, re.IGNORECASE) else: return re.compile(s) except: - raise search.IllegalPatternError, "failed to compile: %r" % s + raise searchutil.IllegalPatternError, "failed to compile: %r" % s class SearchNext(method.Method): def execute(self, w, **vargs): @@ -49,8 +49,8 @@ class SearchNext(method.Method): if s: try: r = _make_regex(w, s) - search.find_next(r, w.buffer.method.old_window, move=True) - except search.IllegalPatternError: + searchutil.find_next(r, w.buffer.method.old_window, move=True) + except searchutil.IllegalPatternError: w.application.clear_highlighted_ranges() else: w.buffer.set_data(w.application.last_search) @@ -65,8 +65,8 @@ class SearchPrevious(method.Method): w2 = w.buffer.method.old_window try: r = _make_regex(w, s) - search.find_previous(r, w2, move=True) - except search.IllegalPatternError: + searchutil.find_previous(r, w2, move=True) + except searchutil.IllegalPatternError: w.application.clear_highlighted_ranges() class EndSearch(method.Method): @@ -103,10 +103,10 @@ def _post_delete(w): try: r = _make_regex(w, s) if w.buffer.method.direction == 'next': - search.find_next(r, w2, move=False) + searchutil.find_next(r, w2, move=False) else: - search.find_previous(r, w2, move=False) - except search.IllegalPatternError: + searchutil.find_previous(r, w2, move=False) + except searchutil.IllegalPatternError: w.application.clear_highlighted_ranges() class InsertSearchString(method.Method): @@ -126,10 +126,10 @@ class InsertSearchString(method.Method): r = _make_regex(w, s) w2 = w.buffer.method.old_window if w.buffer.method.direction == 'next': - search.find_next(r, w2, move=False) + searchutil.find_next(r, w2, move=False) else: - search.find_previous(r, w2, move=False) - except search.IllegalPatternError: + searchutil.find_previous(r, w2, move=False) + except searchutil.IllegalPatternError: w.application.clear_highlighted_ranges() def _end(w): diff --git a/search.py b/searchutil.py similarity index 100% rename from search.py rename to searchutil.py