Skip to content
GitLab
Menu
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
e55227f6
Commit
e55227f6
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: unabbreviate two variable names
parent
b77b54bf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/nano.c
+19
-16
src/nano.c
src/prompt.c
+26
-26
src/prompt.c
with
45 additions
and
42 deletions
+45
-42
src/nano.c
View file @
e55227f6
...
...
@@ -1630,7 +1630,7 @@ int do_input(bool allow_funcs)
/* The length of the input buffer. */
bool
retain_cuts
=
FALSE
;
/* Whether to conserve the current contents of the cutbuffer. */
const
sc
*
s
;
const
sc
*
s
hortcut
;
/* Read in a keystroke, and show the cursor while waiting. */
input
=
get_kbinput
(
edit
,
VISIBLE
);
...
...
@@ -1654,11 +1654,11 @@ int do_input(bool allow_funcs)
#endif
/* Check for a shortcut in the main list. */
s
=
get_shortcut
(
&
input
);
s
hortcut
=
get_shortcut
(
&
input
);
/* 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
(
s
==
NULL
)
{
if
(
s
hortcut
==
NULL
)
{
if
(
is_ascii_cntrl_char
(
input
)
||
meta_key
||
!
is_byte
(
input
))
{
unbound_key
(
input
);
input
=
ERR
;
...
...
@@ -1671,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
&&
s
==
NULL
)
{
if
(
input
!=
ERR
&&
s
hortcut
==
NULL
)
{
if
(
ISSET
(
VIEW_MODE
))
print_view_warning
();
else
{
...
...
@@ -1691,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
(
s
||
get_key_buffer_len
()
==
0
)
{
if
(
s
hortcut
||
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. */
...
...
@@ -1705,10 +1705,10 @@ int do_input(bool allow_funcs)
}
}
if
(
s
==
NULL
)
if
(
s
hortcut
==
NULL
)
pletion_line
=
NULL
;
else
{
const
subnfunc
*
f
=
sctofunc
(
s
);
const
subnfunc
*
f
=
sctofunc
(
s
hortcut
);
if
(
ISSET
(
VIEW_MODE
)
&&
f
&&
!
f
->
viewok
)
{
print_view_warning
();
...
...
@@ -1717,21 +1717,22 @@ int do_input(bool allow_funcs)
/* If the function associated with this shortcut is
* cutting or copying text, remember this. */
if
(
s
->
scfunc
==
do_cut_text_void
if
(
s
hortcut
->
scfunc
==
do_cut_text_void
#ifndef NANO_TINY
||
s
->
scfunc
==
do_copy_text
||
s
->
scfunc
==
do_cut_till_eof
||
shortcut
->
scfunc
==
do_copy_text
||
shortcut
->
scfunc
==
do_cut_till_eof
#endif
)
retain_cuts
=
TRUE
;
#ifdef ENABLE_WORDCOMPLETION
if
(
s
->
scfunc
!=
complete_a_word
)
if
(
s
hortcut
->
scfunc
!=
complete_a_word
)
pletion_line
=
NULL
;
#endif
#ifndef NANO_TINY
if
(
s
->
scfunc
==
do_toggle_void
)
{
do_toggle
(
s
->
toggle
);
if
(
s
->
toggle
!=
CUT_FROM_CURSOR
)
if
(
s
hortcut
->
scfunc
==
do_toggle_void
)
{
do_toggle
(
s
hortcut
->
toggle
);
if
(
s
hortcut
->
toggle
!=
CUT_FROM_CURSOR
)
retain_cuts
=
TRUE
;
}
else
#endif
...
...
@@ -1751,7 +1752,7 @@ int do_input(bool allow_funcs)
}
#endif
/* Execute the function of the shortcut. */
execute
(
s
);
execute
(
s
hortcut
);
#ifndef NANO_TINY
/* When the marked region changes without Shift being held,
...
...
@@ -1770,14 +1771,16 @@ int do_input(bool allow_funcs)
/* If the cursor moved to another line and this was not caused
* by adding characters to the buffer, clear the prepend flag. */
if
(
openfile
->
current
->
next
!=
was_next
&&
s
->
scfunc
!=
do_tab
&&
s
->
scfunc
!=
do_verbatim_input
)
shortcut
->
scfunc
!=
do_tab
&&
shortcut
->
scfunc
!=
do_verbatim_input
)
wrap_reset
();
#endif
#ifdef ENABLE_COLOR
if
(
f
&&
!
f
->
viewok
&&
!
refresh_needed
)
check_the_multis
(
openfile
->
current
);
#endif
if
(
!
refresh_needed
&&
(
s
->
scfunc
==
do_delete
||
s
->
scfunc
==
do_backspace
))
if
(
!
refresh_needed
&&
(
shortcut
->
scfunc
==
do_delete
||
shortcut
->
scfunc
==
do_backspace
))
update_line
(
openfile
->
current
,
openfile
->
current_x
);
}
}
...
...
This diff is collapsed.
Click to expand it.
src/prompt.c
View file @
e55227f6
...
...
@@ -64,7 +64,7 @@ int do_statusbar_input(bool *ran_func, bool *finished)
/* The input buffer. */
static
size_t
kbinput_len
=
0
;
/* The length of the input buffer. */
const
sc
*
s
;
const
sc
*
s
hortcut
;
const
subnfunc
*
f
;
*
ran_func
=
FALSE
;
...
...
@@ -90,11 +90,11 @@ int do_statusbar_input(bool *ran_func, bool *finished)
#endif
/* Check for a shortcut in the current list. */
s
=
get_shortcut
(
&
input
);
s
hortcut
=
get_shortcut
(
&
input
);
/* 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
(
s
==
NULL
)
{
if
(
s
hortcut
==
NULL
)
{
if
(
is_ascii_cntrl_char
(
input
)
||
meta_key
||
!
is_byte
(
input
))
{
beep
();
input
=
ERR
;
...
...
@@ -103,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
&&
s
==
NULL
)
{
if
(
input
!=
ERR
&&
s
hortcut
==
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
||
...
...
@@ -117,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
((
s
||
get_key_buffer_len
()
==
0
)
&&
kbinput
!=
NULL
)
{
if
((
s
hortcut
||
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
);
...
...
@@ -128,42 +128,42 @@ int do_statusbar_input(bool *ran_func, bool *finished)
kbinput
=
NULL
;
}
if
(
s
)
{
if
(
s
->
scfunc
==
do_tab
||
s
->
scfunc
==
do_enter
)
if
(
s
hortcut
)
{
if
(
s
hortcut
->
scfunc
==
do_tab
||
s
hortcut
->
scfunc
==
do_enter
)
;
else
if
(
s
->
scfunc
==
do_left
)
else
if
(
s
hortcut
->
scfunc
==
do_left
)
do_statusbar_left
();
else
if
(
s
->
scfunc
==
do_right
)
else
if
(
s
hortcut
->
scfunc
==
do_right
)
do_statusbar_right
();
#ifndef NANO_TINY
else
if
(
s
->
scfunc
==
do_prev_word_void
)
else
if
(
s
hortcut
->
scfunc
==
do_prev_word_void
)
do_statusbar_prev_word
();
else
if
(
s
->
scfunc
==
do_next_word_void
)
else
if
(
s
hortcut
->
scfunc
==
do_next_word_void
)
do_statusbar_next_word
();
#endif
else
if
(
s
->
scfunc
==
do_home
)
else
if
(
s
hortcut
->
scfunc
==
do_home
)
do_statusbar_home
();
else
if
(
s
->
scfunc
==
do_end
)
else
if
(
s
hortcut
->
scfunc
==
do_end
)
do_statusbar_end
();
/* When in restricted mode at the "Write File" prompt and the
* filename isn't blank, disallow any input and deletion. */
else
if
(
ISSET
(
RESTRICTED
)
&&
currmenu
==
MWRITEFILE
&&
openfile
->
filename
[
0
]
!=
'\0'
&&
(
s
->
scfunc
==
do_verbatim_input
||
s
->
scfunc
==
do_cut_text_void
||
s
->
scfunc
==
do_uncut_text
||
s
->
scfunc
==
do_delete
||
s
->
scfunc
==
do_backspace
))
(
s
hortcut
->
scfunc
==
do_verbatim_input
||
s
hortcut
->
scfunc
==
do_cut_text_void
||
s
hortcut
->
scfunc
==
do_uncut_text
||
s
hortcut
->
scfunc
==
do_delete
||
s
hortcut
->
scfunc
==
do_backspace
))
;
else
if
(
s
->
scfunc
==
do_verbatim_input
)
else
if
(
s
hortcut
->
scfunc
==
do_verbatim_input
)
do_statusbar_verbatim_input
();
else
if
(
s
->
scfunc
==
do_cut_text_void
)
else
if
(
s
hortcut
->
scfunc
==
do_cut_text_void
)
do_statusbar_cut_text
();
else
if
(
s
->
scfunc
==
do_delete
)
else
if
(
s
hortcut
->
scfunc
==
do_delete
)
do_statusbar_delete
();
else
if
(
s
->
scfunc
==
do_backspace
)
else
if
(
s
hortcut
->
scfunc
==
do_backspace
)
do_statusbar_backspace
();
else
if
(
s
->
scfunc
==
do_uncut_text
)
{
else
if
(
s
hortcut
->
scfunc
==
do_uncut_text
)
{
if
(
cutbuffer
!=
NULL
)
do_statusbar_uncut_text
();
}
else
{
...
...
@@ -171,12 +171,12 @@ int do_statusbar_input(bool *ran_func, bool *finished)
* ran_func to TRUE if we try to run their associated functions,
* and setting finished to TRUE to indicatethat we're done after
* running or trying to run their associated functions. */
f
=
sctofunc
(
s
);
if
(
s
->
scfunc
!=
NULL
)
{
f
=
sctofunc
(
s
hortcut
);
if
(
s
hortcut
->
scfunc
!=
NULL
)
{
*
ran_func
=
TRUE
;
if
(
f
&&
(
!
ISSET
(
VIEW_MODE
)
||
f
->
viewok
)
&&
f
->
scfunc
!=
do_gotolinecolumn_void
)
execute
(
s
);
execute
(
s
hortcut
);
}
*
finished
=
TRUE
;
}
...
...
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