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
067a9205
Commit
067a9205
authored
7 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: improve some comments, and rename a variable for symmetry
parent
36e88032
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/global.c
+9
-10
src/global.c
src/history.c
+16
-16
src/history.c
with
25 additions
and
26 deletions
+25
-26
src/global.c
View file @
067a9205
...
...
@@ -205,25 +205,24 @@ subnfunc *uncutfunc;
#ifndef DISABLE_HISTORIES
filestruct
*
search_history
=
NULL
;
/* The
search string history list
. */
/* The
current item in the list of strings that were searched for
. */
filestruct
*
searchtop
=
NULL
;
/* The
top of the search string history list
. */
/* The
oldest item in the list of search strings
. */
filestruct
*
searchbot
=
NULL
;
/* The bottom of the search string history list. */
/* The newest item in the list of search strings. */
filestruct
*
replace_history
=
NULL
;
/* The
replace string history list
. */
/* The
current item in the list of replace strings
. */
filestruct
*
replacetop
=
NULL
;
/* The top of the replace string history list. */
filestruct
*
replacebot
=
NULL
;
/* The bottom of the replace string history list. */
filestruct
*
execute_history
=
NULL
;
/* The list of commands that
have been
run with ^R ^X. */
/* The
current item in the
list of commands that
were
run with ^R ^X. */
filestruct
*
executetop
=
NULL
;
/* The top of the execute history list. */
filestruct
*
executebot
=
NULL
;
/* The bottom of the execute history list. */
poshiststruct
*
position_history
=
NULL
;
/* The
cursor position history list
. */
/* The
list of filenames with their last cursor positions
. */
#endif
regex_t
search_regexp
;
...
...
This diff is collapsed.
Click to expand it.
src/history.c
View file @
067a9205
...
...
@@ -78,29 +78,29 @@ filestruct *find_history(const filestruct *h_start, const filestruct
* with a fresh string s. That is: add s, or move it to the end. */
void
update_history
(
filestruct
**
h
,
const
char
*
s
)
{
filestruct
**
h
age
=
NULL
,
**
hbot
=
NULL
,
*
thesame
;
filestruct
**
h
top
=
NULL
,
**
hbot
=
NULL
,
*
thesame
;
if
(
*
h
==
search_history
)
{
h
age
=
&
searchtop
;
h
top
=
&
searchtop
;
hbot
=
&
searchbot
;
}
else
if
(
*
h
==
replace_history
)
{
h
age
=
&
replacetop
;
h
top
=
&
replacetop
;
hbot
=
&
replacebot
;
}
else
if
(
*
h
==
execute_history
)
{
h
age
=
&
executetop
;
h
top
=
&
executetop
;
hbot
=
&
executebot
;
}
/* See if the string is already in the history. */
thesame
=
find_history
(
*
hbot
,
*
h
age
,
s
,
HIGHEST_POSITIVE
);
thesame
=
find_history
(
*
hbot
,
*
h
top
,
s
,
HIGHEST_POSITIVE
);
/* If an identical string was found, delete that item. */
if
(
thesame
!=
NULL
)
{
filestruct
*
after
=
thesame
->
next
;
/* If the string is at the head of the list, move the head. */
if
(
thesame
==
*
h
age
)
*
h
age
=
after
;
if
(
thesame
==
*
h
top
)
*
h
top
=
after
;
unlink_node
(
thesame
);
renumber
(
after
);
...
...
@@ -109,11 +109,11 @@ void update_history(filestruct **h, const char *s)
/* If the history is full, delete the oldest item (the one at the
* head of the list), to make room for a new item at the end. */
if
((
*
hbot
)
->
lineno
==
MAX_SEARCH_HISTORY
+
1
)
{
filestruct
*
oldest
=
*
h
age
;
filestruct
*
oldest
=
*
h
top
;
*
h
age
=
(
*
h
age
)
->
next
;
*
h
top
=
(
*
h
top
)
->
next
;
unlink_node
(
oldest
);
renumber
(
*
h
age
);
renumber
(
*
h
top
);
}
/* Store the fresh string in the last item, then create a new item. */
...
...
@@ -171,25 +171,25 @@ void get_history_older_void(void)
char
*
get_history_completion
(
filestruct
**
h
,
char
*
s
,
size_t
len
)
{
if
(
len
>
0
)
{
filestruct
*
h
age
=
NULL
,
*
hbot
=
NULL
,
*
p
;
filestruct
*
h
top
=
NULL
,
*
hbot
=
NULL
,
*
p
;
if
(
*
h
==
search_history
)
{
h
age
=
searchtop
;
h
top
=
searchtop
;
hbot
=
searchbot
;
}
else
if
(
*
h
==
replace_history
)
{
h
age
=
replacetop
;
h
top
=
replacetop
;
hbot
=
replacebot
;
}
else
if
(
*
h
==
execute_history
)
{
h
age
=
executetop
;
h
top
=
executetop
;
hbot
=
executebot
;
}
/* Search the history list from the current position to the top
* for a match of len characters. Skip over an exact match. */
p
=
find_history
((
*
h
)
->
prev
,
h
age
,
s
,
len
);
p
=
find_history
((
*
h
)
->
prev
,
h
top
,
s
,
len
);
while
(
p
!=
NULL
&&
strcmp
(
p
->
data
,
s
)
==
0
)
p
=
find_history
(
p
->
prev
,
h
age
,
s
,
len
);
p
=
find_history
(
p
->
prev
,
h
top
,
s
,
len
);
if
(
p
!=
NULL
)
{
*
h
=
p
;
...
...
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