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
6a70d2b6
Commit
6a70d2b6
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename two functions and a variable, and invert its logic
parent
16482f99
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/proto.h
+2
-2
src/proto.h
src/search.c
+8
-7
src/search.c
src/winio.c
+9
-9
src/winio.c
with
19 additions
and
18 deletions
+19
-18
src/proto.h
View file @
6a70d2b6
...
...
@@ -677,8 +677,8 @@ void spotlight(bool active, const char *word);
void
xon_complaint
(
void
);
void
xoff_complaint
(
void
);
void
do_suspend_void
(
void
);
void
en
able_
nodelay
(
void
);
void
dis
able_
nodelay
(
void
);
void
dis
able_
waiting
(
void
);
void
en
able_
waiting
(
void
);
#ifndef DISABLE_EXTRA
void
do_credits
(
void
);
#endif
...
...
This diff is collapsed.
Click to expand it.
src/search.c
View file @
6a70d2b6
...
...
@@ -234,8 +234,10 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
size_t
found_x
;
/* The x coordinate of a found occurrence. */
time_t
lastkbcheck
=
time
(
NULL
);
/* The time we last looked at the keyboard. */
enable_nodelay
();
/* Set non-blocking input so that we can just peek for a Cancel. */
disable_waiting
();
if
(
begin
==
NULL
)
came_full_circle
=
FALSE
;
...
...
@@ -252,7 +254,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
while
(
input
)
{
if
(
func_from_key
(
&
input
)
==
do_cancel
)
{
statusbar
(
_
(
"Cancelled"
));
dis
able_
nodelay
();
en
able_
waiting
();
return
-
2
;
}
input
=
parse_kbinput
(
NULL
);
...
...
@@ -303,7 +305,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
/* If we're back at the beginning, then there is no needle. */
if
(
came_full_circle
)
{
not_found_msg
(
needle
);
dis
able_
nodelay
();
en
able_
waiting
();
return
0
;
}
...
...
@@ -317,7 +319,7 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
* but stop when spell-checking or replacing in a region. */
if
(
line
==
NULL
)
{
if
(
whole_word_only
||
have_region
)
{
dis
able_
nodelay
();
en
able_
waiting
();
return
0
;
}
...
...
@@ -343,16 +345,15 @@ int findnextstr(const char *needle, bool whole_word_only, bool have_region,
found_x
=
found
-
line
->
data
;
enable_waiting
();
/* Ensure that the found occurrence is not beyond the starting x. */
if
(
came_full_circle
&&
((
!
ISSET
(
BACKWARDS_SEARCH
)
&&
found_x
>
begin_x
)
||
(
ISSET
(
BACKWARDS_SEARCH
)
&&
found_x
<
begin_x
)))
{
not_found_msg
(
needle
);
disable_nodelay
();
return
0
;
}
disable_nodelay
();
/* Set the current position to point at what we found. */
openfile
->
current
=
line
;
openfile
->
current_x
=
found_x
;
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
6a70d2b6
...
...
@@ -45,8 +45,8 @@ static size_t key_buffer_len = 0;
/* The length of the keystroke buffer. */
static
bool
solitary
=
FALSE
;
/* Whether an Esc arrived by itself -- not as leader of a sequence. */
static
nodelay
_mode
=
FALS
E
;
/* Whether
we
will
check
for a
Cancel now and then during a search
. */
static
waiting
_mode
=
TRU
E
;
/* Whether
getting a character
will
wait
for a
key to be pressed
. */
static
int
statusblank
=
0
;
/* The number of keystrokes left before we blank the statusbar. */
#ifdef USING_OLD_NCURSES
...
...
@@ -135,7 +135,7 @@ void get_key_buffer(WINDOW *win)
}
#endif
if
(
input
==
ERR
&&
nodelay
_mode
)
if
(
input
==
ERR
&&
!
waiting
_mode
)
return
;
while
(
input
==
ERR
)
{
...
...
@@ -188,7 +188,7 @@ void get_key_buffer(WINDOW *win)
}
/* Restore waiting mode if it was on. */
if
(
!
nodelay
_mode
)
if
(
waiting
_mode
)
nodelay
(
win
,
FALSE
);
#ifdef DEBUG
...
...
@@ -327,7 +327,7 @@ int parse_kbinput(WINDOW *win)
/* Read in a character. */
kbinput
=
get_input
(
win
,
1
);
if
(
kbinput
==
NULL
&&
nodelay
_mode
)
if
(
kbinput
==
NULL
&&
!
waiting
_mode
)
return
0
;
while
(
kbinput
==
NULL
)
...
...
@@ -3228,15 +3228,15 @@ void do_cursorpos_void(void)
do_cursorpos
(
TRUE
);
}
void
en
able_
nodelay
(
void
)
void
dis
able_
waiting
(
void
)
{
nodelay
_mode
=
TRU
E
;
waiting
_mode
=
FALS
E
;
nodelay
(
edit
,
TRUE
);
}
void
dis
able_
nodelay
(
void
)
void
en
able_
waiting
(
void
)
{
nodelay
_mode
=
FALS
E
;
waiting
_mode
=
TRU
E
;
nodelay
(
edit
,
FALSE
);
}
...
...
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