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
b7f8d481
Commit
b7f8d481
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: frob some comments plus miscellaneous other stuff
parent
30fc197b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
src/files.c
+2
-2
src/files.c
src/global.c
+7
-5
src/global.c
src/nano.c
+2
-3
src/nano.c
src/prompt.c
+7
-9
src/prompt.c
with
18 additions
and
19 deletions
+18
-19
src/files.c
View file @
b7f8d481
...
...
@@ -2420,8 +2420,8 @@ char **username_tab_completion(const char *buf, size_t *num_matches,
/* We consider the first buf_len characters of buf for filename tab
* completion. */
char
**
cwd_tab_completion
(
const
char
*
buf
,
bool
allow_files
,
size_t
*
num_matches
,
size_t
buf_len
)
char
**
cwd_tab_completion
(
const
char
*
buf
,
bool
allow_files
,
size_t
*
num_matches
,
size_t
buf_len
)
{
char
*
dirname
=
mallocstrcpy
(
NULL
,
buf
);
char
*
slash
,
*
filename
;
...
...
This diff is collapsed.
Click to expand it.
src/global.c
View file @
b7f8d481
...
...
@@ -1013,8 +1013,7 @@ void shortcut_init(void)
N_
(
"Backup File"
),
WITHORSANS
(
backup_gist
),
BLANKAFTER
,
NOVIEW
);
}
/* If we're using restricted mode, file insertion is disabled, and
* thus command execution and the multibuffer toggle have no place. */
/* Command execution is only available when not in restricted mode. */
if
(
!
ISSET
(
RESTRICTED
))
{
add_to_funcs
(
flip_execute
,
MINSERTFILE
,
N_
(
"Execute Command"
),
WITHORSANS
(
execute_gist
),
TOGETHER
,
NOVIEW
);
...
...
@@ -1024,12 +1023,14 @@ void shortcut_init(void)
}
#endif
/* !NANO_TINY */
#ifdef ENABLE_MULTIBUFFER
/* Multiple buffers are only available when not in restricted mode. */
if
(
!
ISSET
(
RESTRICTED
))
add_to_funcs
(
flip_newbuffer
,
MINSERTFILE
|
MEXTCMD
,
N_
(
"New Buffer"
),
WITHORSANS
(
newbuffer_gist
),
TOGETHER
,
NOVIEW
);
#endif
#ifdef ENABLE_BROWSER
/* The file browser is only available when not in restricted mode. */
if
(
!
ISSET
(
RESTRICTED
))
add_to_funcs
(
to_files_void
,
MWRITEFILE
|
MINSERTFILE
,
N_
(
"To Files"
),
WITHORSANS
(
tofiles_gist
),
TOGETHER
,
VIEW
);
...
...
@@ -1311,8 +1312,8 @@ void shortcut_init(void)
#ifndef NANO_TINY
add_to_sclist
(
MWRITEFILE
,
"M-D"
,
0
,
dos_format_void
,
0
);
add_to_sclist
(
MWRITEFILE
,
"M-M"
,
0
,
mac_format_void
,
0
);
/*
I
n restricted mode,
don't
allow Appending, Prepending,
nor making
* backups,
nor
executing a command
, nor opening a new buffer
. */
/*
Only when not i
n restricted mode, allow Appending, Prepending,
*
making
backups,
and
executing a command. */
if
(
!
ISSET
(
RESTRICTED
))
{
add_to_sclist
(
MWRITEFILE
,
"M-A"
,
0
,
append_void
,
0
);
add_to_sclist
(
MWRITEFILE
,
"M-P"
,
0
,
prepend_void
,
0
);
...
...
@@ -1321,11 +1322,12 @@ void shortcut_init(void)
}
#endif
#ifdef ENABLE_MULTIBUFFER
/* Only when not in restricted mode, allow multiple buffers. */
if
(
!
ISSET
(
RESTRICTED
))
add_to_sclist
(
MINSERTFILE
|
MEXTCMD
,
"M-F"
,
0
,
flip_newbuffer
,
0
);
#endif
#ifdef ENABLE_BROWSER
/*
I
n restricted mode,
don't
allow entering the file browser. */
/*
Only when not i
n restricted mode, allow entering the file browser. */
if
(
!
ISSET
(
RESTRICTED
))
add_to_sclist
(
MWRITEFILE
|
MINSERTFILE
,
"^T"
,
0
,
to_files_void
,
0
);
#endif
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
b7f8d481
...
...
@@ -69,8 +69,7 @@ static struct sigaction act;
static
bool
input_was_aborted
=
FALSE
;
/* Whether reading from standard input was aborted via ^C. */
/* Create a new linestruct node. Note that we do not set prevnode->next
* to the new line. */
/* Create a new linestruct node. Note that we do not set prevnode->next. */
filestruct
*
make_new_node
(
filestruct
*
prevnode
)
{
filestruct
*
newnode
=
nmalloc
(
sizeof
(
filestruct
));
...
...
@@ -1647,7 +1646,7 @@ bool okay_for_view(const sc *shortcut)
{
const
subnfunc
*
func
=
sctofunc
(
shortcut
);
return
(
func
&&
func
->
viewok
);
return
(
func
!=
NULL
&&
func
->
viewok
);
}
/* Read in a keystroke. Act on the keystroke if it is a shortcut or a toggle;
...
...
This diff is collapsed.
Click to expand it.
src/prompt.c
View file @
b7f8d481
...
...
@@ -187,27 +187,25 @@ void do_statusbar_output(int *the_input, size_t input_len,
{
char
*
output
=
charalloc
(
input_len
+
1
);
char
onechar
[
MAXCHARLEN
];
size_t
char_len
,
i
;
size_t
char_len
,
i
,
j
=
0
;
/* Copy the typed stuff so it can be treated. */
for
(
i
=
0
;
i
<
input_len
;
i
++
)
output
[
i
]
=
(
char
)
the_input
[
i
];
output
[
i
]
=
'\0'
;
i
=
0
;
while
(
i
<
input_len
)
{
while
(
j
<
input_len
)
{
/* Encode any NUL byte as 0x0A. */
if
(
output
[
i
]
==
'\0'
)
output
[
i
]
=
'\n'
;
if
(
output
[
j
]
==
'\0'
)
output
[
j
]
=
'\n'
;
/* Interpret the next multibyte character. */
char_len
=
parse_mbchar
(
output
+
i
,
onechar
,
NULL
);
char_len
=
parse_mbchar
(
output
+
j
,
onechar
,
NULL
);
i
+=
char_len
;
j
+=
char_len
;
/* When filtering, skip any ASCII control character. */
if
(
filtering
&&
is_ascii_cntrl_char
(
*
(
output
+
i
-
char_len
)))
if
(
filtering
&&
is_ascii_cntrl_char
(
*
(
output
+
j
-
char_len
)))
continue
;
/* Insert the typed character into the existing answer string. */
...
...
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