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
f1456764
Commit
f1456764
authored
10 years ago
by
Andrey Lushnikov
Committed by
Marijn Haverbeke
10 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[comment addon] Fix two border cases
Issue #2768
parent
85e8aa14
No related branches found
Branches containing commit
No related tags found
Tags containing commit
Loading
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
addon/comment/comment.js
+2
-2
2 additions, 2 deletions
addon/comment/comment.js
with
2 additions
and
2 deletions
addon/comment/comment.js
+
2
−
2
View file @
f1456764
...
...
@@ -157,12 +157,12 @@
// Positions of the last startString before the start of the selection, and the first endString after it.
var
lastStart
=
startLine
.
lastIndexOf
(
startString
,
from
.
ch
);
var
firstEnd
=
lastStart
==
-
1
?
-
1
:
startLine
.
slice
(
0
,
from
.
ch
).
indexOf
(
endString
,
lastStart
+
startString
.
length
);
if
(
lastStart
!=
-
1
&&
firstEnd
!=
-
1
)
return
false
;
if
(
lastStart
!=
-
1
&&
firstEnd
!=
-
1
&&
firstEnd
+
endString
.
length
!=
from
.
ch
)
return
false
;
// Positions of the first endString after the end of the selection, and the last startString before it.
firstEnd
=
endLine
.
indexOf
(
endString
,
to
.
ch
);
var
almostLastStart
=
endLine
.
slice
(
to
.
ch
).
lastIndexOf
(
startString
,
firstEnd
-
to
.
ch
);
lastStart
=
(
firstEnd
==
-
1
||
almostLastStart
==
-
1
)
?
-
1
:
to
.
ch
+
almostLastStart
;
if
(
firstEnd
!=
-
1
&&
lastStart
!=
-
1
)
return
false
;
if
(
firstEnd
!=
-
1
&&
lastStart
!=
-
1
&&
lastStart
!=
to
.
ch
)
return
false
;
self
.
operation
(
function
()
{
self
.
replaceRange
(
""
,
Pos
(
end
,
close
-
(
pad
&&
endLine
.
slice
(
close
-
pad
.
length
,
close
)
==
pad
?
pad
.
length
:
0
)),
...
...
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