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
1cb6619d
Commit
1cb6619d
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
undo: there are just two forms of deletion: backspacing and deleting
A third method does not exist.
parent
79a4bf81
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
+3
-9
src/text.c
with
3 additions
and
9 deletions
+3
-9
src/text.c
View file @
1cb6619d
...
...
@@ -1366,21 +1366,15 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
}
case
BACK
:
case
DEL
:
{
/* Add the removed character after or before earlier removed stuff. */
char
*
char_buf
=
charalloc
(
mb_cur_max
());
int
char_len
=
parse_mbchar
(
&
openfile
->
current
->
data
[
openfile
->
current_x
],
char_buf
,
NULL
);
if
(
openfile
->
current_x
==
u
->
begin
)
{
/* They're deleting. */
if
(
action
==
DEL
)
{
u
->
strdata
=
addstrings
(
u
->
strdata
,
strlen
(
u
->
strdata
),
char_buf
,
char_len
);
u
->
mark_begin_x
=
openfile
->
current_x
;
}
else
if
(
openfile
->
current_x
==
u
->
begin
-
char_len
)
{
/* They're backspacing. */
}
else
{
u
->
strdata
=
addstrings
(
char_buf
,
char_len
,
u
->
strdata
,
strlen
(
u
->
strdata
));
u
->
begin
=
openfile
->
current_x
;
}
else
{
/* They deleted something else on the line. */
free
(
char_buf
);
add_undo
(
u
->
type
);
return
;
}
#ifdef DEBUG
fprintf
(
stderr
,
" >> current undo data is
\"
%s
\"\n
u->begin = %lu
\n
"
,
u
->
strdata
,
(
unsigned
long
)
u
->
begin
);
...
...
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