parent
dc59cd567d
commit
b36f39c55e
|
@ -1,6 +1,6 @@
|
||||||
import re, sets, string
|
import re, sets, string
|
||||||
|
|
||||||
import color, method, minibuffer, mode2, search
|
import color, method, minibuffer, mode2, searchutil
|
||||||
from point2 import Point
|
from point2 import Point
|
||||||
|
|
||||||
class Replace(mode2.Fundamental):
|
class Replace(mode2.Fundamental):
|
||||||
|
@ -57,13 +57,13 @@ def _find_next(m, move=False):
|
||||||
w = m.old_window
|
w = m.old_window
|
||||||
c = w.logical_cursor()
|
c = w.logical_cursor()
|
||||||
try:
|
try:
|
||||||
r = re.compile(search.escape_literal(s))
|
r = re.compile(searchutil.escape_literal(s))
|
||||||
except:
|
except:
|
||||||
(m.p1, m.p2) = (None, None)
|
(m.p1, m.p2) = (None, None)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
#newc = search.find_next(r, w, move, start=c.add(1, 0))
|
#newc = searchutil.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(0, 0))
|
||||||
if newc:
|
if newc:
|
||||||
(m.p1, m.p2) = newc
|
(m.p1, m.p2) = newc
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import re, sets, string
|
import re, sets, string
|
||||||
|
|
||||||
import color, method, minibuffer, mode2, search
|
import color, method, minibuffer, mode2, searchutil
|
||||||
from point2 import Point
|
from point2 import Point
|
||||||
|
|
||||||
selected_color = 'magenta'
|
selected_color = 'magenta'
|
||||||
|
@ -35,12 +35,12 @@ class Search(mode2.Fundamental):
|
||||||
def _make_regex(w, s):
|
def _make_regex(w, s):
|
||||||
try:
|
try:
|
||||||
if w.buffer.method.is_literal:
|
if w.buffer.method.is_literal:
|
||||||
s = search.escape_literal(s)
|
s = searchutil.escape_literal(s)
|
||||||
return re.compile(s, re.IGNORECASE)
|
return re.compile(s, re.IGNORECASE)
|
||||||
else:
|
else:
|
||||||
return re.compile(s)
|
return re.compile(s)
|
||||||
except:
|
except:
|
||||||
raise search.IllegalPatternError, "failed to compile: %r" % s
|
raise searchutil.IllegalPatternError, "failed to compile: %r" % s
|
||||||
|
|
||||||
class SearchNext(method.Method):
|
class SearchNext(method.Method):
|
||||||
def execute(self, w, **vargs):
|
def execute(self, w, **vargs):
|
||||||
|
@ -49,8 +49,8 @@ class SearchNext(method.Method):
|
||||||
if s:
|
if s:
|
||||||
try:
|
try:
|
||||||
r = _make_regex(w, s)
|
r = _make_regex(w, s)
|
||||||
search.find_next(r, w.buffer.method.old_window, move=True)
|
searchutil.find_next(r, w.buffer.method.old_window, move=True)
|
||||||
except search.IllegalPatternError:
|
except searchutil.IllegalPatternError:
|
||||||
w.application.clear_highlighted_ranges()
|
w.application.clear_highlighted_ranges()
|
||||||
else:
|
else:
|
||||||
w.buffer.set_data(w.application.last_search)
|
w.buffer.set_data(w.application.last_search)
|
||||||
|
@ -65,8 +65,8 @@ class SearchPrevious(method.Method):
|
||||||
w2 = w.buffer.method.old_window
|
w2 = w.buffer.method.old_window
|
||||||
try:
|
try:
|
||||||
r = _make_regex(w, s)
|
r = _make_regex(w, s)
|
||||||
search.find_previous(r, w2, move=True)
|
searchutil.find_previous(r, w2, move=True)
|
||||||
except search.IllegalPatternError:
|
except searchutil.IllegalPatternError:
|
||||||
w.application.clear_highlighted_ranges()
|
w.application.clear_highlighted_ranges()
|
||||||
|
|
||||||
class EndSearch(method.Method):
|
class EndSearch(method.Method):
|
||||||
|
@ -103,10 +103,10 @@ def _post_delete(w):
|
||||||
try:
|
try:
|
||||||
r = _make_regex(w, s)
|
r = _make_regex(w, s)
|
||||||
if w.buffer.method.direction == 'next':
|
if w.buffer.method.direction == 'next':
|
||||||
search.find_next(r, w2, move=False)
|
searchutil.find_next(r, w2, move=False)
|
||||||
else:
|
else:
|
||||||
search.find_previous(r, w2, move=False)
|
searchutil.find_previous(r, w2, move=False)
|
||||||
except search.IllegalPatternError:
|
except searchutil.IllegalPatternError:
|
||||||
w.application.clear_highlighted_ranges()
|
w.application.clear_highlighted_ranges()
|
||||||
|
|
||||||
class InsertSearchString(method.Method):
|
class InsertSearchString(method.Method):
|
||||||
|
@ -126,10 +126,10 @@ class InsertSearchString(method.Method):
|
||||||
r = _make_regex(w, s)
|
r = _make_regex(w, s)
|
||||||
w2 = w.buffer.method.old_window
|
w2 = w.buffer.method.old_window
|
||||||
if w.buffer.method.direction == 'next':
|
if w.buffer.method.direction == 'next':
|
||||||
search.find_next(r, w2, move=False)
|
searchutil.find_next(r, w2, move=False)
|
||||||
else:
|
else:
|
||||||
search.find_previous(r, w2, move=False)
|
searchutil.find_previous(r, w2, move=False)
|
||||||
except search.IllegalPatternError:
|
except searchutil.IllegalPatternError:
|
||||||
w.application.clear_highlighted_ranges()
|
w.application.clear_highlighted_ranges()
|
||||||
|
|
||||||
def _end(w):
|
def _end(w):
|
||||||
|
|
Loading…
Reference in New Issue