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
7ab8a4d8
Commit
7ab8a4d8
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: improve the ordering of a couple of functions
parent
0353a244
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/proto.h
+2
-2
src/proto.h
src/search.c
+27
-27
src/search.c
with
29 additions
and
29 deletions
+29
-29
src/proto.h
View file @
7ab8a4d8
...
...
@@ -478,18 +478,18 @@ void do_rcfiles(void);
#endif
/* ENABLE_NANORC */
/* Most functions in search.c. */
void
not_found_msg
(
const
char
*
str
);
void
tidy_up_after_search
(
void
);
int
findnextstr
(
const
char
*
needle
,
bool
whole_word_only
,
int
modus
,
size_t
*
match_len
,
bool
skipone
,
const
filestruct
*
begin
,
size_t
begin_x
);
void
do_search
(
void
);
void
do_search_forward
(
void
);
void
do_search_backward
(
void
);
void
do_research
(
void
);
#ifndef NANO_TINY
void
do_findprevious
(
void
);
void
do_findnext
(
void
);
#endif
void
do_research
(
void
);
void
not_found_msg
(
const
char
*
str
);
void
go_looking
(
void
);
ssize_t
do_replace_loop
(
const
char
*
needle
,
bool
whole_word_only
,
const
filestruct
*
real_current
,
size_t
*
real_current_x
);
...
...
This diff is collapsed.
Click to expand it.
src/search.c
View file @
7ab8a4d8
...
...
@@ -55,17 +55,6 @@ bool regexp_init(const char *regexp)
return
TRUE
;
}
/* Report on the status bar that the given string was not found. */
void
not_found_msg
(
const
char
*
str
)
{
char
*
disp
=
display_string
(
str
,
0
,
(
COLS
/
2
)
+
1
,
FALSE
);
size_t
numchars
=
actual_x
(
disp
,
strnlenpt
(
disp
,
COLS
/
2
));
statusline
(
HUSH
,
_
(
"
\"
%.*s%s
\"
not found"
),
numchars
,
disp
,
(
disp
[
numchars
]
==
'\0'
)
?
""
:
"..."
);
free
(
disp
);
}
/* Free a compiled regular expression, if one was compiled; and schedule a
* full screen refresh when the mark is on, in case the cursor has moved. */
void
tidy_up_after_search
(
void
)
...
...
@@ -354,22 +343,6 @@ void do_search_backward(void)
do_search
();
}
#ifndef NANO_TINY
/* Search in the backward direction for the next occurrence. */
void
do_findprevious
(
void
)
{
SET
(
BACKWARDS_SEARCH
);
do_research
();
}
/* Search in the forward direction for the next occurrence. */
void
do_findnext
(
void
)
{
UNSET
(
BACKWARDS_SEARCH
);
do_research
();
}
#endif
/* !NANO_TINY */
/* Search for the last string without prompting. */
void
do_research
(
void
)
{
...
...
@@ -396,6 +369,33 @@ void do_research(void)
tidy_up_after_search
();
}
#ifndef NANO_TINY
/* Search in the backward direction for the next occurrence. */
void
do_findprevious
(
void
)
{
SET
(
BACKWARDS_SEARCH
);
do_research
();
}
/* Search in the forward direction for the next occurrence. */
void
do_findnext
(
void
)
{
UNSET
(
BACKWARDS_SEARCH
);
do_research
();
}
#endif
/* !NANO_TINY */
/* Report on the status bar that the given string was not found. */
void
not_found_msg
(
const
char
*
str
)
{
char
*
disp
=
display_string
(
str
,
0
,
(
COLS
/
2
)
+
1
,
FALSE
);
size_t
numchars
=
actual_x
(
disp
,
strnlenpt
(
disp
,
COLS
/
2
));
statusline
(
HUSH
,
_
(
"
\"
%.*s%s
\"
not found"
),
numchars
,
disp
,
(
disp
[
numchars
]
==
'\0'
)
?
""
:
"..."
);
free
(
disp
);
}
/* Search for the global string 'last_search'. Inform the user when
* the string occurs only once. */
void
go_looking
(
void
)
...
...
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