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
c0aa5ad2
Commit
c0aa5ad2
authored
8 years ago
by
Benno Schulenberg
Browse files
Options
Download
Email Patches
Plain Diff
tweaks: miscellaneous frobbings
parent
58c3dd6c
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
+2
-3
src/cut.c
src/files.c
+2
-3
src/files.c
src/proto.h
+3
-3
src/proto.h
src/text.c
+3
-0
src/text.c
src/winio.c
+15
-22
src/winio.c
with
25 additions
and
31 deletions
+25
-31
src/cut.c
View file @
c0aa5ad2
...
...
@@ -258,7 +258,7 @@ void do_uncut_text(void)
{
ssize_t
was_lineno
=
openfile
->
current
->
lineno
;
/* If the cutbuffer is empty,
get out
. */
/* If the cutbuffer is empty,
there is nothing to do
. */
if
(
cutbuffer
==
NULL
)
return
;
...
...
@@ -277,8 +277,7 @@ void do_uncut_text(void)
if
(
openfile
->
current
->
lineno
-
was_lineno
<
editwinrows
)
focusing
=
FALSE
;
/* Set the current place we want to where the text from the
* cutbuffer ends. */
/* Set the desired x position to where the pasted text ends. */
openfile
->
placewewant
=
xplustabs
();
/* Mark the file as modified. */
...
...
This diff is collapsed.
Click to expand it.
src/files.c
View file @
c0aa5ad2
...
...
@@ -906,8 +906,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkw
openfile
->
current_x
=
0
;
}
/* Set the current place we want to the end of the last line of the
* file we inserted. */
/* Set the desired x position at the end of what was inserted. */
openfile
->
placewewant
=
xplustabs
();
if
(
!
writable
)
...
...
@@ -2978,7 +2977,7 @@ bool writehist(FILE *hist, const filestruct *head)
{
const
filestruct
*
item
;
/* Write a history list from the oldest
entry
to the newest. */
/* Write a history list
,
from the oldest
item
to the newest. */
for
(
item
=
head
;
item
!=
NULL
;
item
=
item
->
next
)
{
size_t
length
=
strlen
(
item
->
data
);
...
...
This diff is collapsed.
Click to expand it.
src/proto.h
View file @
c0aa5ad2
...
...
@@ -348,7 +348,7 @@ const char *tail(const char *path);
#ifndef DISABLE_HISTORIES
char
*
histfilename
(
void
);
void
load_history
(
void
);
bool
writehist
(
FILE
*
hist
,
const
filestruct
*
hist
head
);
bool
writehist
(
FILE
*
hist
,
const
filestruct
*
head
);
void
save_history
(
void
);
int
check_dotnano
(
void
);
void
load_poshistory
(
void
);
...
...
@@ -743,8 +743,8 @@ void statusline(message_type importance, const char *msg, ...);
void
bottombars
(
int
menu
);
void
onekey
(
const
char
*
keystroke
,
const
char
*
desc
,
int
length
);
void
reset_cursor
(
void
);
void
edit_draw
(
filestruct
*
fileptr
,
const
char
*
converted
,
int
line
,
size_t
start
);
void
edit_draw
(
filestruct
*
fileptr
,
const
char
*
converted
,
int
line
,
size_t
from_col
);
int
update_line
(
filestruct
*
fileptr
,
size_t
index
);
bool
need_horizontal_scroll
(
const
size_t
old_column
,
const
size_t
new_column
);
void
edit_scroll
(
scroll_dir
direction
,
ssize_t
nlines
);
...
...
This diff is collapsed.
Click to expand it.
src/text.c
View file @
c0aa5ad2
...
...
@@ -823,10 +823,12 @@ void do_undo(void)
statusline
(
HUSH
,
_
(
"Undid action (%s)"
),
undidmsg
);
renumber
(
f
);
openfile
->
current_undo
=
openfile
->
current_undo
->
next
;
openfile
->
last_action
=
OTHER
;
openfile
->
mark_set
=
FALSE
;
openfile
->
placewewant
=
xplustabs
();
openfile
->
totsize
=
u
->
wassize
;
set_modified
();
}
...
...
@@ -974,6 +976,7 @@ void do_redo(void)
openfile
->
last_action
=
OTHER
;
openfile
->
mark_set
=
FALSE
;
openfile
->
placewewant
=
xplustabs
();
openfile
->
totsize
=
u
->
newsize
;
set_modified
();
}
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
c0aa5ad2
...
...
@@ -2294,8 +2294,8 @@ void reset_cursor(void)
* character of this page. That is, the first character of converted
* corresponds to character number actual_x(fileptr->data, from_col) of the
* line. */
void
edit_draw
(
filestruct
*
fileptr
,
const
char
*
converted
,
int
line
,
size_t
from_col
)
void
edit_draw
(
filestruct
*
fileptr
,
const
char
*
converted
,
int
line
,
size_t
from_col
)
{
#if !defined(NANO_TINY) || !defined(DISABLE_COLOR)
size_t
from_x
=
actual_x
(
fileptr
->
data
,
from_col
);
...
...
@@ -2483,8 +2483,8 @@ void edit_draw(filestruct *fileptr, const char *converted, int
while
(
TRUE
)
{
index
+=
startmatch
.
rm_so
;
startmatch
.
rm_eo
-=
startmatch
.
rm_so
;
if
(
regexec
(
varnish
->
end
,
start_line
->
data
+
index
+
startmatch
.
rm_eo
,
0
,
NULL
,
if
(
regexec
(
varnish
->
end
,
start_line
->
data
+
index
+
startmatch
.
rm_eo
,
0
,
NULL
,
(
index
+
startmatch
.
rm_eo
==
0
)
?
0
:
REG_NOTBOL
)
==
REG_NOMATCH
)
/* No end found after this start. */
...
...
@@ -2497,8 +2497,8 @@ void edit_draw(filestruct *fileptr, const char *converted, int
}
/* Indeed, there is a start without an end on that line. */
/* We've already checked that there is no end be
fore fileptr
* and
after the start
. But is there an end after the start
/* We've already checked that there is no end be
tween the start
* and
the current line
. But is there an end after the start
* at all? We don't paint unterminated starts. */
while
(
end_line
!=
NULL
&&
regexec
(
varnish
->
end
,
end_line
->
data
,
1
,
&
endmatch
,
0
)
==
REG_NOMATCH
)
...
...
@@ -2557,9 +2557,8 @@ void edit_draw(filestruct *fileptr, const char *converted, int
* the beginning of the line. */
endmatch
.
rm_so
+=
startmatch
.
rm_eo
;
endmatch
.
rm_eo
+=
startmatch
.
rm_eo
;
/* There is an end on this line. But does
* it appear on this page, and is the match
* more than zero characters long? */
/* Only paint the match if it is visible on screen and
* it is more than zero characters long. */
if
(
endmatch
.
rm_eo
>
from_x
&&
endmatch
.
rm_eo
>
startmatch
.
rm_so
)
{
paintlen
=
actual_x
(
thetext
,
strnlenpt
(
fileptr
->
data
,
...
...
@@ -2662,15 +2661,12 @@ void edit_draw(filestruct *fileptr, const char *converted, int
int
update_line
(
filestruct
*
fileptr
,
size_t
index
)
{
int
line
=
0
;
/* The
line
in the edit window
that we want to
updat
e
. */
/* The
row
in the edit window
we will be
updat
ing
. */
int
extralinesused
=
0
;
char
*
converted
;
/* fileptr->data converted to have tabs and control characters
* expanded. */
/* The data of the line with tabs and control characters expanded. */
size_t
page_start
;
assert
(
fileptr
!=
NULL
);
#ifndef NANO_TINY
if
(
ISSET
(
SOFTWRAP
))
{
filestruct
*
tmp
;
...
...
@@ -2795,8 +2791,6 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
ssize_t
i
;
filestruct
*
foo
;
assert
(
nlines
>
0
);
/* Part 1: nlines is the number of lines we're going to scroll the
* text of the edit window. */
...
...
@@ -2856,12 +2850,10 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
if
(
nlines
>
editwinrows
)
nlines
=
editwinrows
;
/* If we scrolled up, we're on the line before the scrolled
* region. */
/* If we scrolled up, we're on the line before the scrolled region. */
foo
=
openfile
->
edittop
;
/* If we scrolled down, move down to the line before the scrolled
* region. */
/* If we scrolled down, move down to the line before the scrolled region. */
if
(
direction
==
DOWNWARD
)
{
for
(
i
=
editwinrows
-
nlines
;
i
>
0
&&
foo
!=
NULL
;
i
--
)
foo
=
foo
->
next
;
...
...
@@ -2873,8 +2865,8 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
* blank, so we don't need to draw it unless the mark is on or we're
* not on the first page. */
for
(
i
=
nlines
;
i
>
0
&&
foo
!=
NULL
;
i
--
)
{
if
((
i
==
nlines
&&
direction
==
DOWNWARD
)
||
(
i
==
1
&&
direction
==
UPWARD
))
{
if
((
i
==
nlines
&&
direction
==
DOWNWARD
)
||
(
i
==
1
&&
direction
==
UPWARD
))
{
if
(
need_horizontal_scroll
(
openfile
->
placewewant
,
0
))
update_line
(
foo
,
(
foo
==
openfile
->
current
)
?
openfile
->
current_x
:
0
);
...
...
@@ -2883,6 +2875,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
openfile
->
current_x
:
0
);
foo
=
foo
->
next
;
}
compute_maxrows
();
}
...
...
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