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
7b7d2bf7
Commit
7b7d2bf7
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: make tiny nano a teeny bit smaller
parent
244de605
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/global.c
+7
-2
src/global.c
src/nano.c
+1
-1
src/nano.c
src/nano.h
+2
-0
src/nano.h
src/proto.h
+0
-6
src/proto.h
src/rcfile.c
+4
-0
src/rcfile.c
with
14 additions
and
9 deletions
+14
-9
src/global.c
View file @
7b7d2bf7
...
...
@@ -326,7 +326,9 @@ void add_to_funcs(void (*func)(void), int menus, const char *desc, const char *h
void
add_to_sclist
(
int
menus
,
const
char
*
scstring
,
void
(
*
func
)(
void
),
int
toggle
)
{
static
sc
*
tailsc
;
#ifndef NANO_TINY
static
int
counter
=
0
;
#endif
sc
*
s
=
(
sc
*
)
nmalloc
(
sizeof
(
sc
));
/* Start the list, or tack on the next item. */
...
...
@@ -340,9 +342,11 @@ void add_to_sclist(int menus, const char *scstring, void (*func)(void), int togg
/* Fill in the data. */
s
->
menus
=
menus
;
s
->
scfunc
=
func
;
#ifndef NANO_TINY
s
->
toggle
=
toggle
;
if
(
toggle
)
s
->
ordinal
=
++
counter
;
#endif
assign_keyinfo
(
s
,
scstring
);
#ifdef DEBUG
...
...
@@ -1362,10 +1366,11 @@ const char *flagtostr(int flag)
* shortcut struct with the corresponding function filled in. */
sc
*
strtosc
(
const
char
*
input
)
{
sc
*
s
;
sc
*
s
=
nmalloc
(
sizeof
(
sc
))
;
s
=
(
sc
*
)
nmalloc
(
sizeof
(
sc
));
#ifndef NANO_TINY
s
->
toggle
=
0
;
#endif
#ifndef DISABLE_HELP
if
(
!
strcasecmp
(
input
,
"help"
))
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
7b7d2bf7
...
...
@@ -1434,13 +1434,13 @@ void do_toggle(int flag)
statusline
(
HUSH
,
"%s %s"
,
_
(
flagtostr
(
flag
)),
enabled
?
_
(
"enabled"
)
:
_
(
"disabled"
));
}
#endif
/* !NANO_TINY */
/* Bleh. */
void
do_toggle_void
(
void
)
{
;
}
#endif
/* !NANO_TINY */
/* Disable extended input and output processing in our terminal
* settings. */
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
7b7d2bf7
...
...
@@ -451,11 +451,13 @@ typedef struct sc {
/* Which menus this applies to. */
void
(
*
scfunc
)(
void
);
/* The function we're going to run. */
#ifndef NANO_TINY
int
toggle
;
/* If a toggle, what we're toggling. */
int
ordinal
;
/* The how-manieth toggle this is, in order to be able to
* keep them in sequence. */
#endif
struct
sc
*
next
;
/* Next in the list. */
}
sc
;
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
7b7d2bf7
...
...
@@ -482,13 +482,7 @@ RETSIGTYPE handle_sigwinch(int signal);
void
regenerate_screen
(
void
);
void
allow_sigwinch
(
bool
allow
);
void
do_toggle
(
int
flag
);
#endif
void
do_toggle_void
(
void
);
void
disable_extended_io
(
void
);
#ifdef USE_SLANG
void
disable_signals
(
void
);
#endif
#ifndef NANO_TINY
void
enable_signals
(
void
);
#endif
void
disable_flow_control
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/rcfile.c
View file @
7b7d2bf7
...
...
@@ -455,9 +455,11 @@ void parse_binding(char *ptr, bool dobind)
if
(
f
->
scfunc
==
newsc
->
scfunc
)
mask
=
mask
|
f
->
menus
;
#ifndef NANO_TINY
/* Handle the special case of the toggles. */
if
(
newsc
->
scfunc
==
do_toggle_void
)
mask
=
MMAIN
;
#endif
/* Now limit the given menu to those where the function exists. */
if
(
is_universal
(
newsc
->
scfunc
))
...
...
@@ -497,6 +499,7 @@ void parse_binding(char *ptr, bool dobind)
}
if
(
dobind
)
{
#ifndef NANO_TINY
/* If this is a toggle, copy its sequence number. */
if
(
newsc
->
scfunc
==
do_toggle_void
)
{
for
(
s
=
sclist
;
s
!=
NULL
;
s
=
s
->
next
)
...
...
@@ -504,6 +507,7 @@ void parse_binding(char *ptr, bool dobind)
newsc
->
ordinal
=
s
->
ordinal
;
}
else
newsc
->
ordinal
=
0
;
#endif
/* Add the new shortcut at the start of the list. */
newsc
->
next
=
sclist
;
sclist
=
newsc
;
...
...
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