2 findInBuffer : (buffer, pattern) ->
4 buffer.scan(new RegExp(pattern, 'g'), (obj) -> found.push obj.range)
7 findNextInBuffer : (buffer, curPos, pattern) ->
8 found = @findInBuffer(buffer, pattern)
9 more = (i for i in found when i.compare([curPos, curPos]) is 1)
11 return more[0].start.row
12 else if found.length > 0
13 return found[0].start.row
17 findPreviousInBuffer : (buffer, curPos, pattern) ->
18 found = @findInBuffer(buffer, pattern)
19 less = (i for i in found when i.compare([curPos, curPos]) is -1)
21 return less[less.length - 1].start.row
22 else if found.length > 0
23 return found[found.length - 1].start.row