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
9c3a149b
Commit
9c3a149b
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: transform the token DISABLE_MULTIBUFFER to ENABLE_MULTIBUFFER
parent
a9c4682c
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
configure.ac
+9
-5
configure.ac
src/files.c
+11
-11
src/files.c
src/global.c
+11
-11
src/global.c
src/nano.c
+11
-11
src/nano.c
src/proto.h
+1
-1
src/proto.h
src/rcfile.c
+1
-1
src/rcfile.c
with
44 additions
and
40 deletions
+44
-40
configure.ac
View file @
9c3a149b
...
...
@@ -166,8 +166,15 @@ fi
AC_ARG_ENABLE(multibuffer,
AS_HELP_STRING([--disable-multibuffer], [Disable multiple file buffers]))
if test "x$enable_multibuffer" = xno; then
AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.])
if test "x$enable_tiny" = xyes; then
if test "x$enable_multibuffer" != xyes; then
enable_multibuffer=no
fi
fi
if test "x$disable_multibuffer" != xyes; then
if test "x$enable_multibuffer" != xno; then
AC_DEFINE(ENABLE_MULTIBUFFER, 1, [Define this to enable multiple file buffers.])
fi
fi
AC_ARG_ENABLE(nanorc,
...
...
@@ -261,9 +268,6 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_mouse" != xyes; then
AC_DEFINE(DISABLE_MOUSE, 1, [Define this to disable mouse support.])
fi
if test "x$enable_multibuffer" != xyes; then
AC_DEFINE(DISABLE_MULTIBUFFER, 1, [Define this to disable multiple file buffers.])
fi
if test "x$enable_nanorc" != xyes; then
AC_DEFINE(DISABLE_NANORC, 1, [Define this to disable the use of .nanorc files.])
fi
...
...
This diff is collapsed.
Click to expand it.
src/files.c
View file @
9c3a149b
...
...
@@ -470,7 +470,7 @@ bool open_buffer(const char *filename, bool undoable)
if
(
ISSET
(
LOCKING
)
&&
filename
[
0
]
!=
'\0'
)
{
/* When not overriding an existing lock, discard the buffer. */
if
(
do_lockfile
(
realname
)
<
0
)
{
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
close_buffer
();
#endif
free
(
realname
);
...
...
@@ -600,7 +600,7 @@ void prepare_for_display(void)
refresh_needed
=
TRUE
;
}
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
/* Switch to a neighbouring file buffer; to the next if to_next is TRUE;
* otherwise, to the previous one. */
void
switch_to_prevnext_buffer
(
bool
to_next
)
...
...
@@ -683,7 +683,7 @@ bool close_buffer(void)
return
TRUE
;
}
#endif
/*
!DIS
ABLE_MULTIBUFFER */
#endif
/*
EN
ABLE_MULTIBUFFER */
/* Do a quick permissions check by verifying whether the file is appendable.
* Err on the side of permissiveness (reporting TRUE when it might be wrong)
...
...
@@ -1064,7 +1064,7 @@ void do_insertfile(void)
while
(
TRUE
)
{
#ifndef NANO_TINY
if
(
execute
)
{
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
if
(
ISSET
(
MULTIBUFFER
))
/* TRANSLATORS: The next four messages are prompts. */
msg
=
_
(
"Command to execute in new buffer"
);
...
...
@@ -1074,7 +1074,7 @@ void do_insertfile(void)
}
else
#endif
/* NANO_TINY */
{
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
if
(
ISSET
(
MULTIBUFFER
))
msg
=
_
(
"File to insert into new buffer [from %s]"
);
else
...
...
@@ -1112,7 +1112,7 @@ void do_insertfile(void)
given
=
mallocstrcpy
(
given
,
answer
);
#ifndef NANO_TINY
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
if
(
func
==
new_buffer_void
)
{
/* Don't allow toggling when in view mode. */
if
(
!
ISSET
(
VIEW_MODE
))
...
...
@@ -1147,7 +1147,7 @@ void do_insertfile(void)
#ifndef NANO_TINY
if
(
execute
)
{
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
/* When in multibuffer mode, first open a blank buffer. */
if
(
ISSET
(
MULTIBUFFER
))
open_buffer
(
""
,
FALSE
);
...
...
@@ -1155,7 +1155,7 @@ void do_insertfile(void)
/* Save the command's output in the current buffer. */
execute_command
(
answer
);
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
/* If this is a new buffer, put the cursor at the top. */
if
(
ISSET
(
MULTIBUFFER
))
{
openfile
->
current
=
openfile
->
fileage
;
...
...
@@ -1176,7 +1176,7 @@ void do_insertfile(void)
open_buffer
(
answer
,
TRUE
);
}
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
if
(
ISSET
(
MULTIBUFFER
))
{
#ifndef DISABLE_HISTORIES
if
(
ISSET
(
POS_HISTORY
))
{
...
...
@@ -1191,7 +1191,7 @@ void do_insertfile(void)
/* Update stuff to account for the current buffer. */
prepare_for_display
();
}
else
#endif
/*
!DIS
ABLE_MULTIBUFFER */
#endif
/*
EN
ABLE_MULTIBUFFER */
{
/* Mark the file as modified if it changed. */
if
(
openfile
->
current
->
lineno
!=
was_current_lineno
||
...
...
@@ -1216,7 +1216,7 @@ void do_insertfile_void(void)
{
if
(
ISSET
(
RESTRICTED
))
show_restricted_warning
();
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
else
if
(
ISSET
(
VIEW_MODE
)
&&
!
ISSET
(
MULTIBUFFER
))
statusbar
(
_
(
"Key invalid in non-multibuffer mode"
));
#endif
...
...
This diff is collapsed.
Click to expand it.
src/global.c
View file @
9c3a149b
...
...
@@ -494,7 +494,7 @@ void shortcut_init(void)
const
char
*
nano_cancel_msg
=
N_
(
"Cancel the current function"
);
const
char
*
nano_help_msg
=
N_
(
"Display this help text"
);
const
char
*
nano_exit_msg
=
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
N_
(
"Close the current file buffer / Exit from nano"
)
#else
N_
(
"Exit from nano"
)
...
...
@@ -563,7 +563,7 @@ void shortcut_init(void)
const
char
*
nano_scrolldown_msg
=
N_
(
"Scroll down one line without scrolling the cursor"
);
#endif
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
const
char
*
nano_prevfile_msg
=
N_
(
"Switch to the previous file buffer"
);
const
char
*
nano_nextfile_msg
=
N_
(
"Switch to the next file buffer"
);
#endif
...
...
@@ -626,7 +626,7 @@ void shortcut_init(void)
const
char
*
nano_prepend_msg
=
N_
(
"Toggle prepending"
);
const
char
*
nano_backup_msg
=
N_
(
"Toggle backing up of the original file"
);
const
char
*
nano_execute_msg
=
N_
(
"Execute external command"
);
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
const
char
*
nano_newbuffer_msg
=
N_
(
"Toggle the use of a new buffer"
);
#endif
#endif
...
...
@@ -688,7 +688,7 @@ void shortcut_init(void)
read_file_tag
,
IFSCHELP
(
nano_insert_msg
),
BLANKAFTER
,
/* We allow inserting files in view mode if multibuffer mode
* is switched on, so that we can view multiple files. */
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
VIEW
);
#else
NOVIEW
);
...
...
@@ -866,7 +866,7 @@ void shortcut_init(void)
add_to_funcs
(
do_last_line
,
MMAIN
|
MHELP
|
MWHEREIS
|
MREPLACE
|
MREPLACEWITH
|
MGOTOLINE
,
N_
(
"Last Line"
),
IFSCHELP
(
nano_lastline_msg
),
BLANKAFTER
,
VIEW
);
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
add_to_funcs
(
switch_to_prev_buffer_void
,
MMAIN
,
N_
(
"Prev File"
),
IFSCHELP
(
nano_prevfile_msg
),
TOGETHER
,
VIEW
);
add_to_funcs
(
switch_to_next_buffer_void
,
MMAIN
,
...
...
@@ -995,7 +995,7 @@ void shortcut_init(void)
add_to_funcs
(
flip_execute_void
,
MEXTCMD
,
read_file_tag
,
IFSCHELP
(
nano_insert_msg
),
TOGETHER
,
NOVIEW
);
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
add_to_funcs
(
new_buffer_void
,
MINSERTFILE
|
MEXTCMD
,
N_
(
"New Buffer"
),
IFSCHELP
(
nano_newbuffer_msg
),
TOGETHER
,
NOVIEW
);
#endif
...
...
@@ -1170,7 +1170,7 @@ void shortcut_init(void)
add_to_sclist
(
MMAIN
,
"M-+"
,
0
,
do_scroll_down
,
0
);
add_to_sclist
(
MMAIN
,
"M-="
,
0
,
do_scroll_down
,
0
);
#endif
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
add_to_sclist
(
MMAIN
,
"M-<"
,
0
,
switch_to_prev_buffer_void
,
0
);
add_to_sclist
(
MMAIN
,
"M-,"
,
0
,
switch_to_prev_buffer_void
,
0
);
add_to_sclist
(
MMAIN
,
"M->"
,
0
,
switch_to_next_buffer_void
,
0
);
...
...
@@ -1213,7 +1213,7 @@ void shortcut_init(void)
/* Group of "Peripheral-feature" toggles. */
add_to_sclist
(
MMAIN
,
"M-B"
,
0
,
do_toggle_void
,
BACKUP_FILE
);
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
add_to_sclist
(
MMAIN
,
"M-F"
,
0
,
do_toggle_void
,
MULTIBUFFER
);
#endif
#ifndef DISABLE_MOUSE
...
...
@@ -1541,7 +1541,7 @@ sc *strtosc(const char *input)
s
->
scfunc
=
do_first_line
;
else
if
(
!
strcasecmp
(
input
,
"lastline"
))
s
->
scfunc
=
do_last_line
;
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
else
if
(
!
strcasecmp
(
input
,
"prevbuf"
))
s
->
scfunc
=
switch_to_prev_buffer_void
;
else
if
(
!
strcasecmp
(
input
,
"nextbuf"
))
...
...
@@ -1593,7 +1593,7 @@ sc *strtosc(const char *input)
else
if
(
!
strcasecmp
(
input
,
"flipexecute"
))
s
->
scfunc
=
flip_execute_void
;
#endif
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
else
if
(
!
strcasecmp
(
input
,
"flipnewbuffer"
)
||
!
strcasecmp
(
input
,
"newbuffer"
))
/* Deprecated. Remove in 2018. */
s
->
scfunc
=
new_buffer_void
;
...
...
@@ -1642,7 +1642,7 @@ sc *strtosc(const char *input)
s
->
toggle
=
TABS_TO_SPACES
;
else
if
(
!
strcasecmp
(
input
,
"backupfile"
))
s
->
toggle
=
BACKUP_FILE
;
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
else
if
(
!
strcasecmp
(
input
,
"multibuffer"
))
s
->
toggle
=
MULTIBUFFER
;
#endif
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
9c3a149b
...
...
@@ -606,7 +606,7 @@ void die(const char *msg, ...)
die_save_file
(
openfile
->
filename
,
openfile
->
current_stat
);
}
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
/* Save all of the other modified file buffers, if any. */
if
(
openfile
!=
NULL
)
{
openfilestruct
*
firstone
=
openfile
;
...
...
@@ -794,7 +794,7 @@ void usage(void)
#ifndef NANO_TINY
print_opt
(
"-E"
,
"--tabstospaces"
,
N_
(
"Convert typed tabs to spaces"
));
#endif
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
if
(
!
ISSET
(
RESTRICTED
))
print_opt
(
"-F"
,
"--multibuffer"
,
N_
(
"Read a file into a new buffer by default"
));
...
...
@@ -949,7 +949,7 @@ void version(void)
#ifndef DISABLE_NANORC
printf
(
" --enable-nanorc"
);
#endif
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
printf
(
" --enable-multibuffer"
);
#endif
#ifndef DISABLE_OPERATINGDIR
...
...
@@ -995,7 +995,7 @@ void version(void)
#ifdef DISABLE_MOUSE
printf
(
" --disable-mouse"
);
#endif
#ifdef
DIS
ABLE_MULTIBUFFER
#if
n
def
EN
ABLE_MULTIBUFFER
printf
(
" --disable-multibuffer"
);
#endif
#ifdef DISABLE_NANORC
...
...
@@ -1087,7 +1087,7 @@ void close_and_go(void)
if
(
ISSET
(
LOCKING
)
&&
openfile
->
lock_filename
)
delete_lockfile
(
openfile
->
lock_filename
);
#endif
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
/* If there are no more open file buffers, jump off a cliff. */
if
(
!
close_buffer
())
#endif
...
...
@@ -1911,14 +1911,14 @@ int main(int argc, char **argv)
/* Should long lines be automatically hard wrapped? */
#endif
#endif
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
bool
old_multibuffer
;
/* The old value of the multibuffer option, restored after we
* load all files on the command line. */
#endif
const
struct
option
long_options
[]
=
{
{
"boldtext"
,
0
,
NULL
,
'D'
},
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
{
"multibuffer"
,
0
,
NULL
,
'F'
},
#endif
#ifndef DISABLE_NANORC
...
...
@@ -2059,7 +2059,7 @@ int main(int argc, char **argv)
SET
(
TABS_TO_SPACES
);
break
;
#endif
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
case
'F'
:
SET
(
MULTIBUFFER
);
break
;
...
...
@@ -2553,7 +2553,7 @@ int main(int argc, char **argv)
optind
++
;
}
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
old_multibuffer
=
ISSET
(
MULTIBUFFER
);
SET
(
MULTIBUFFER
);
...
...
@@ -2592,7 +2592,7 @@ int main(int argc, char **argv)
}
}
}
#endif
/*
!DIS
ABLE_MULTIBUFFER */
#endif
/*
EN
ABLE_MULTIBUFFER */
/* Now read the first file on the command line into a new buffer. */
if
(
optind
<
argc
)
...
...
@@ -2606,7 +2606,7 @@ int main(int argc, char **argv)
UNSET
(
VIEW_MODE
);
}
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
if
(
!
old_multibuffer
)
UNSET
(
MULTIBUFFER
);
#endif
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
9c3a149b
...
...
@@ -268,7 +268,7 @@ void replace_marked_buffer(const char *filename, filestruct *top, size_t top_x,
#endif
#endif
void
prepare_for_display
(
void
);
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
void
switch_to_prev_buffer_void
(
void
);
void
switch_to_next_buffer_void
(
void
);
bool
close_buffer
(
void
);
...
...
This diff is collapsed.
Click to expand it.
src/rcfile.c
View file @
9c3a149b
...
...
@@ -56,7 +56,7 @@ static const rcoption rcopts[] = {
#ifndef DISABLE_MOUSE
{
"mouse"
,
USE_MOUSE
},
#endif
#if
n
def
DIS
ABLE_MULTIBUFFER
#ifdef
EN
ABLE_MULTIBUFFER
{
"multibuffer"
,
MULTIBUFFER
},
#endif
{
"nohelp"
,
NO_HELP
},
...
...
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