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
95fffa99
Commit
95fffa99
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: adjust two comments, move two declarations, rewrap three lines
parent
22f78616
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/text.c
+16
-18
src/text.c
with
16 additions
and
18 deletions
+16
-18
src/text.c
View file @
95fffa99
...
...
@@ -1368,20 +1368,19 @@ void update_multiline_undo(ssize_t lineno, char *indentation)
u
->
newsize
=
openfile
->
totsize
;
}
/* Update an undo item, or determine whether a new one is really needed
* and bounce the data to add_undo instead. The latter functionality
* just feels gimmicky and may just be more hassle than it's worth,
* so it should be axed if needed. */
/* Update an undo record, after checking that a new one is not needed. */
void
update_undo
(
undo_type
action
)
{
undo
*
u
;
undo
*
u
=
openfile
->
undotop
;
char
*
char_buf
;
int
char_len
;
#ifdef DEBUG
fprintf
(
stderr
,
" >> Updating an undo... action = %d
\n
"
,
action
);
#endif
/*
Change to an add if we're not using the same undo struct
*
that we should be using
. */
/*
If the action is different or the position changed, don't update the
*
current record but add a new one instead
. */
if
(
action
!=
openfile
->
last_action
||
(
action
!=
ENTER
&&
action
!=
CUT
&&
action
!=
INSERT
&&
openfile
->
current
->
lineno
!=
openfile
->
current_undo
->
lineno
))
{
...
...
@@ -1389,27 +1388,27 @@ fprintf(stderr, " >> Updating an undo... action = %d\n", action);
return
;
}
u
=
openfile
->
undotop
;
u
->
newsize
=
openfile
->
totsize
;
switch
(
u
->
type
)
{
case
ADD
:
{
char
*
char_buf
=
charalloc
(
MAXCHARLEN
);
int
char_len
=
parse_mbchar
(
&
openfile
->
current
->
data
[
u
->
mark_begin_x
],
char_buf
,
NULL
);
u
->
strdata
=
addstrings
(
u
->
strdata
,
u
->
strdata
?
strlen
(
u
->
strdata
)
:
0
,
char_buf
,
char_len
);
case
ADD
:
char_buf
=
charalloc
(
MAXCHARLEN
);
char_len
=
parse_mbchar
(
&
openfile
->
current
->
data
[
u
->
mark_begin_x
],
char_buf
,
NULL
);
u
->
strdata
=
addstrings
(
u
->
strdata
,
u
->
strdata
?
strlen
(
u
->
strdata
)
:
0
,
char_buf
,
char_len
);
u
->
mark_begin_lineno
=
openfile
->
current
->
lineno
;
u
->
mark_begin_x
=
openfile
->
current_x
;
break
;
}
case
ENTER
:
u
->
strdata
=
mallocstrcpy
(
NULL
,
openfile
->
current
->
data
);
u
->
mark_begin_x
=
openfile
->
current_x
;
break
;
case
BACK
:
case
DEL
:
{
char
*
char_buf
=
charalloc
(
MAXCHARLEN
);
int
char_len
=
parse_mbchar
(
&
openfile
->
current
->
data
[
openfile
->
current_x
],
char_buf
,
NULL
);
case
DEL
:
char_buf
=
charalloc
(
MAXCHARLEN
);
char_len
=
parse_mbchar
(
&
openfile
->
current
->
data
[
openfile
->
current_x
],
char_buf
,
NULL
);
if
(
openfile
->
current_x
==
u
->
begin
)
{
/* They deleted more: add removed character after earlier stuff. */
u
->
strdata
=
addstrings
(
u
->
strdata
,
strlen
(
u
->
strdata
),
char_buf
,
char_len
);
...
...
@@ -1425,7 +1424,6 @@ fprintf(stderr, " >> Updating an undo... action = %d\n", action);
return
;
}
break
;
}
case
JOIN
:
break
;
case
REPLACE
:
...
...
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