Force the creation of a unicode regexp when the buffer has astral chars
MODIFY
lib/buffer-search.js
lib/buffer-search.js
@@ -141,11 +141,10 @@ class BufferSearch {
end = Point.min(end, this.selectedRange.end);
}
- const regex = this.getFindPatternRegex()
+ const buffer = this.editor.getBuffer()
+ const regex = this.getFindPatternRegex(buffer.hasAstral())
if (regex) {
try {
- const buffer = this.editor.getBuffer()
-
// TODO - remove this conditional after Atom 1.25 ships
if (buffer.findAndMarkAllInRangeSync) {
newMarkers = this.editor.getBuffer().findAndMarkAllInRangeSync(
@@ -283,9 +282,9 @@ class BufferSearch {
return this.resultsMarkerLayer.markBufferRange(range, {invalidate: 'inside'});
}
- getFindPatternRegex() {
+ getFindPatternRegex(forceUnicode) {
try {
- return this.findOptions.getFindPatternRegex();
+ return this.findOptions.getFindPatternRegex(forceUnicode);
} catch (e) {
this.emitter.emit('did-error', e);
return null;

MODIFY
lib/find-options.coffee
lib/find-options.coffee
@@ -53,9 +53,10 @@ class FindOptions
@emitter.emit('did-change', changedParams)
return changedParams
- getFindPatternRegex: ->
+ getFindPatternRegex: (forceUnicode = false) ->
flags = 'gm'
flags += 'i' unless @caseSensitive
+ flags += 'u' if forceUnicode
if @useRegex
expression = @findPattern

Force the creation of a unicode regexp when the buffer has astral chars