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
ff35a613
Commit
ff35a613
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: transform the token DISABLE_HISTORIES to ENABLE_HISTORIES
parent
3f27c312
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
configure.ac
+7
-5
configure.ac
src/browser.c
+1
-1
src/browser.c
src/files.c
+4
-4
src/files.c
src/global.c
+6
-6
src/global.c
src/history.c
+2
-2
src/history.c
src/nano.c
+10
-10
src/nano.c
src/nano.h
+1
-1
src/nano.h
src/prompt.c
+10
-10
src/prompt.c
src/proto.h
+2
-2
src/proto.h
src/rcfile.c
+4
-4
src/rcfile.c
src/search.c
+3
-3
src/search.c
with
50 additions
and
48 deletions
+50
-48
configure.ac
View file @
ff35a613
...
...
@@ -133,8 +133,13 @@ fi
AC_ARG_ENABLE(histories,
AS_HELP_STRING([--disable-histories], [Disable search and position histories]))
if test "x$enable_histories" = xno; then
AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.])
if test "x$enable_tiny" = xyes; then
if test "x$enable_histories" != xyes; then
enable_histories=no
fi
fi
if test "x$enable_histories" != xno; then
AC_DEFINE(ENABLE_HISTORIES, 1, [Define this to have search and position histories.])
fi
AC_ARG_ENABLE(justify,
...
...
@@ -262,9 +267,6 @@ if test "x$enable_tiny" = xyes; then
if test "x$enable_extra" != xyes; then
AC_DEFINE(DISABLE_EXTRA, 1, [Define this to disable extra stuff.])
fi
if test "x$enable_histories" != xyes; then
AC_DEFINE(DISABLE_HISTORIES, 1, [Define this to disable search and position histories.])
fi
if test "x$enable_justify" != xyes; then
AC_DEFINE(DISABLE_JUSTIFY, 1, [Define this to disable the justify routines.])
fi
...
...
This diff is collapsed.
Click to expand it.
src/browser.c
View file @
ff35a613
...
...
@@ -765,7 +765,7 @@ void do_filesearch(void)
else
last_search
=
mallocstrcpy
(
last_search
,
answer
);
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
/* If answer is not empty, add the string to the search history list. */
if
(
*
answer
!=
'\0'
)
update_history
(
&
search_history
,
answer
);
...
...
This diff is collapsed.
Click to expand it.
src/files.c
View file @
ff35a613
...
...
@@ -647,7 +647,7 @@ bool close_buffer(void)
if
(
openfile
==
openfile
->
next
)
return
FALSE
;
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
if
(
ISSET
(
POS_HISTORY
))
update_poshistory
(
openfile
->
filename
,
openfile
->
current
->
lineno
,
xplustabs
()
+
1
);
...
...
@@ -1131,7 +1131,7 @@ void do_insertfile(void)
* into the buffer, and add the command to the history list. */
if
(
*
answer
!=
'\0'
)
{
execute_command
(
answer
);
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
update_history
(
&
execute_history
,
answer
);
#endif
}
...
...
@@ -1159,7 +1159,7 @@ void do_insertfile(void)
#ifdef ENABLE_MULTIBUFFER
if
(
ISSET
(
MULTIBUFFER
))
{
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
if
(
ISSET
(
POS_HISTORY
))
{
ssize_t
priorline
,
priorcol
;
#ifndef NANO_TINY
...
...
@@ -1168,7 +1168,7 @@ void do_insertfile(void)
if
(
has_old_position
(
answer
,
&
priorline
,
&
priorcol
))
do_gotolinecolumn
(
priorline
,
priorcol
,
FALSE
,
FALSE
);
}
#endif
/*
!DIS
ABLE_HISTORIES */
#endif
/*
EN
ABLE_HISTORIES */
/* Update stuff to account for the current buffer. */
prepare_for_display
();
}
else
...
...
This diff is collapsed.
Click to expand it.
src/global.c
View file @
ff35a613
...
...
@@ -209,7 +209,7 @@ filestruct *execute_history = NULL;
/* The current item in the list of commands that were run with ^R ^X. */
filestruct
*
replace_history
=
NULL
;
/* The current item in the list of replace strings. */
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
filestruct
*
searchtop
=
NULL
;
/* The oldest item in the list of search strings. */
filestruct
*
searchbot
=
NULL
;
...
...
@@ -643,7 +643,7 @@ void shortcut_init(void)
N_
(
"Reverse the direction of the search"
);
const
char
*
regexp_gist
=
N_
(
"Toggle the use of regular expressions"
);
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
const
char
*
prevhistory_gist
=
N_
(
"Recall the previous search/replace string"
);
const
char
*
nexthistory_gist
=
...
...
@@ -990,7 +990,7 @@ void shortcut_init(void)
N_
(
"Save"
),
WITHORSANS
(
savefile_gist
),
BLANKAFTER
,
NOVIEW
);
#endif
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
add_to_funcs
(
get_history_older_void
,
(
MWHEREIS
|
MREPLACE
|
MREPLACEWITH
|
MWHEREISFILE
),
N_
(
"PrevHstory"
),
WITHORSANS
(
prevhistory_gist
),
TOGETHER
,
VIEW
);
...
...
@@ -1283,7 +1283,7 @@ void shortcut_init(void)
#endif
add_to_sclist
(
MWHEREIS
,
"^T"
,
0
,
do_gotolinecolumn_void
,
0
);
add_to_sclist
(
MGOTOLINE
,
"^T"
,
0
,
gototext_void
,
0
);
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
add_to_sclist
(
MWHEREIS
|
MREPLACE
|
MREPLACEWITH
|
MWHEREISFILE
|
MFINDINHELP
|
MEXTCMD
,
"^P"
,
0
,
get_history_older_void
,
0
);
add_to_sclist
(
MWHEREIS
|
MREPLACE
|
MREPLACEWITH
|
MWHEREISFILE
|
MFINDINHELP
|
MEXTCMD
,
"^N"
,
0
,
get_history_newer_void
,
0
);
#ifdef ENABLE_UTF8
...
...
@@ -1626,7 +1626,7 @@ sc *strtosc(const char *input)
s
->
scfunc
=
flip_replace
;
else
if
(
!
strcasecmp
(
input
,
"gototext"
))
s
->
scfunc
=
gototext_void
;
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
else
if
(
!
strcasecmp
(
input
,
"prevhistory"
))
s
->
scfunc
=
get_history_older_void
;
else
if
(
!
strcasecmp
(
input
,
"nexthistory"
))
...
...
@@ -1849,7 +1849,7 @@ void thanks_for_all_the_fish(void)
free
(
sint
);
}
#endif
/* !DISABLE_COLOR */
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
/* Free the search and replace history lists. */
free_filestruct
(
searchtop
);
free_filestruct
(
replacetop
);
...
...
This diff is collapsed.
Click to expand it.
src/history.c
View file @
ff35a613
...
...
@@ -24,7 +24,7 @@
#include <errno.h>
#include <string.h>
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
static
bool
history_changed
=
FALSE
;
/* Whether any of the history lists has changed. */
...
...
@@ -568,4 +568,4 @@ bool has_old_position(const char *file, ssize_t *line, ssize_t *column)
*
column
=
posptr
->
xno
;
return
TRUE
;
}
#endif
/*
!DIS
ABLE_HISTORIES */
#endif
/*
EN
ABLE_HISTORIES */
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
ff35a613
...
...
@@ -564,7 +564,7 @@ void finish(void)
/* Restore the old terminal settings. */
tcsetattr
(
0
,
TCSANOW
,
&
oldterm
);
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
/* If the user wants history persistence, write the relevant files. */
if
(
ISSET
(
HISTORYLOG
))
save_history
();
...
...
@@ -807,7 +807,7 @@ void usage(void)
#ifndef NANO_TINY
print_opt
(
"-G"
,
"--locking"
,
N_
(
"Use (vim-style) lock files"
));
#endif
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
if
(
!
ISSET
(
RESTRICTED
))
print_opt
(
"-H"
,
"--historylog"
,
N_
(
"Log & read search/replace string history"
));
...
...
@@ -825,7 +825,7 @@ void usage(void)
N_
(
"Don't convert files from DOS/Mac format"
));
#endif
print_opt
(
"-O"
,
"--morespace"
,
N_
(
"Use one more line for editing"
));
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
if
(
!
ISSET
(
RESTRICTED
))
print_opt
(
"-P"
,
"--positionlog"
,
N_
(
"Log & read location of cursor position"
));
...
...
@@ -939,7 +939,7 @@ void version(void)
#ifdef ENABLE_HELP
printf
(
" --enable-help"
);
#endif
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
printf
(
" --enable-histories"
);
#endif
#ifndef DISABLE_JUSTIFY
...
...
@@ -988,7 +988,7 @@ void version(void)
#ifndef ENABLE_HELP
printf
(
" --disable-help"
);
#endif
#ifdef
DIS
ABLE_HISTORIES
#if
n
def
EN
ABLE_HISTORIES
printf
(
" --disable-histories"
);
#endif
#ifdef DISABLE_JUSTIFY
...
...
@@ -2059,7 +2059,7 @@ int main(int argc, char **argv)
SET
(
LOCKING
);
break
;
#endif
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
case
'H'
:
SET
(
HISTORYLOG
);
break
;
...
...
@@ -2083,7 +2083,7 @@ int main(int argc, char **argv)
case
'O'
:
SET
(
MORE_SPACE
);
break
;
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
case
'P'
:
SET
(
POS_HISTORY
);
break
;
...
...
@@ -2354,7 +2354,7 @@ int main(int argc, char **argv)
if
(
ISSET
(
BOLD_TEXT
))
hilite_attribute
=
A_BOLD
;
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
/* Initialize the pointers for the Search/Replace/Execute histories. */
history_init
();
...
...
@@ -2373,7 +2373,7 @@ int main(int argc, char **argv)
load_history
();
if
(
ISSET
(
POS_HISTORY
))
load_poshistory
();
#endif
/*
!DIS
ABLE_HISTORIES */
#endif
/*
EN
ABLE_HISTORIES */
#ifndef NANO_TINY
/* If backups are enabled and a backup directory was specified and
...
...
@@ -2567,7 +2567,7 @@ int main(int argc, char **argv)
/* If a position was given on the command line, go there. */
if
(
givenline
!=
0
||
givencol
!=
0
)
do_gotolinecolumn
(
givenline
,
givencol
,
FALSE
,
FALSE
);
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
else
if
(
ISSET
(
POS_HISTORY
)
&&
openfile
->
filename
[
0
]
!=
'\0'
)
{
ssize_t
savedline
,
savedcol
;
/* If edited before, restore the last cursor position. */
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
ff35a613
...
...
@@ -343,7 +343,7 @@ typedef struct undo {
}
undo
;
#endif
/* !NANO_TINY */
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
typedef
struct
poshiststruct
{
char
*
filename
;
/* The file. */
...
...
This diff is collapsed.
Click to expand it.
src/prompt.c
View file @
ff35a613
...
...
@@ -440,7 +440,7 @@ void update_the_statusbar(void)
/* Get a string of input at the statusbar prompt. */
functionptrtype
acquire_an_answer
(
int
*
actual
,
bool
allow_tabs
,
bool
allow_files
,
bool
*
listed
,
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
filestruct
**
history_list
,
#endif
void
(
*
refresh_func
)(
void
))
...
...
@@ -452,7 +452,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
bool
tabbed
=
FALSE
;
/* Whether we've pressed Tab. */
#endif
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
char
*
history
=
NULL
;
/* The current history string. */
char
*
magichistory
=
NULL
;
...
...
@@ -465,7 +465,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
/* The length of the original string that we're trying to
* tab complete, if any. */
#endif
#endif
/*
!DIS
ABLE_HISTORIES */
#endif
/*
EN
ABLE_HISTORIES */
if
(
statusbar_x
>
strlen
(
answer
))
statusbar_x
=
strlen
(
answer
);
...
...
@@ -480,7 +480,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
if
(
kbinput
==
KEY_WINCH
)
{
refresh_func
();
*
actual
=
KEY_WINCH
;
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
free
(
magichistory
);
#endif
return
NULL
;
...
...
@@ -497,7 +497,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
tabbed
=
FALSE
;
if
(
func
==
do_tab
)
{
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
if
(
history_list
!=
NULL
)
{
if
(
last_kbinput
!=
the_code_for
(
do_tab
,
TAB_CODE
))
complete_len
=
strlen
(
answer
);
...
...
@@ -514,7 +514,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
&
tabbed
,
refresh_func
,
listed
);
}
else
#endif
/* ENABLE_TABCOMP */
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
if
(
func
==
get_history_older_void
)
{
if
(
history_list
!=
NULL
)
{
/* If we're scrolling up at the bottom of the history list
...
...
@@ -560,7 +560,7 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
finished
=
FALSE
;
}
}
else
#endif
/*
!DIS
ABLE_HISTORIES */
#endif
/*
EN
ABLE_HISTORIES */
if
(
func
==
do_help_void
)
{
/* This key has a shortcut-list entry when it's used to go to
* the help browser or display a message indicating that help
...
...
@@ -577,12 +577,12 @@ functionptrtype acquire_an_answer(int *actual, bool allow_tabs,
update_the_statusbar
();
#if
!
defined(
DIS
ABLE_HISTORIES) && defined(ENABLE_TABCOMP)
#if defined(
EN
ABLE_HISTORIES) && defined(ENABLE_TABCOMP)
last_kbinput
=
kbinput
;
#endif
}
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
/* Set the current position in the history list to the bottom. */
if
(
history_list
!=
NULL
)
{
history_reset
(
*
history_list
);
...
...
@@ -633,7 +633,7 @@ int do_prompt(bool allow_tabs, bool allow_files,
prompt
[
actual_x
(
prompt
,
(
COLS
<
5
)
?
0
:
COLS
-
5
)]
=
'\0'
;
func
=
acquire_an_answer
(
&
retval
,
allow_tabs
,
allow_files
,
&
listed
,
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
history_list
,
#endif
refresh_func
);
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
ff35a613
...
...
@@ -161,7 +161,7 @@ extern subnfunc *uncutfunc;
extern
filestruct
*
search_history
;
extern
filestruct
*
replace_history
;
extern
filestruct
*
execute_history
;
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
extern
filestruct
*
searchtop
;
extern
filestruct
*
searchbot
;
extern
filestruct
*
replacetop
;
...
...
@@ -353,7 +353,7 @@ size_t help_line_len(const char *ptr);
void
do_help_void
(
void
);
/* Most functions in history.c. */
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
void
history_init
(
void
);
void
history_reset
(
const
filestruct
*
h
);
void
update_history
(
filestruct
**
h
,
const
char
*
s
);
...
...
This diff is collapsed.
Click to expand it.
src/rcfile.c
View file @
ff35a613
...
...
@@ -47,7 +47,7 @@ static const rcoption rcopts[] = {
#ifndef DISABLE_WRAPJUSTIFY
{
"fill"
,
0
},
#endif
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
{
"historylog"
,
HISTORYLOG
},
#endif
{
"morespace"
,
MORE_SPACE
},
...
...
@@ -66,7 +66,7 @@ static const rcoption rcopts[] = {
#ifndef DISABLE_OPERATINGDIR
{
"operatingdir"
,
0
},
#endif
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
{
"poslog"
,
POS_HISTORY
},
/* deprecated form, remove in 2018 */
{
"positionlog"
,
POS_HISTORY
},
#endif
...
...
@@ -162,7 +162,7 @@ void rcfile_error(const char *msg, ...)
}
#endif
/* ENABLE_NANORC */
#if defined(ENABLE_NANORC) ||
!
defined(
DIS
ABLE_HISTORIES)
#if defined(ENABLE_NANORC) || defined(
EN
ABLE_HISTORIES)
/* Parse the next word from the string, null-terminate it, and return
* a pointer to the first character after the null terminator. The
* returned pointer will point to '\0' if we hit the end of the line. */
...
...
@@ -182,7 +182,7 @@ char *parse_next_word(char *ptr)
return
ptr
;
}
#endif
/* ENABLE_NANORC ||
!DIS
ABLE_HISTORIES */
#endif
/* ENABLE_NANORC ||
EN
ABLE_HISTORIES */
#ifdef ENABLE_NANORC
/* Parse an argument, with optional quotes, after a keyword that takes
...
...
This diff is collapsed.
Click to expand it.
src/search.c
View file @
ff35a613
...
...
@@ -162,7 +162,7 @@ int search_init(bool replacing, bool use_answer)
/* If an answer was given, remember it. */
if
(
*
answer
!=
'\0'
)
{
last_search
=
mallocstrcpy
(
last_search
,
answer
);
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
update_history
(
&
search_history
,
answer
);
#endif
}
...
...
@@ -403,7 +403,7 @@ void do_findnext(void)
/* Search for the last string without prompting. */
void
do_research
(
void
)
{
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
/* If nothing was searched for yet during this run of nano, but
* there is a search history, take the most recent item. */
if
(
*
last_search
==
'\0'
&&
searchbot
->
prev
!=
NULL
)
...
...
@@ -748,7 +748,7 @@ void do_replace(void)
/* TRANSLATORS: This is a prompt. */
edit_refresh
,
_
(
"Replace with"
));
#if
n
def
DIS
ABLE_HISTORIES
#ifdef
EN
ABLE_HISTORIES
/* If the replace string is not "", add it to the replace history list. */
if
(
i
==
0
)
update_history
(
&
replace_history
,
answer
);
...
...
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