Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
bfed7386
Commit
bfed7386
authored
5 years ago
by
Caleb C. Sander
Browse files
Options
Download
Email Patches
Plain Diff
Insert matching ), ], and } characters
parent
e771503e
feature/match-parens
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/nano.c
+14
-7
src/nano.c
with
14 additions
and
7 deletions
+14
-7
src/nano.c
View file @
bfed7386
...
...
@@ -1862,14 +1862,21 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
continue
;
/* Make room for the new character and copy it into the line. */
openfile
->
current
->
data
=
charealloc
(
openfile
->
current
->
data
,
current_len
+
char_len
+
1
);
charmove
(
openfile
->
current
->
data
+
openfile
->
current_x
+
char_len
,
openfile
->
current
->
data
+
openfile
->
current_x
,
char
matching_char
=
*
onechar
==
'('
?
')'
:
*
onechar
==
'['
?
']'
:
*
onechar
==
'{'
?
'}'
:
'\0'
;
size_t
insert_length
=
matching_char
?
char_len
+
1
:
char_len
;
openfile
->
current
->
data
=
charealloc
(
openfile
->
current
->
data
,
current_len
+
insert_length
+
1
);
char
*
insert_start
=
openfile
->
current
->
data
+
openfile
->
current_x
;
charmove
(
insert_start
+
insert_length
,
insert_start
,
current_len
-
openfile
->
current_x
+
1
);
strncpy
(
openfile
->
current
->
data
+
openfile
->
current_x
,
onechar
,
char_len
);
current_len
+=
char_len
;
strncpy
(
insert_start
,
onechar
,
char_len
);
if
(
matching_char
)
{
insert_start
[
char_len
]
=
matching_char
;
}
current_len
+=
insert_length
;
openfile
->
totsize
++
;
set_modified
();
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help