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
dbb2645c
Commit
dbb2645c
authored
7 years ago
by
Travis Heppe
Committed by
Marijn Haverbeke
7 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[matchbrackets addon] Add afterCursor option
Default this to true when the fat-cursor style is active. Issue #4803
parent
f1d002ff
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
addon/edit/matchbrackets.js
+19
-1
19 additions, 1 deletion
addon/edit/matchbrackets.js
with
19 additions
and
1 deletion
addon/edit/matchbrackets.js
+
19
−
1
View file @
dbb2645c
...
...
@@ -18,7 +18,25 @@
function
findMatchingBracket
(
cm
,
where
,
strict
,
config
)
{
var
line
=
cm
.
getLineHandle
(
where
.
line
),
pos
=
where
.
ch
-
1
;
var
match
=
(
pos
>=
0
&&
matching
[
line
.
text
.
charAt
(
pos
)])
||
matching
[
line
.
text
.
charAt
(
++
pos
)];
var
match
;
var
afterCursor
;
if
(
!
config
||
config
.
afterCursor
===
undefined
)
{
var
paddedClassName
=
'
'
+
cm
.
getWrapperElement
().
className
+
'
'
;
afterCursor
=
(
paddedClassName
.
indexOf
(
'
cm-fat-cursor
'
)
>
-
1
);
}
else
{
afterCursor
=
config
.
afterCursor
;
}
// A cursor is defined as between two characters, but in in vim command mode
// (i.e. not insert mode), the cursor is visually represented as a
// highlighted box on top of the 2nd character. Otherwise, we allow matches
// from before or after the cursor.
if
(
afterCursor
)
{
match
=
matching
[
line
.
text
.
charAt
(
++
pos
)];
}
else
{
match
=
(
pos
>=
0
&&
matching
[
line
.
text
.
charAt
(
pos
)])
||
matching
[
line
.
text
.
charAt
(
++
pos
)];
}
if
(
!
match
)
return
null
;
var
dir
=
match
.
charAt
(
1
)
==
"
>
"
?
1
:
-
1
;
if
(
strict
&&
(
dir
>
0
)
!=
(
pos
==
where
.
ch
))
return
null
;
...
...
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