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
5cbaf590
Commit
5cbaf590
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rearrange some key reading stuff in a clearer way
parent
f7c3e1ca
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/winio.c
+22
-24
src/winio.c
with
22 additions
and
24 deletions
+22
-24
src/winio.c
View file @
5cbaf590
...
...
@@ -110,7 +110,7 @@ static sig_atomic_t sigwinch_counter_save = 0;
void
get_key_buffer
(
WINDOW
*
win
)
{
int
input
;
size_t
errcount
;
size_t
errcount
=
0
;
/* If the keystroke buffer isn't empty, get out. */
if
(
key_buffer
!=
NULL
)
...
...
@@ -121,31 +121,29 @@ void get_key_buffer(WINDOW *win)
doupdate
();
/* Read in the first character using whatever mode we're in. */
errcount
=
0
;
if
(
nodelay_mode
)
{
if
((
input
=
wgetch
(
win
))
==
ERR
)
return
;
}
else
{
while
((
input
=
wgetch
(
win
))
==
ERR
)
{
#ifndef NANO_TINY
/* Did we get SIGWINCH since we were last here? */
if
(
sigwinch_counter
!=
sigwinch_counter_save
)
{
sigwinch_counter_save
=
sigwinch_counter
;
regenerate_screen
();
input
=
KEY_WINCH
;
break
;
}
else
#endif
errcount
++
;
input
=
wgetch
(
win
);
/* If we've failed to get a character MAX_BUF_SIZE times in a
* row, assume that the input source we were using is gone and
* die gracefully. We could check if errno is set to EIO
* ("Input/output error") and die gracefully in that case, but
* it's not always set properly. Argh. */
if
(
errcount
==
MAX_BUF_SIZE
)
handle_hupterm
(
0
);
if
(
input
==
ERR
&&
nodelay_mode
)
return
;
while
(
input
==
ERR
)
{
/* If we've failed to get a character MAX_BUF_SIZE times in a row,
* assume our input source is gone and die gracefully. We could
* check if errno is set to EIO ("Input/output error") and die in
* that case, but it's not always set properly. Argh. */
if
(
++
errcount
==
MAX_BUF_SIZE
)
handle_hupterm
(
0
);
#ifndef NANO_TINY
/* Did we get a SIGWINCH since we were last here? */
if
(
sigwinch_counter
!=
sigwinch_counter_save
)
{
sigwinch_counter_save
=
sigwinch_counter
;
regenerate_screen
();
input
=
KEY_WINCH
;
break
;
}
#endif
input
=
wgetch
(
win
);
}
/* Increment the length of the keystroke buffer, and save the value
...
...
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