Compare commits
14 Commits
v2.1.99pre
...
v2.2.0
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cb9a5bed8e | ||
|
|
b43f6912f3 | ||
|
|
5a018f0d3a | ||
|
|
752830573a | ||
|
|
daaf468c93 | ||
|
|
dcf5cbbf6a | ||
|
|
3b830ee194 | ||
|
|
d753efdb55 | ||
|
|
c9199e9e9a | ||
|
|
e2df2c899d | ||
|
|
c82f038855 | ||
|
|
8b6f6fcc1b | ||
|
|
0bff84ef9c | ||
|
|
6277f59d24 |
2
BUGS
2
BUGS
@@ -1,5 +1,4 @@
|
||||
** Open BUGS **
|
||||
- Cutting the line at the top of the screen recenters to center (71)
|
||||
|
||||
** Fixed BUGS **
|
||||
- Marked cutting sometimes leaves a newline in the file unintelligently,
|
||||
@@ -156,6 +155,7 @@
|
||||
assigned to it (79 - may not be worth fixing) [FIXED]
|
||||
- Segfault editing at COLS presumably due to new color syntax
|
||||
highlighting (80) [FIXED]
|
||||
- Cutting the line at the top of the screen recenters to center (71) [FIXED]
|
||||
|
||||
|
||||
$Id$
|
||||
|
||||
44
ChangeLog
44
ChangeLog
@@ -1,3 +1,47 @@
|
||||
GNU nano 2.2.0 - 2009.11.30
|
||||
2009-11-29 Chris Allegretta <chrisa@asty.org>
|
||||
* prompt.c (get_prompt_string) - Universally handle help key when is disabled. Fixes Savannah
|
||||
bug 28117 by David Lawrence Ramsey <pooka109@gmail.com>.
|
||||
* chars.c, files.c: Add junk vars to silence the compiler. Sigh.
|
||||
|
||||
2009-11-29 David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* Change several *chars to const char, additional cleanups and casts to make compilers happier.
|
||||
* global.c: Fix replace and insert file initializations for proper compilation options.
|
||||
* nano.c (do_suspend): Update comments to reflect actual code path, bad Chris and thanks for
|
||||
noticing Jordi.
|
||||
* configure.ac: Fix typos
|
||||
|
||||
2009-11-27 Chris Allegretta <chrisa@asty.org>
|
||||
* nano.c (do_suspend): Don't clear the screen but do move the cursor down to the last line
|
||||
first in an effort to not corrupt the screen, which contradicts Pico but is consistent
|
||||
with almost all other text editors. Fixes Savannah bug 28110/Debian bug 460510
|
||||
reported by Tim Connors <reportbug@rather.puzzling.org>.
|
||||
* doc/dyntax/makefile.nanorc - Sample Makefile highlighting based on wiki.linuxhelp.net version.
|
||||
|
||||
2009-11-26 Chris Allegretta <chrisa@asty.org>
|
||||
* winio.c (edit_scroll): Adjust for long lines when scrolling.
|
||||
* rcfile.c (parse_rcfile), initialize size argument to getline(), fixes crash on FreeBSD
|
||||
reported by Eitan Adler <eitanadlerlist@gmail.com>.
|
||||
|
||||
2009-11-26 Jordi Mallach <jordi@gnu.org>
|
||||
* doc/man/*: Update all man pages to escape unescaped hyphens.
|
||||
|
||||
2009-11-24 Chris Allegretta <chrisa@asty.org>
|
||||
* move.c (do_page_up, do_page_down): Make these functions work better with soft
|
||||
line wrapping.
|
||||
* winio.c (compute_maxrows): Make maxrows calculation more accurate when all lines are > COLS.
|
||||
|
||||
2009-11-22 Chris Allegretta <chrisa@asty.org>
|
||||
* nano.c (main): Allow edit_refresh_needed to take effect when using --enable-tiny
|
||||
(fixes Savannah bug 28076 reported by David Lawrence Ramsey).
|
||||
|
||||
2009-11-22 David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* nano.c (move_to_filestruct): Fix bug 71 (cut at top of line recenters)
|
||||
* Fix compilation with --enable-tiny
|
||||
|
||||
2009-11-22 Mike Frysinger <vapier@gentoo.org>
|
||||
* doc/syntax/gentoo.nanorc: Tweak comment highlighting.
|
||||
|
||||
GNU nano 2.1.99pre2 - 2009.11.21
|
||||
2009-11-21 Chris Allegretta <chrisa@asty.org>
|
||||
* rcfile.c: Add unbinding keyword, fixes Savannah bug 22852 reported by frankd.
|
||||
|
||||
19
NEWS
19
NEWS
@@ -1,3 +1,22 @@
|
||||
2009.11.30 - GNU nano 2.2.0 "Doc Brown" is released! The culmination
|
||||
of almost two years of development and hot on the heels
|
||||
of nano's 10th birthday is available for all your
|
||||
editing needs! Bugs fixed since the last release
|
||||
include several fixes for tiny mode (involving both
|
||||
the help keys and replace menu text), more 'final'
|
||||
fixes for soft wrapping, and several typo and documentation
|
||||
updates including nanorc tweaks and a new syntax
|
||||
highlighting file for makefiles. Also included is a long
|
||||
standing fix for random crashing when using nanorc on
|
||||
FreeBSD, and nano will no longer clear the screen on
|
||||
suspend to maintain compatibility with other *nix editors.
|
||||
For those who haven't been playing along at home, please
|
||||
see the official web page for the summary of new
|
||||
features since 2.0. Special thanks to all who have
|
||||
submitted bug reports recently in support of our new
|
||||
stable release, and apologies for all those bugs we
|
||||
didn't yet find :-) Peace to all.
|
||||
|
||||
2009.11.21 - GNU nano 2.1.99pre2 is available for a special pre-Black
|
||||
Friday discount. Included are some (hopefully
|
||||
final) fixes for issues with last page display
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.1.99pre2], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.2.0], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
@@ -191,7 +191,7 @@ fi],
|
||||
AC_ARG_ENABLE(all,
|
||||
[ --enable-all Enable ALL extra nano functionality (ignored for compatibility as all options default to on)],
|
||||
[if test x$enableval = xyes; then
|
||||
echo "--enable-all option no longer needed, ignoring for compatiblity"
|
||||
echo "--enable-all option no longer needed, ignoring for compatibility"
|
||||
fi])
|
||||
|
||||
AC_MSG_CHECKING([whether to enable UTF-8 support])
|
||||
|
||||
@@ -230,7 +230,7 @@ Passe automatiquement
|
||||
\fIcolonne\fR. Si la valeur indiquée est de 0 ou moins, le point de
|
||||
passage à la ligne aura lieu à la taille de l'écran moins \fIcolonne\fR.
|
||||
Cela permet de faire varier le point de passage à la ligne lorsque l'on
|
||||
change la taille de l'écran. La valeur par défaut est de -8.
|
||||
change la taille de l'écran. La valeur par défaut est de \-8.
|
||||
.TP
|
||||
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
|
||||
Choix d'un correcteur orthographique de remplacement.
|
||||
|
||||
@@ -143,7 +143,7 @@ Passe automatiquement
|
||||
\fIn\fR. Si la valeur indiquée est de 0 ou moins, le point de passage à
|
||||
la ligne aura lieu à la taille de l'écran moins \fIn\fR. Cela permet de
|
||||
faire varier le point de passage à la ligne lorsque l'on change la
|
||||
taille de l'écran. La valeur par défaut est de -8.
|
||||
taille de l'écran. La valeur par défaut est de \-8.
|
||||
.TP
|
||||
.B set/unset historylog
|
||||
Active l'utilisation de
|
||||
|
||||
@@ -180,7 +180,7 @@ be acknowledged by pressing enter at startup.
|
||||
Wrap lines at column \fIcols\fP. If this value is 0 or less, wrapping
|
||||
will occur at the width of the screen less \fIcols\fP columns, allowing
|
||||
the wrap point to vary along with the width of the screen if the screen
|
||||
is resized. The default value is -8.
|
||||
is resized. The default value is \-8.
|
||||
.TP
|
||||
.B \-s \fIprog\fP (\-\-speller=\fIprog\fP)
|
||||
Enable alternative spell checker command.
|
||||
|
||||
@@ -91,7 +91,7 @@ Use cut to end of line by default.
|
||||
.B set fill \fIn\fP
|
||||
Wrap lines at column number \fIn\fP. If \fIn\fP is 0 or less, the
|
||||
maximum line length will be the screen width less \fIn\fP columns. The
|
||||
default value is -8.
|
||||
default value is \-8.
|
||||
.TP
|
||||
.B set/unset historylog
|
||||
Enable \fI~/.nano_history\fP for saving and reading search/replace
|
||||
@@ -224,7 +224,7 @@ characters as parts of words.
|
||||
.TP
|
||||
.B syntax "\fIstr\fP" ["\fIfileregex\fP" ... ]
|
||||
Defines a syntax named \fIstr\fP which can be activated via the
|
||||
-Y/--syntax command line option, or will be automatically activated if
|
||||
\-Y/\-\-syntax command line option, or will be automatically activated if
|
||||
the current filename matches the extended regular expression
|
||||
\fIfileregex\fP. All following \fBcolor\fP and \fBicolor\fP statements
|
||||
will apply to \fIsyntax\fP until a new syntax is defined.
|
||||
|
||||
@@ -238,6 +238,9 @@
|
||||
## C/C++
|
||||
# include "@PKGDATADIR@/c.nanorc"
|
||||
|
||||
## Makefiles
|
||||
# include "@PKGDATADIR@/makefile.nanorc"
|
||||
|
||||
## Cascading Style Sheets
|
||||
# include "@PKGDATADIR@/css.nanorc"
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ pkgdata_DATA = asm.nanorc \
|
||||
xml.nanorc \
|
||||
ocaml.nanorc \
|
||||
objc.nanorc \
|
||||
fortran.nanorc
|
||||
fortran.nanorc \
|
||||
makefile.nanorc
|
||||
|
||||
EXTRA_DIST = $(pkgdata_DATA)
|
||||
|
||||
@@ -27,7 +27,7 @@ color brightblue "\<(doc|ins|exe)?into\>" "\<(f|games)(owners|perms)\>" "\<(exe|
|
||||
## Highlight common commands used in ebuilds
|
||||
color blue "\<make\>" "\<(awk|cat|cd|chmod|chown|cp|echo|env|export|find|e?grep|ln|mkdir|mv|rm|sed|set|tar|touch|unset|xargs)\>"
|
||||
## Highlight comments (doesnt work that well)
|
||||
color yellow "#.*$"
|
||||
color yellow "(^|[[:space:]])#.*$"
|
||||
## Highlight strings (doesnt work that well)
|
||||
color brightyellow ""(\\.|[^\"])*"" "'(\\.|[^'])*'"
|
||||
## Trailing space is bad!
|
||||
|
||||
8
doc/syntax/makefile.nanorc
Normal file
8
doc/syntax/makefile.nanorc
Normal file
@@ -0,0 +1,8 @@
|
||||
# unattributed syntax highlighting example from wiki.linuxhelp.net/
|
||||
|
||||
syntax "makefile" "Makefile[^/]*$"
|
||||
color red "[:=]"
|
||||
color magenta "\<(if|ifeq|else|endif)\>"
|
||||
color blue "\$+[{(][a-Z0-9_-]+[})]"
|
||||
color brightblue "^[^ ]+:"
|
||||
color green "#.*$"
|
||||
565
po/nano.pot
565
po/nano.pot
File diff suppressed because it is too large
Load Diff
565
po/pt_BR.po
565
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
565
po/zh_CN.po
565
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
565
po/zh_TW.po
565
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
30
src/chars.c
30
src/chars.c
@@ -89,7 +89,7 @@ bool is_alnum_mbchar(const char *c)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
@@ -109,7 +109,7 @@ bool is_blank_mbchar(const char *c)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
@@ -156,7 +156,7 @@ bool is_cntrl_mbchar(const char *c)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
@@ -177,7 +177,7 @@ bool is_punct_mbchar(const char *c)
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
@@ -243,14 +243,14 @@ char *control_mbrep(const char *c, char *crep, int *crep_len)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
*crep_len = bad_mbchar_len;
|
||||
strncpy(crep, bad_mbchar, *crep_len);
|
||||
} else {
|
||||
*crep_len = wctomb(crep, control_wrep(wc));
|
||||
|
||||
if (*crep_len < 0) {
|
||||
wctomb(NULL, 0);
|
||||
int shutup = wctomb(NULL, 0);
|
||||
*crep_len = 0;
|
||||
}
|
||||
}
|
||||
@@ -278,14 +278,14 @@ char *mbrep(const char *c, char *crep, int *crep_len)
|
||||
|
||||
/* Reject invalid Unicode characters. */
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0 || !is_valid_unicode(wc)) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
*crep_len = bad_mbchar_len;
|
||||
strncpy(crep, bad_mbchar, *crep_len);
|
||||
} else {
|
||||
*crep_len = wctomb(crep, wc);
|
||||
|
||||
if (*crep_len < 0) {
|
||||
wctomb(NULL, 0);
|
||||
int shutup = wctomb(NULL, 0);
|
||||
*crep_len = 0;
|
||||
}
|
||||
}
|
||||
@@ -311,7 +311,7 @@ int mbwidth(const char *c)
|
||||
int width;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
@@ -356,7 +356,7 @@ char *make_mbchar(long chr, int *chr_mb_len)
|
||||
|
||||
/* Reject invalid Unicode characters. */
|
||||
if (*chr_mb_len < 0 || !is_valid_unicode((wchar_t)chr)) {
|
||||
wctomb(NULL, 0);
|
||||
int shutup = wctomb(NULL, 0);
|
||||
*chr_mb_len = 0;
|
||||
}
|
||||
} else {
|
||||
@@ -388,7 +388,7 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
/* If buf contains an invalid multibyte character, only
|
||||
* interpret buf's first byte. */
|
||||
if (buf_mb_len < 0) {
|
||||
mblen(NULL, 0);
|
||||
int shutup = mblen(NULL, 0);
|
||||
buf_mb_len = 1;
|
||||
} else if (buf_mb_len == 0)
|
||||
buf_mb_len++;
|
||||
@@ -545,7 +545,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
s1_mb_len = parse_mbchar(s1, s1_mb, NULL);
|
||||
|
||||
if (mbtowc(&ws1, s1_mb, s1_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
ws1 = (unsigned char)*s1_mb;
|
||||
bad_s1_mb = TRUE;
|
||||
}
|
||||
@@ -553,7 +553,7 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
s2_mb_len = parse_mbchar(s2, s2_mb, NULL);
|
||||
|
||||
if (mbtowc(&ws2, s2_mb, s2_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
ws2 = (unsigned char)*s2_mb;
|
||||
bad_s2_mb = TRUE;
|
||||
}
|
||||
@@ -781,7 +781,7 @@ char *mbstrchr(const char *s, const char *c)
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
wc = (unsigned char)*c;
|
||||
bad_c_mb = TRUE;
|
||||
}
|
||||
@@ -790,7 +790,7 @@ char *mbstrchr(const char *s, const char *c)
|
||||
int s_mb_len = parse_mbchar(s, s_mb, NULL);
|
||||
|
||||
if (mbtowc(&ws, s_mb, s_mb_len) < 0) {
|
||||
mbtowc(NULL, NULL, 0);
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
ws = (unsigned char)*s;
|
||||
bad_s_mb = TRUE;
|
||||
}
|
||||
|
||||
@@ -1092,6 +1092,7 @@ char *get_full_path(const char *origpath)
|
||||
char *d_here, *d_there, *d_there_file = NULL;
|
||||
const char *last_slash;
|
||||
bool path_only;
|
||||
int shutup;
|
||||
|
||||
if (origpath == NULL)
|
||||
return NULL;
|
||||
@@ -1190,7 +1191,7 @@ char *get_full_path(const char *origpath)
|
||||
/* Finally, go back to the path specified in d_here,
|
||||
* where we were before. We don't check for a chdir()
|
||||
* error, since we can do nothing if we get one. */
|
||||
chdir(d_here);
|
||||
shutup = chdir(d_here);
|
||||
|
||||
/* Free d_here, since we're done using it. */
|
||||
free(d_here);
|
||||
|
||||
15
src/global.c
15
src/global.c
@@ -214,7 +214,7 @@ size_t length_of_list(int menu)
|
||||
}
|
||||
|
||||
/* Set type of function based on the string */
|
||||
function_type strtokeytype(char *str)
|
||||
function_type strtokeytype(const char *str)
|
||||
{
|
||||
if (str[0] == 'M' || str[0] == 'm')
|
||||
return META;
|
||||
@@ -289,7 +289,7 @@ const sc *first_sc_for(int menu, short func) {
|
||||
|
||||
/* Add a string to the new shortcut list implementation
|
||||
Allows updates to existing entries in the list */
|
||||
void add_to_sclist(int menu, char *scstring, short func, int toggle, int execute)
|
||||
void add_to_sclist(int menu, const char *scstring, short func, int toggle, int execute)
|
||||
{
|
||||
sc *s;
|
||||
|
||||
@@ -315,7 +315,7 @@ void add_to_sclist(int menu, char *scstring, short func, int toggle, int execute
|
||||
s->type = strtokeytype(scstring);
|
||||
s->menu = menu;
|
||||
s->toggle = toggle;
|
||||
s->keystr = scstring;
|
||||
s->keystr = (char *) scstring;
|
||||
s->scfunc = func;
|
||||
s->execute = execute;
|
||||
assign_keyinfo(s);
|
||||
@@ -411,7 +411,10 @@ void print_sclist(void)
|
||||
|
||||
|
||||
/* Stuff we need to make at least static here so we can access it below */
|
||||
/* TRANSLATORS: Try to keep the next five strings at most 10 characters. */
|
||||
const char *cancel_msg = N_("Cancel");
|
||||
const char *replace_msg = N_("Replace");
|
||||
const char *no_replace_msg = N_("No Replace");
|
||||
|
||||
#ifndef NANO_TINY
|
||||
const char *case_sens_msg = N_("Case Sens");
|
||||
@@ -447,8 +450,6 @@ const char *ext_cmd_msg = "";
|
||||
/* TRANSLATORS: Try to keep the next five strings at most 10 characters. */
|
||||
const char *prev_history_msg = N_("PrevHstory");
|
||||
const char *next_history_msg = N_("NextHstory");
|
||||
const char *replace_msg = N_("Replace");
|
||||
const char *no_replace_msg = N_("No Replace");
|
||||
const char *gototext_msg = N_("Go To Text");
|
||||
/* TRANSLATORS: Try to keep the next three strings at most 12 characters. */
|
||||
const char *whereis_next_msg = N_("WhereIs Next");
|
||||
@@ -490,7 +491,9 @@ void shortcut_init(bool unjustify)
|
||||
const char *fulljstify_msg = N_("FullJstify");
|
||||
#endif
|
||||
const char *refresh_msg = N_("Refresh");
|
||||
#ifndef NANO_TINY
|
||||
const char *insert_file_msg = N_("Insert File");
|
||||
#endif
|
||||
const char *go_to_line_msg = N_("Go To Line");
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -1344,7 +1347,7 @@ const subnfunc *sctofunc(sc *s)
|
||||
#ifndef NANO_TINY
|
||||
/* Now lets come up with a single (hopefully)
|
||||
function to get a string for each flag */
|
||||
char *flagtostr(int flag)
|
||||
const char *flagtostr(int flag)
|
||||
{
|
||||
switch (flag) {
|
||||
case NO_HELP:
|
||||
|
||||
43
src/move.c
43
src/move.c
@@ -50,18 +50,19 @@ void do_last_line(void)
|
||||
/* Move up one page. */
|
||||
void do_page_up(void)
|
||||
{
|
||||
int i;
|
||||
int i, skipped = 0;
|
||||
|
||||
/* If there's less than a page of text left on the screen, put the
|
||||
* cursor at the beginning of the first line of the file, and then
|
||||
* update the edit window. */
|
||||
if (openfile->current->lineno <= editwinrows - 2) {
|
||||
if (!ISSET(SOFTWRAP) && openfile->current->lineno <= editwinrows - 2) {
|
||||
do_first_line();
|
||||
return;
|
||||
}
|
||||
|
||||
/* If we're not in smooth scrolling mode, put the cursor at the
|
||||
* beginning of the top line of the edit window, as Pico does. */
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
#endif
|
||||
@@ -71,15 +72,27 @@ void do_page_up(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = editwinrows - 2; i > 0 && openfile->current !=
|
||||
openfile->fileage; i--)
|
||||
for (i = editwinrows - 2; i - skipped > 0 && openfile->current !=
|
||||
openfile->fileage; i--) {
|
||||
openfile->current = openfile->current->prev;
|
||||
if (ISSET(SOFTWRAP) && openfile->current) {
|
||||
skipped += strlenpt(openfile->current->data) / COLS;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "do_page_up: i = %d, skipped = %d based on line %ld len %d\n", i, (unsigned long) skipped,
|
||||
openfile->current->lineno, strlenpt(openfile->current->data));
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "do_page_up: openfile->current->lineno = %lu, skipped = %d\n", (unsigned long) openfile->current->lineno, skipped);
|
||||
#endif
|
||||
|
||||
/* Scroll the edit window up a page. */
|
||||
edit_scroll(UP_DIR, editwinrows - 2);
|
||||
edit_scroll(UP_DIR, editwinrows - skipped - 2);
|
||||
}
|
||||
|
||||
/* Move down one page. */
|
||||
@@ -107,15 +120,11 @@ void do_page_down(void)
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "do_page_down: maxrows = %d\n", maxrows);
|
||||
#endif
|
||||
|
||||
for (i = maxrows - 2; i > 0 && openfile->current !=
|
||||
openfile->filebot; i--) {
|
||||
openfile->current = openfile->current->next;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "do_page_down: moving to line %d\n", openfile->current->lineno);
|
||||
fprintf(stderr, "do_page_down: moving to line %lu\n", (unsigned long) openfile->current->lineno);
|
||||
#endif
|
||||
|
||||
}
|
||||
@@ -124,7 +133,7 @@ void do_page_down(void)
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window down a page. */
|
||||
edit_scroll(DOWN_DIR, maxrows - 2);
|
||||
edit_scroll(DOWN_DIR, editwinrows - 2);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -568,17 +577,7 @@ void do_down(
|
||||
openfile->placewewant);
|
||||
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
filestruct *foo;
|
||||
ssize_t extracuzsoft = 0;
|
||||
|
||||
for (foo = openfile->edittop; foo
|
||||
&& foo->lineno - openfile->edittop->lineno + extracuzsoft < editwinrows;
|
||||
foo = foo->next) {
|
||||
extracuzsoft += strlenpt(foo->data) / (COLS - 1);
|
||||
if (foo == openfile->current)
|
||||
break;
|
||||
}
|
||||
if (foo && foo->lineno - openfile->edittop->lineno + extracuzsoft >= editwinrows)
|
||||
if (openfile->current->lineno - openfile->edittop->lineno >= maxrows)
|
||||
onlastline = TRUE;
|
||||
}
|
||||
|
||||
|
||||
38
src/nano.c
38
src/nano.c
@@ -394,11 +394,7 @@ void move_to_filestruct(filestruct **file_top, filestruct **file_bot,
|
||||
/* If the top of the edit window was inside the old partition, put
|
||||
* it in range of current. */
|
||||
if (edittop_inside)
|
||||
edit_update(
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? NONE :
|
||||
#endif
|
||||
CENTER);
|
||||
edit_update(NONE);
|
||||
|
||||
/* Renumber starting with the beginning line of the old
|
||||
* partition. */
|
||||
@@ -638,7 +634,11 @@ void die(const char *msg, ...)
|
||||
if (filepart != NULL)
|
||||
unpartition_filestruct(&filepart);
|
||||
|
||||
die_save_file(openfile->filename, openfile->current_stat);
|
||||
die_save_file(openfile->filename
|
||||
#ifndef NANO_TINY
|
||||
, openfile->current_stat
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
@@ -651,7 +651,11 @@ void die(const char *msg, ...)
|
||||
|
||||
/* Save the current file buffer if it's been modified. */
|
||||
if (openfile->modified)
|
||||
die_save_file(openfile->filename, openfile->current_stat);
|
||||
die_save_file(openfile->filename
|
||||
#ifndef NANO_TINY
|
||||
, openfile->current_stat
|
||||
#endif
|
||||
);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@@ -662,7 +666,11 @@ void die(const char *msg, ...)
|
||||
|
||||
/* Save the current file under the name spacified in die_filename, which
|
||||
* is modified to be unique if necessary. */
|
||||
void die_save_file(const char *die_filename, struct stat *die_stat)
|
||||
void die_save_file(const char *die_filename
|
||||
#ifndef NANO_TINY
|
||||
, struct stat *die_stat
|
||||
#endif
|
||||
)
|
||||
{
|
||||
char *retval;
|
||||
bool failed = TRUE;
|
||||
@@ -691,6 +699,7 @@ void die_save_file(const char *die_filename, struct stat *die_stat)
|
||||
fprintf(stderr, _("\nBuffer not written: %s\n"),
|
||||
_("Too many backup files?"));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Try and chmod/chown the save file to the values of the original file, but
|
||||
dont worry if it fails because we're supposed to be bailing as fast
|
||||
as possible. */
|
||||
@@ -699,6 +708,7 @@ void die_save_file(const char *die_filename, struct stat *die_stat)
|
||||
shush = chmod(retval, die_stat->st_mode);
|
||||
shush = chown(retval, die_stat->st_uid, die_stat->st_gid);
|
||||
}
|
||||
#endif
|
||||
|
||||
free(retval);
|
||||
}
|
||||
@@ -1174,11 +1184,9 @@ RETSIGTYPE do_suspend(int signal)
|
||||
disable_mouse_support();
|
||||
#endif
|
||||
|
||||
/* Blank the screen, and move the cursor to the last line of the
|
||||
* screen. */
|
||||
erase();
|
||||
/* Move the cursor to the last line of the screen. */
|
||||
move(LINES - 1, 0);
|
||||
refresh();
|
||||
endwin();
|
||||
|
||||
/* Display our helpful message. */
|
||||
printf(_("Use \"fg\" to return to nano.\n"));
|
||||
@@ -1621,6 +1629,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
&& openfile->syntax->nmultis > 0) {
|
||||
reset_multis(openfile->current, FALSE);
|
||||
}
|
||||
#endif
|
||||
if (edit_refresh_needed) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "running edit_refresh() as edit_refresh_needed is true\n");
|
||||
@@ -1629,7 +1638,6 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
edit_refresh_needed = FALSE;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1743,7 +1751,7 @@ int do_mouse(void)
|
||||
void alloc_multidata_if_needed(filestruct *fileptr)
|
||||
{
|
||||
if (!fileptr->multidata)
|
||||
fileptr->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short));
|
||||
fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
|
||||
}
|
||||
|
||||
/* Precalculate the multi-line start and end regex info so we can speed up
|
||||
@@ -2404,10 +2412,12 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
/* Overwrite an rcfile "set nowrap" or --disable-wrapping-as-root
|
||||
if a --fill option was given on the command line. */
|
||||
if (fill_used)
|
||||
UNSET(NO_WRAP);
|
||||
#endif
|
||||
|
||||
/* If we're using bold text instead of reverse video text, set it up
|
||||
* now. */
|
||||
|
||||
@@ -1070,7 +1070,6 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
|
||||
}
|
||||
} else
|
||||
#endif /* !NANO_TINY */
|
||||
#ifndef DISABLE_HELP
|
||||
if (s && s->scfunc == DO_HELP_VOID) {
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
|
||||
@@ -1082,7 +1081,6 @@ fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answe
|
||||
* prompt. */
|
||||
finished = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If we have a shortcut with an associated function, break out
|
||||
* if we're finished after running or trying to run the
|
||||
|
||||
55
src/proto.h
55
src/proto.h
@@ -428,7 +428,11 @@ void free_openfilestruct(openfilestruct *src);
|
||||
void print_view_warning(void);
|
||||
void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename, struct stat *die_stat);
|
||||
void die_save_file(const char *die_filename
|
||||
#ifndef NANO_TINY
|
||||
, struct stat *die_stat
|
||||
#endif
|
||||
);
|
||||
void window_init(void);
|
||||
#ifndef DISABLE_MOUSE
|
||||
void disable_mouse_support(void);
|
||||
@@ -779,12 +783,12 @@ void display_main_list(void);
|
||||
void do_cursorpos(bool constant);
|
||||
void do_cursorpos_void(void);
|
||||
void do_replace_highlight(bool highlight, const char *word);
|
||||
char *flagtostr(int flag);
|
||||
const char *flagtostr(int flag);
|
||||
const subnfunc *sctofunc(sc *s);
|
||||
const subnfunc *getfuncfromkey(WINDOW *win);
|
||||
void print_sclist(void);
|
||||
sc *strtosc(int menu, char *input);
|
||||
function_type strtokeytype(char *str);
|
||||
function_type strtokeytype(const char *str);
|
||||
int strtomenu(char *input);
|
||||
void assign_keyinfo(sc *s);
|
||||
void xon_complaint(void);
|
||||
@@ -792,35 +796,36 @@ void xoff_complaint(void);
|
||||
int sc_seq_or (short func, int defaultval);
|
||||
void do_suspend_void(void);
|
||||
|
||||
const char *cancel_msg;
|
||||
extern const char *cancel_msg;
|
||||
#ifndef NANO_TINY
|
||||
const char *case_sens_msg;
|
||||
const char *backwards_msg;
|
||||
const char *prev_history_msg;
|
||||
const char *next_history_msg;
|
||||
extern const char *case_sens_msg;
|
||||
extern const char *backwards_msg;
|
||||
extern const char *prev_history_msg;
|
||||
extern const char *next_history_msg;
|
||||
#endif
|
||||
const char *replace_msg;
|
||||
const char *no_replace_msg;
|
||||
const char *go_to_line_msg;
|
||||
const char *whereis_next_msg;
|
||||
const char *first_file_msg;
|
||||
const char *last_file_msg;
|
||||
const char *goto_dir_msg;
|
||||
const char *ext_cmd_msg;
|
||||
const char *to_files_msg;
|
||||
const char *dos_format_msg;
|
||||
const char *mac_format_msg;
|
||||
const char *append_msg;
|
||||
const char *prepend_msg;
|
||||
const char *backup_file_msg;
|
||||
const char *gototext_msg;
|
||||
const char *new_buffer_msg;
|
||||
extern const char *replace_msg;
|
||||
extern const char *no_replace_msg;
|
||||
extern const char *go_to_line_msg;
|
||||
extern const char *whereis_next_msg;
|
||||
extern const char *first_file_msg;
|
||||
extern const char *last_file_msg;
|
||||
extern const char *goto_dir_msg;
|
||||
extern const char *ext_cmd_msg;
|
||||
extern const char *to_files_msg;
|
||||
extern const char *dos_format_msg;
|
||||
extern const char *mac_format_msg;
|
||||
extern const char *append_msg;
|
||||
extern const char *prepend_msg;
|
||||
extern const char *backup_file_msg;
|
||||
extern const char *gototext_msg;
|
||||
extern const char *new_buffer_msg;
|
||||
|
||||
void iso_me_harder_funcmap(short func);
|
||||
void enable_nodelay(void);
|
||||
void disable_nodelay(void);
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *regexp_msg;
|
||||
extern const char *regexp_msg;
|
||||
#endif
|
||||
|
||||
#ifdef NANO_EXTRA
|
||||
|
||||
@@ -892,7 +892,7 @@ void parse_rcfile(FILE *rcstream
|
||||
{
|
||||
char *buf = NULL;
|
||||
ssize_t len;
|
||||
size_t n;
|
||||
size_t n = 0;
|
||||
|
||||
while ((len = getline(&buf, &n, rcstream)) > 0) {
|
||||
char *ptr, *keyword, *option;
|
||||
|
||||
12
src/text.c
12
src/text.c
@@ -181,7 +181,7 @@ void do_tab(void)
|
||||
free(output);
|
||||
} else {
|
||||
#endif
|
||||
do_output("\t", 1, TRUE);
|
||||
do_output((char *) "\t", 1, TRUE);
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
@@ -483,7 +483,7 @@ void do_undo(void)
|
||||
break;
|
||||
case SPLIT:
|
||||
undidmsg = _("line wrap");
|
||||
f->data = nrealloc(f->data, strlen(f->data) + strlen(u->strdata) + 1);
|
||||
f->data = (char *) nrealloc(f->data, strlen(f->data) + strlen(u->strdata) + 1);
|
||||
strcpy(&f->data[strlen(f->data) - 1], u->strdata);
|
||||
if (u->strdata2 != NULL)
|
||||
f->next->data = mallocstrcpy(f->next->data, u->strdata2);
|
||||
@@ -517,7 +517,7 @@ void do_undo(void)
|
||||
undidmsg = _("line break");
|
||||
if (f->next) {
|
||||
filestruct *foo = f->next;
|
||||
f->data = nrealloc(f->data, strlen(f->data) + strlen(f->next->data) + 1);
|
||||
f->data = (char *) nrealloc(f->data, strlen(f->data) + strlen(f->next->data) + 1);
|
||||
strcat(f->data, f->next->data);
|
||||
unlink_node(foo);
|
||||
delete_node(foo);
|
||||
@@ -765,7 +765,7 @@ bool execute_command(const char *command)
|
||||
* arguments. */
|
||||
shellenv = getenv("SHELL");
|
||||
if (shellenv == NULL)
|
||||
shellenv = "/bin/sh";
|
||||
shellenv = (char *) "/bin/sh";
|
||||
|
||||
/* Fork a child. */
|
||||
if ((pid = fork()) == 0) {
|
||||
@@ -859,7 +859,7 @@ void add_undo(undo_type current_action)
|
||||
}
|
||||
|
||||
/* Allocate and initialize a new undo type */
|
||||
u = nmalloc(sizeof(undo));
|
||||
u = (undo *) nmalloc(sizeof(undo));
|
||||
u->type = current_action;
|
||||
u->lineno = fs->current->lineno;
|
||||
u->begin = fs->current_x;
|
||||
@@ -993,7 +993,7 @@ void update_undo(undo_type action)
|
||||
fs->current->data, (unsigned long) fs->current_x, u->begin);
|
||||
#endif
|
||||
len = strlen(u->strdata) + 2;
|
||||
data = nrealloc((void *) u->strdata, len * sizeof(char *));
|
||||
data = (char *) nrealloc((void *) u->strdata, len * sizeof(char *));
|
||||
data[len-2] = fs->current->data[fs->current_x];
|
||||
data[len-1] = '\0';
|
||||
u->strdata = (char *) data;
|
||||
|
||||
20
src/winio.c
20
src/winio.c
@@ -2495,7 +2495,7 @@ void edit_draw(filestruct *fileptr, const char *converted, int
|
||||
if (fileptr->multidata == NULL && openfile->syntax
|
||||
&& openfile->syntax->nmultis > 0) {
|
||||
int i;
|
||||
fileptr->multidata = nmalloc(openfile->syntax->nmultis * sizeof(short));
|
||||
fileptr->multidata = (short *) nmalloc(openfile->syntax->nmultis * sizeof(short));
|
||||
for (i = 0; i < openfile->syntax->nmultis; i++)
|
||||
fileptr->multidata[i] = -1; /* Assue this applies until we know otherwise */
|
||||
}
|
||||
@@ -2949,7 +2949,8 @@ void compute_maxrows(void)
|
||||
|
||||
maxrows = 0;
|
||||
for (n = 0; n < editwinrows && foo; n++) {
|
||||
maxrows += 1 - strlenpt(foo->data) / COLS;
|
||||
maxrows ++;
|
||||
n += strlenpt(foo->data) / COLS;
|
||||
foo = foo->next;
|
||||
}
|
||||
|
||||
@@ -3037,6 +3038,9 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
break;
|
||||
openfile->edittop = openfile->edittop->next;
|
||||
}
|
||||
/* Don't over-scroll on long lines */
|
||||
if (ISSET(SOFTWRAP))
|
||||
i -= strlenpt(openfile->edittop->data) / COLS;
|
||||
}
|
||||
|
||||
compute_maxrows();
|
||||
@@ -3156,11 +3160,7 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
/* Put edittop in range of current, get the difference in lines
|
||||
* between the original edittop and the current edittop, and
|
||||
* then restore the original edittop. */
|
||||
edit_update(
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? NONE :
|
||||
#endif
|
||||
CENTER);
|
||||
edit_update(NONE);
|
||||
|
||||
nlines = openfile->edittop->lineno - old_edittop->lineno;
|
||||
|
||||
@@ -3239,11 +3239,7 @@ void edit_refresh(void)
|
||||
|
||||
/* Put the top line of the edit window in range of the current
|
||||
* line. */
|
||||
edit_update(
|
||||
#ifndef NANO_TINY
|
||||
ISSET(SMOOTH_SCROLL) ? NONE :
|
||||
#endif
|
||||
CENTER);
|
||||
edit_update(NONE);
|
||||
}
|
||||
|
||||
foo = openfile->edittop;
|
||||
|
||||
Reference in New Issue
Block a user