Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
CodeMirror
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Moritz Aurel Pascal Schubotz
CodeMirror
Commits
61023686
Commit
61023686
authored
7 years ago
by
Marijn Haverbeke
Browse files
Options
Downloads
Patches
Plain Diff
[searchcursor addon] Fix infinite loop when a match starts inside a composed char
Closes #4839
parent
a7f209d0
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
addon/search/searchcursor.js
+7
-5
7 additions, 5 deletions
addon/search/searchcursor.js
test/search_test.js
+6
-0
6 additions, 0 deletions
test/search_test.js
with
13 additions
and
5 deletions
addon/search/searchcursor.js
+
7
−
5
View file @
61023686
...
@@ -128,11 +128,13 @@
...
@@ -128,11 +128,13 @@
// (compensating for codepoints increasing in number during folding)
// (compensating for codepoints increasing in number during folding)
function
adjustPos
(
orig
,
folded
,
pos
,
foldFunc
)
{
function
adjustPos
(
orig
,
folded
,
pos
,
foldFunc
)
{
if
(
orig
.
length
==
folded
.
length
)
return
pos
if
(
orig
.
length
==
folded
.
length
)
return
pos
for
(
var
pos1
=
Math
.
min
(
pos
,
orig
.
length
);;)
{
for
(
var
min
=
0
,
max
=
pos
+
Math
.
max
(
0
,
orig
.
length
-
folded
.
length
);;)
{
var
len1
=
foldFunc
(
orig
.
slice
(
0
,
pos1
)).
length
if
(
min
==
max
)
return
min
if
(
len1
<
pos
)
++
pos1
let
mid
=
(
min
+
max
)
>>
1
else
if
(
len1
>
pos
)
--
pos1
var
len
=
foldFunc
(
orig
.
slice
(
0
,
mid
)).
length
else
return
pos1
if
(
len
==
pos
)
return
mid
else
if
(
len
>
pos
)
max
=
mid
-
1
else
min
=
mid
+
1
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
test/search_test.js
+
6
−
0
View file @
61023686
...
@@ -74,4 +74,10 @@
...
@@ -74,4 +74,10 @@
run
(
doc
,
"
</b>
"
,
true
,
0
,
8
,
0
,
12
,
1
,
8
,
1
,
12
);
run
(
doc
,
"
</b>
"
,
true
,
0
,
8
,
0
,
12
,
1
,
8
,
1
,
12
);
run
(
doc
,
"
İİ
"
,
true
,
0
,
3
,
0
,
5
,
0
,
6
,
0
,
8
);
run
(
doc
,
"
İİ
"
,
true
,
0
,
3
,
0
,
5
,
0
,
6
,
0
,
8
);
});
});
test
(
"
normalize
"
,
function
()
{
var
doc
=
new
CodeMirror
.
Doc
(
"
yılbaşı
\n
수 있을까
"
)
run
(
doc
,
"
s
"
,
false
,
0
,
5
,
0
,
6
)
run
(
doc
,
"
이
"
,
false
,
1
,
2
,
1
,
3
)
})
})();
})();
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment