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
06b449b2
Commit
06b449b2
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
utils: provide a failure message for all uses of 'fsfromline'
parent
fe9cf6f3
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/text.c
+8
-11
src/text.c
src/utils.c
+4
-1
src/utils.c
with
12 additions
and
12 deletions
+12
-12
src/text.c
View file @
06b449b2
...
...
@@ -478,7 +478,7 @@ void redo_cut(undo *u)
void
do_undo
(
void
)
{
undo
*
u
=
openfile
->
current_undo
;
filestruct
*
t
=
NULL
;
filestruct
*
f
,
*
t
=
NULL
;
char
*
data
,
*
undidmsg
=
NULL
;
if
(
!
u
)
{
...
...
@@ -486,12 +486,10 @@ void do_undo(void)
return
;
}
filestruct
*
f
=
fsfromline
(
u
->
mark_begin_lineno
);
if
(
!
f
)
{
statusbar
(
_
(
"Internal error: can't match line %d. "
"Please save your work."
),
u
->
mark_begin_lineno
);
f
=
fsfromline
(
u
->
mark_begin_lineno
);
if
(
!
f
)
return
;
}
#ifdef DEBUG
fprintf
(
stderr
,
" >> Undoing a type %d...
\n
"
,
u
->
type
);
fprintf
(
stderr
,
" >> Data we're about to undo =
\"
%s
\"\n
"
,
f
->
data
);
...
...
@@ -621,6 +619,7 @@ void do_undo(void)
/* Redo the last thing(s) we undid. */
void
do_redo
(
void
)
{
filestruct
*
f
;
char
*
data
,
*
redidmsg
=
NULL
;
undo
*
u
=
openfile
->
undotop
;
...
...
@@ -638,12 +637,10 @@ void do_redo(void)
return
;
}
filestruct
*
f
=
fsfromline
(
u
->
type
==
INSERT
?
1
:
u
->
mark_begin_lineno
);
if
(
!
f
)
{
statusbar
(
_
(
"Internal error: can't match line %d. "
"Please save your work."
),
u
->
mark_begin_lineno
);
f
=
fsfromline
(
u
->
type
==
INSERT
?
1
:
u
->
mark_begin_lineno
);
if
(
!
f
)
return
;
}
#ifdef DEBUG
fprintf
(
stderr
,
" >> Redo running for type %d
\n
"
,
u
->
type
);
fprintf
(
stderr
,
" >> Data we're about to redo =
\"
%s
\"\n
"
,
f
->
data
);
...
...
This diff is collapsed.
Click to expand it.
src/utils.c
View file @
06b449b2
...
...
@@ -623,8 +623,11 @@ filestruct *fsfromline(ssize_t lineno)
while
(
f
->
lineno
!=
lineno
&&
f
->
next
!=
NULL
)
f
=
f
->
next
;
if
(
f
->
lineno
!=
lineno
)
if
(
f
->
lineno
!=
lineno
)
{
statusbar
(
_
(
"Internal error: can't match line %d. "
"Please save your work."
),
lineno
);
return
NULL
;
}
return
f
;
}
...
...
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