parent
dc59cd567d
commit
b36f39c55e
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in New Issue