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
b77b54bf
Commit
b77b54bf
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: elide two unneeded booleans
parent
2428620b
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/nano.c
+4
-9
src/nano.c
src/prompt.c
+4
-9
src/prompt.c
with
8 additions
and
18 deletions
+8
-18
src/nano.c
View file @
b77b54bf
...
...
@@ -1631,7 +1631,6 @@ int do_input(bool allow_funcs)
bool
retain_cuts
=
FALSE
;
/* Whether to conserve the current contents of the cutbuffer. */
const
sc
*
s
;
bool
have_shortcut
;
/* Read in a keystroke, and show the cursor while waiting. */
input
=
get_kbinput
(
edit
,
VISIBLE
);
...
...
@@ -1657,13 +1656,9 @@ int do_input(bool allow_funcs)
/* Check for a shortcut in the main list. */
s
=
get_shortcut
(
&
input
);
/* If we got a shortcut from the main list, or a "universal"
* edit window shortcut, set have_shortcut to TRUE. */
have_shortcut
=
(
s
!=
NULL
);
/* If we got a non-high-bit control key, a meta key sequence, or a
* function key, and it's not a shortcut or toggle, throw it out. */
if
(
!
have_shortcut
)
{
if
(
s
==
NULL
)
{
if
(
is_ascii_cntrl_char
(
input
)
||
meta_key
||
!
is_byte
(
input
))
{
unbound_key
(
input
);
input
=
ERR
;
...
...
@@ -1676,7 +1671,7 @@ int do_input(bool allow_funcs)
/* If the keystroke isn't a shortcut nor a toggle, it's a normal text
* character: add the character to the input buffer -- or display a
* warning when we're in view mode. */
if
(
input
!=
ERR
&&
!
have_shortcut
)
{
if
(
input
!=
ERR
&&
s
==
NULL
)
{
if
(
ISSET
(
VIEW_MODE
))
print_view_warning
();
else
{
...
...
@@ -1696,7 +1691,7 @@ int do_input(bool allow_funcs)
* characters waiting after the one we read in, we need to output
* all available characters in the input puddle. Note that this
* puddle will be empty if we're in view mode. */
if
(
have_shortcut
||
get_key_buffer_len
()
==
0
)
{
if
(
s
||
get_key_buffer_len
()
==
0
)
{
if
(
puddle
!=
NULL
)
{
/* Insert all bytes in the input buffer into the edit buffer
* at once, filtering out any low control codes. */
...
...
@@ -1710,7 +1705,7 @@ int do_input(bool allow_funcs)
}
}
if
(
!
have_shortcut
)
if
(
s
==
NULL
)
pletion_line
=
NULL
;
else
{
const
subnfunc
*
f
=
sctofunc
(
s
);
...
...
This diff is collapsed.
Click to expand it.
src/prompt.c
View file @
b77b54bf
...
...
@@ -65,7 +65,6 @@ int do_statusbar_input(bool *ran_func, bool *finished)
static
size_t
kbinput_len
=
0
;
/* The length of the input buffer. */
const
sc
*
s
;
bool
have_shortcut
=
FALSE
;
const
subnfunc
*
f
;
*
ran_func
=
FALSE
;
...
...
@@ -93,13 +92,9 @@ int do_statusbar_input(bool *ran_func, bool *finished)
/* Check for a shortcut in the current list. */
s
=
get_shortcut
(
&
input
);
/* If we got a shortcut from the current list, or a "universal"
* statusbar prompt shortcut, set have_shortcut to TRUE. */
have_shortcut
=
(
s
!=
NULL
);
/* If we got a non-high-bit control key, a meta key sequence, or a
* function key, and it's not a shortcut or toggle, throw it out. */
if
(
!
have_shortcut
)
{
if
(
s
==
NULL
)
{
if
(
is_ascii_cntrl_char
(
input
)
||
meta_key
||
!
is_byte
(
input
))
{
beep
();
input
=
ERR
;
...
...
@@ -108,7 +103,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
/* If the keystroke isn't a shortcut nor a toggle, it's a normal text
* character: add the it to the input buffer, when allowed. */
if
(
input
!=
ERR
&&
!
have_shortcut
)
{
if
(
input
!=
ERR
&&
s
==
NULL
)
{
/* Only accept input when not in restricted mode, or when not at
* the "Write File" prompt, or when there is no filename yet. */
if
(
!
ISSET
(
RESTRICTED
)
||
currmenu
!=
MWRITEFILE
||
...
...
@@ -122,7 +117,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
/* If we got a shortcut, or if there aren't any other keystrokes waiting
* after the one we read in, we need to insert all the characters in the
* input buffer (if not empty) into the answer. */
if
((
have_shortcut
||
get_key_buffer_len
()
==
0
)
&&
kbinput
!=
NULL
)
{
if
((
s
||
get_key_buffer_len
()
==
0
)
&&
kbinput
!=
NULL
)
{
/* Inject all characters in the input buffer at once, filtering out
* control characters. */
do_statusbar_output
(
kbinput
,
kbinput_len
,
TRUE
);
...
...
@@ -133,7 +128,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
kbinput
=
NULL
;
}
if
(
have_shortcut
)
{
if
(
s
)
{
if
(
s
->
scfunc
==
do_tab
||
s
->
scfunc
==
do_enter
)
;
else
if
(
s
->
scfunc
==
do_left
)
...
...
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