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
a5974bd1
Commit
a5974bd1
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: transform the token DISABLE_WRAPPING to ENABLE_WRAPPING
parent
87da3ecb
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
configure.ac
+7
-5
configure.ac
src/global.c
+2
-2
src/global.c
src/nano.c
+10
-10
src/nano.c
src/nano.h
+2
-2
src/nano.h
src/proto.h
+1
-1
src/proto.h
src/rcfile.c
+1
-1
src/rcfile.c
src/text.c
+11
-11
src/text.c
with
34 additions
and
32 deletions
+34
-32
configure.ac
View file @
a5974bd1
...
...
@@ -234,8 +234,13 @@ fi
AC_ARG_ENABLE(wrapping,
AS_HELP_STRING([--disable-wrapping], [Disable all hard-wrapping of text]))
if test "x$enable_wrapping" = xno; then
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all hard text wrapping.])
if test "x$enable_tiny" = xyes; then
if test "x$enable_wrapping" != xyes; then
enable_wrapping=no
fi
fi
if test "x$enable_wrapping" != xno; then
AC_DEFINE(ENABLE_WRAPPING, 1, [Define this to have hard text wrapping.])
fi
AC_ARG_ENABLE(wrapping-as-root,
...
...
@@ -279,9 +284,6 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_speller" != xyes; then
AC_DEFINE(DISABLE_SPELLER, 1, [Define this to disable the spell-checker functions.])
fi
if test "x$enable_wrapping" != xyes; then
AC_DEFINE(DISABLE_WRAPPING, 1, [Define this to disable all text wrapping.])
fi
fi
AM_CONDITIONAL(USE_COLOR, test x$color_support = xyes)
...
...
This diff is collapsed.
Click to expand it.
src/global.c
View file @
a5974bd1
...
...
@@ -1252,7 +1252,7 @@ void shortcut_init(void)
add_to_sclist
(
MMAIN
,
"M-H"
,
0
,
do_toggle_void
,
SMART_HOME
);
add_to_sclist
(
MMAIN
,
"M-I"
,
0
,
do_toggle_void
,
AUTOINDENT
);
add_to_sclist
(
MMAIN
,
"M-K"
,
0
,
do_toggle_void
,
CUT_FROM_CURSOR
);
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
add_to_sclist
(
MMAIN
,
"M-L"
,
0
,
do_toggle_void
,
NO_WRAP
);
#endif
add_to_sclist
(
MMAIN
,
"M-Q"
,
0
,
do_toggle_void
,
TABS_TO_SPACES
);
...
...
@@ -1687,7 +1687,7 @@ sc *strtosc(const char *input)
s
->
toggle
=
AUTOINDENT
;
else
if
(
!
strcasecmp
(
input
,
"cuttoend"
))
s
->
toggle
=
CUT_FROM_CURSOR
;
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
else
if
(
!
strcasecmp
(
input
,
"nowrap"
))
s
->
toggle
=
NO_WRAP
;
#endif
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
a5974bd1
...
...
@@ -899,7 +899,7 @@ void usage(void)
print_opt
(
"-u"
,
"--unix"
,
N_
(
"Save a file by default in Unix format"
));
#endif
print_opt
(
"-v"
,
"--view"
,
N_
(
"View mode (read-only)"
));
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
print_opt
(
"-w"
,
"--nowrap"
,
N_
(
"Don't hard-wrap long lines"
));
#endif
print_opt
(
"-x"
,
"--nohelp"
,
N_
(
"Don't show the two help lines"
));
...
...
@@ -969,7 +969,7 @@ void version(void)
#ifdef ENABLE_TABCOMP
printf
(
" --enable-tabcomp"
);
#endif
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
printf
(
" --enable-wrapping"
);
#endif
#else
/* !NANO_TINY */
...
...
@@ -1021,7 +1021,7 @@ void version(void)
#ifndef ENABLE_WORDCOMPLETION
printf
(
" --disable-wordcomp"
);
#endif
#ifdef
DIS
ABLE_WRAPPING
#if
n
def
EN
ABLE_WRAPPING
printf
(
" --disable-wrapping"
);
#endif
#endif
/* !NANO_TINY */
...
...
@@ -1643,7 +1643,7 @@ int do_input(bool allow_funcs)
* 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
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
/* If we got a shortcut or toggle, and it's not the shortcut
* for verbatim input, turn off prepending of wrapped text. */
if
(
have_shortcut
&&
s
->
scfunc
!=
do_verbatim_input
)
...
...
@@ -1861,7 +1861,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
update_undo
(
ADD
);
#endif
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
/* If text gets wrapped, the edit window needs a refresh. */
if
(
!
ISSET
(
NO_WRAP
)
&&
do_wrap
(
openfile
->
current
))
refresh_needed
=
TRUE
;
...
...
@@ -1896,7 +1896,7 @@ int main(int argc, char **argv)
#ifndef DISABLE_WRAPJUSTIFY
bool
fill_used
=
FALSE
;
/* Was the fill option used on the command line? */
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
bool
forced_wrapping
=
FALSE
;
/* Should long lines be automatically hard wrapped? */
#endif
...
...
@@ -1953,7 +1953,7 @@ int main(int argc, char **argv)
#endif
{
"tempfile"
,
0
,
NULL
,
't'
},
{
"view"
,
0
,
NULL
,
'v'
},
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
{
"nowrap"
,
0
,
NULL
,
'w'
},
#endif
{
"nohelp"
,
0
,
NULL
,
'x'
},
...
...
@@ -2178,7 +2178,7 @@ int main(int argc, char **argv)
exit
(
1
);
}
fill_used
=
TRUE
;
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
forced_wrapping
=
TRUE
;
#endif
break
;
...
...
@@ -2199,7 +2199,7 @@ int main(int argc, char **argv)
case
'v'
:
SET
(
VIEW_MODE
);
break
;
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
case
'w'
:
SET
(
NO_WRAP
);
/* If both --fill and --nowrap are given on the
...
...
@@ -2343,7 +2343,7 @@ int main(int argc, char **argv)
#endif
#endif
/* ENABLE_NANORC */
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
/* Override a "set nowrap" in an rcfile (or a --disable-wrapping-as-root)
* if --fill was given on the command line and not undone by --nowrap. */
if
(
forced_wrapping
)
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
a5974bd1
...
...
@@ -128,7 +128,7 @@
#undef ENABLE_MOUSE
#endif
#if defined(
DIS
ABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#if
!
defined(
EN
ABLE_WRAPPING) && defined(DISABLE_JUSTIFY)
#define DISABLE_WRAPJUSTIFY 1
#endif
...
...
@@ -165,7 +165,7 @@ typedef enum {
typedef
enum
{
ADD
,
DEL
,
BACK
,
CUT
,
CUT_TO_EOF
,
REPLACE
,
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
SPLIT_BEGIN
,
SPLIT_END
,
#endif
INDENT
,
UNINDENT
,
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
a5974bd1
...
...
@@ -547,7 +547,7 @@ void add_undo(undo_type action);
void
update_multiline_undo
(
ssize_t
lineno
,
char
*
indentation
);
void
update_undo
(
undo_type
action
);
#endif
/* !NANO_TINY */
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
void
wrap_reset
(
void
);
bool
do_wrap
(
filestruct
*
line
);
#endif
...
...
This diff is collapsed.
Click to expand it.
src/rcfile.c
View file @
a5974bd1
...
...
@@ -60,7 +60,7 @@ static const rcoption rcopts[] = {
{
"nohelp"
,
NO_HELP
},
{
"nonewlines"
,
NO_NEWLINES
},
{
"nopauses"
,
NO_PAUSES
},
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
{
"nowrap"
,
NO_WRAP
},
#endif
#ifndef DISABLE_OPERATINGDIR
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
a5974bd1
...
...
@@ -35,7 +35,7 @@ static pid_t pid = -1;
/* The PID of the forked process in execute_command(), for use
* with the cancel_command() signal handler. */
#endif
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
static
bool
prepend_wrap
=
FALSE
;
/* Should we prepend wrapped text to the next line? */
#endif
...
...
@@ -757,7 +757,7 @@ void do_undo(void)
f
->
data
=
data
;
goto_line_posx
(
u
->
mark_begin_lineno
,
u
->
mark_begin_x
);
break
;
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
case
SPLIT_END
:
goto_line_posx
(
u
->
lineno
,
u
->
begin
);
openfile
->
current_undo
=
openfile
->
current_undo
->
next
;
...
...
@@ -941,7 +941,7 @@ void do_redo(void)
renumber
(
shoveline
);
goto_line_posx
(
u
->
lineno
+
1
,
u
->
mark_begin_x
);
break
;
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
case
SPLIT_BEGIN
:
goto_line_posx
(
u
->
lineno
,
u
->
begin
);
openfile
->
current_undo
=
u
;
...
...
@@ -1244,7 +1244,7 @@ void add_undo(undo_type action)
/* Allocate and initialize a new undo type. */
u
=
(
undo
*
)
nmalloc
(
sizeof
(
undo
));
u
->
type
=
action
;
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
if
(
u
->
type
==
SPLIT_BEGIN
)
{
/* Some action, most likely an ADD, was performed that invoked
* do_wrap(). Rearrange the undo order so that this previous
...
...
@@ -1303,7 +1303,7 @@ void add_undo(undo_type action)
}
action
=
u
->
type
=
JOIN
;
break
;
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
case
SPLIT_BEGIN
:
action
=
openfile
->
undotop
->
type
;
break
;
...
...
@@ -1507,7 +1507,7 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
u
->
strdata
=
mallocstrcpy
(
NULL
,
openfile
->
current
->
data
);
u
->
mark_begin_x
=
openfile
->
current_x
;
break
;
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
case
SPLIT_BEGIN
:
case
SPLIT_END
:
#endif
...
...
@@ -1526,7 +1526,7 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
}
#endif
/* !NANO_TINY */
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
/* Unset the prepend_wrap flag. We need to do this as soon as we do
* something other than type text. */
void
wrap_reset
(
void
)
...
...
@@ -1666,7 +1666,7 @@ bool do_wrap(filestruct *line)
return
TRUE
;
}
#endif
/*
!DIS
ABLE_WRAPPING */
#endif
/*
EN
ABLE_WRAPPING */
#if defined(ENABLE_HELP) || !defined(DISABLE_WRAPJUSTIFY)
/* We are trying to break a chunk off line. We find the last blank such
...
...
@@ -3637,7 +3637,7 @@ void complete_a_word(void)
int
start_of_shard
,
shard_length
=
0
;
int
i
=
0
,
j
=
0
;
completion_word
*
some_word
;
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
bool
was_set_wrapping
=
!
ISSET
(
NO_WRAP
);
#endif
...
...
@@ -3742,14 +3742,14 @@ void complete_a_word(void)
some_word
->
next
=
list_of_completions
;
list_of_completions
=
some_word
;
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
/* Temporarily disable wrapping so only one undo item is added. */
SET
(
NO_WRAP
);
#endif
/* Inject the completion into the buffer. */
do_output
(
&
completion
[
shard_length
],
strlen
(
completion
)
-
shard_length
,
FALSE
);
#if
n
def
DIS
ABLE_WRAPPING
#ifdef
EN
ABLE_WRAPPING
/* If needed, reenable wrapping and wrap the current line. */
if
(
was_set_wrapping
)
{
UNSET
(
NO_WRAP
);
...
...
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