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
d33b5f3d
Commit
d33b5f3d
authored
7 years ago
by
Benno Schulenberg
Committed by
Benno Schulenberg
7 years ago
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: rename, rewrap, and reshuffle some stuff, and frob some comments
parent
c24e95e3
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
src/cut.c
+4
-4
src/cut.c
src/nano.c
+6
-8
src/nano.c
src/nano.h
+4
-4
src/nano.h
src/search.c
+1
-1
src/search.c
src/text.c
+11
-17
src/text.c
with
26 additions
and
34 deletions
+26
-34
src/cut.c
View file @
d33b5f3d
...
...
@@ -216,7 +216,7 @@ void do_cut_text_void(void)
void
do_copy_text
(
void
)
{
static
struct
filestruct
*
next_contiguous_line
=
NULL
;
bool
mark_set
=
(
openfile
->
mark
!=
NULL
);
bool
mark_
is_
set
=
(
openfile
->
mark
!=
NULL
);
/* Remember the current viewport and cursor position. */
ssize_t
is_edittop_lineno
=
openfile
->
edittop
->
lineno
;
...
...
@@ -224,16 +224,16 @@ void do_copy_text(void)
ssize_t
is_current_lineno
=
openfile
->
current
->
lineno
;
size_t
is_current_x
=
openfile
->
current_x
;
if
(
mark_set
||
openfile
->
current
!=
next_contiguous_line
)
if
(
mark_
is_
set
||
openfile
->
current
!=
next_contiguous_line
)
cutbuffer_reset
();
do_cut_text
(
TRUE
,
FALSE
);
/* If the mark was set, blow away the cutbuffer on the next copy. */
next_contiguous_line
=
(
mark_set
?
NULL
:
openfile
->
current
);
next_contiguous_line
=
(
mark_
is_
set
?
NULL
:
openfile
->
current
);
/* If the mark was set, restore the viewport and cursor position. */
if
(
mark_set
)
{
if
(
mark_
is_
set
)
{
openfile
->
edittop
=
fsfromline
(
is_edittop_lineno
);
openfile
->
firstcolumn
=
is_firstcolumn
;
openfile
->
current
=
fsfromline
(
is_current_lineno
);
...
...
This diff is collapsed.
Click to expand it.
src/nano.c
View file @
d33b5f3d
...
...
@@ -307,14 +307,12 @@ void extract_buffer(filestruct **file_top, filestruct **file_bot,
openfile
->
edittop
->
lineno
<=
openfile
->
filebot
->
lineno
);
#ifndef NANO_TINY
if
(
openfile
->
mark
)
{
mark_inside
=
(
openfile
->
mark
->
lineno
>=
openfile
->
fileage
->
lineno
&&
openfile
->
mark
->
lineno
<=
openfile
->
filebot
->
lineno
&&
(
openfile
->
mark
!=
openfile
->
fileage
||
openfile
->
mark_x
>=
top_x
)
&&
(
openfile
->
mark
!=
openfile
->
filebot
||
openfile
->
mark_x
<=
bot_x
));
mark_inside
=
(
openfile
->
mark
->
lineno
>=
openfile
->
fileage
->
lineno
&&
openfile
->
mark
->
lineno
<=
openfile
->
filebot
->
lineno
&&
(
openfile
->
mark
!=
openfile
->
fileage
||
openfile
->
mark_x
>=
top_x
)
&&
(
openfile
->
mark
!=
openfile
->
filebot
||
openfile
->
mark_x
<=
bot_x
));
same_line
=
(
openfile
->
mark
==
openfile
->
fileage
);
}
#endif
...
...
This diff is collapsed.
Click to expand it.
src/nano.h
View file @
d33b5f3d
...
...
@@ -383,13 +383,13 @@ typedef struct openfilestruct {
/* The file's current stat information. */
#ifndef NANO_TINY
filestruct
*
mark
;
/* The
file's lin
e where the mark is
, if any
. */
/* The
line in the fil
e where the mark is
set; NULL if not set
. */
size_t
mark_x
;
/* The
file's
mark's x
-coordinate
position
,
i
f any
. */
/* The mark's x position i
n the above line
. */
mark_type
kind_of_mark
;
/* Whether t
his
is a soft or a hard mark. */
/* Whether
i
t is a soft
(with Shift)
or a hard mark. */
file_format
fmt
;
/* The file's format. */
/* The file's format
-- Unix or DOS or Mac or mixed
. */
undo
*
undotop
;
/* The top of the undo list. */
undo
*
current_undo
;
...
...
This diff is collapsed.
Click to expand it.
src/search.c
View file @
d33b5f3d
...
...
@@ -710,7 +710,7 @@ ssize_t do_replace_loop(const char *needle, bool whole_word_only,
openfile
->
mark
=
was_mark
;
#endif
/* If
the NO_NEWLINES flag isn't set
, and text has been added to the
/* If
"automatic newline" is enabled
, and text has been added to the
* magicline, make a new magicline. */
if
(
!
ISSET
(
NO_NEWLINES
)
&&
openfile
->
filebot
->
data
[
0
]
!=
'\0'
)
new_magicline
();
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
d33b5f3d
...
...
@@ -57,14 +57,14 @@ static completion_word *list_of_completions;
/* Toggle the mark. */
void
do_mark
(
void
)
{
if
(
openfile
->
mark
==
NULL
)
{
statusbar
(
_
(
"Mark Set"
));
if
(
!
openfile
->
mark
)
{
openfile
->
mark
=
openfile
->
current
;
openfile
->
mark_x
=
openfile
->
current_x
;
statusbar
(
_
(
"Mark Set"
));
openfile
->
kind_of_mark
=
HARDMARK
;
}
else
{
statusbar
(
_
(
"Mark Unset"
));
openfile
->
mark
=
NULL
;
statusbar
(
_
(
"Mark Unset"
));
refresh_needed
=
TRUE
;
}
}
...
...
@@ -1063,8 +1063,8 @@ void do_enter(void)
add_undo
(
ENTER
);
/* Adjust the mark if it was on the current line after the cursor. */
if
(
openfile
->
current
==
openfile
->
mark
&&
openfile
->
current
_x
<
openfile
->
mark
_x
)
{
if
(
openfile
->
mark
==
openfile
->
current
&&
openfile
->
mark
_x
>
openfile
->
current
_x
)
{
openfile
->
mark
=
newnode
;
openfile
->
mark_x
+=
extra
-
openfile
->
current_x
;
}
...
...
@@ -2019,13 +2019,8 @@ void backup_lines(filestruct *first_line, size_t par_len)
ssize_t
current_lineno_save
=
openfile
->
current
->
lineno
;
#ifndef NANO_TINY
bool
mark_is_set
=
(
openfile
->
mark
!=
NULL
);
ssize_t
mb_lineno_save
=
0
;
size_t
mark_begin_x_save
=
0
;
if
(
mark_is_set
)
{
mb_lineno_save
=
openfile
->
mark
->
lineno
;
mark_begin_x_save
=
openfile
->
mark_x
;
}
ssize_t
was_mark_lineno
=
(
mark_is_set
?
openfile
->
mark
->
lineno
:
0
);
size_t
was_mark_x
=
openfile
->
mark_x
;
#endif
/* Move bot down par_len lines to the line after the last line of
...
...
@@ -2047,9 +2042,9 @@ void backup_lines(filestruct *first_line, size_t par_len)
if
(
openfile
->
current
!=
openfile
->
fileage
)
{
top
=
openfile
->
current
->
prev
;
#ifndef NANO_TINY
if
(
mark_is_set
&&
openfile
->
current
->
lineno
==
mb
_lineno
_save
)
{
if
(
mark_is_set
&&
openfile
->
current
->
lineno
==
was_mark
_lineno
)
{
openfile
->
mark
=
openfile
->
current
;
openfile
->
mark_x
=
mark_
begin_x_save
;
openfile
->
mark_x
=
was_
mark_
x
;
}
#endif
}
else
...
...
@@ -2062,9 +2057,9 @@ void backup_lines(filestruct *first_line, size_t par_len)
if
(
top
->
lineno
==
current_lineno_save
)
openfile
->
current
=
top
;
#ifndef NANO_TINY
if
(
mark_is_set
&&
top
->
lineno
==
mb
_lineno
_save
)
{
if
(
mark_is_set
&&
top
->
lineno
==
was_mark
_lineno
)
{
openfile
->
mark
=
top
;
openfile
->
mark_x
=
mark_
begin_x_save
;
openfile
->
mark_x
=
was_
mark_
x
;
}
#endif
top
=
top
->
prev
;
...
...
@@ -2927,7 +2922,6 @@ const char *do_alt_speller(char *tempfile_name)
mark_order
((
const
filestruct
**
)
&
top
,
&
top_x
,
(
const
filestruct
**
)
&
bot
,
&
bot_x
,
&
right_side_up
);
openfile
->
mark
=
NULL
;
replace_marked_buffer
(
tempfile_name
,
top
,
top_x
,
bot
,
bot_x
);
...
...
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