Compare commits

...

23 Commits

Author SHA1 Message Date
Chris Allegretta
cb9a5bed8e GNU nano 2.2.0 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4450 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-30 05:26:30 +00:00
Chris Allegretta
b43f6912f3 2009-11-29 David Lawrence Ramsey <pooka109@gmail.com>
* 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



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4449 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-29 06:24:10 +00:00
Chris Allegretta
5a018f0d3a 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.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4448 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-29 06:13:22 +00:00
Chris Allegretta
752830573a * doc/dyntax/makefile.nanorc - Sample Makefile highlighting based on wiki.linuxhelp.net version.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4447 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-28 04:11:04 +00:00
Chris Allegretta
daaf468c93 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>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4446 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-28 03:01:30 +00:00
Chris Allegretta
dcf5cbbf6a * rcfile.c (parse_rcfile), initialize size argument to getline(), fixes crash on FreeBSD
reported by Eitan Adler <eitanadlerlist@gmail.com>.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4445 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-27 05:09:56 +00:00
Chris Allegretta
3b830ee194 2009-11-26 Chris Allegretta <chrisa@asty.org>
* winio.c (edit_scroll): Adjust for long lines when scrolling.                    



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4444 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-27 03:04:59 +00:00
Chris Allegretta
d753efdb55 2009-11-26 Jordi Mallach <jordi@gnu.org>
* doc/man/*: Update all man pages to escape unescapred hyphens.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4443 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-27 02:50:12 +00:00
Chris Allegretta
c9199e9e9a Simplify logic in do_down() since we now have maxrows to rely on.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4442 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-26 18:23:00 +00:00
Chris Allegretta
e2df2c899d 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.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4441 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-24 17:15:53 +00:00
Chris Allegretta
c82f038855 Part 2 of David's fixes for David's bug 71 fix
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4440 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-22 23:23:31 +00:00
Chris Allegretta
8b6f6fcc1b 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



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4439 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-22 21:35:56 +00:00
Chris Allegretta
0bff84ef9c 2009-11-22 Mike Frysinger <vapier@gentoo.org>
* doc/syntax/gentoo.nanorc: Tweak comment highlighting.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4438 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-22 16:36:53 +00:00
Chris Allegretta
6277f59d24 Back to SVN!
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4437 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-22 02:52:23 +00:00
Chris Allegretta
6c3d886424 GNU nano 2.1.99pre2 release
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4435 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-22 02:49:39 +00:00
Chris Allegretta
879dfbaf40 * prompt.c (update_statusbar_line): Set statusbar_pww when updating the line.
Fixes Savannah bug 24957 by Mike Frysinger.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4434 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-21 17:12:28 +00:00
Chris Allegretta
e9dee887a9 2009-11-21 Chris Allegretta <chrisa@asty.org>
* rcfile.c: Add unbinding keyword, fixes Savannah bug 22852 reported by frankd.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4433 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-21 16:26:59 +00:00
Chris Allegretta
123110c5dc 2009-11-19 Chris Allegretta <chrisa@asty.org>
* nano.c (die_save_file) Try nd match the permissions of the file we were
          editing but only make a minimal effort to do so. Fixes Savannah bug 27273     
          reported by Mike Frysinger.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4432 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-20 05:09:12 +00:00
Chris Allegretta
cbba77558e Typo fix part 2, noticed by j.mader@gmail.com.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4431 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-18 22:10:13 +00:00
Chris Allegretta
e350d7a52a Back to svn, oops.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4430 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-18 21:34:09 +00:00
Chris Allegretta
16e07d5878 2009-11-18 Adrian Bunk <bunk via Savannah>
* nano.c (main) - Allow --fill and --nowrap to override nanorc entries and each other
          on the command line.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4429 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-18 12:39:47 +00:00
Chris Allegretta
8c1edd17e3 Further fixes, also fix some page/up down issues where we go way off course.
git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4428 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-16 04:28:40 +00:00
Chris Allegretta
fc48347fb8 2009-11-15 Chris Allegretta <chrisa@asty.org>
* winio.c (edit_refresh): Always computer maxsize regardless of whether smooth scrolling
          is enabled.  Fixes Savannah bug 28024 by Mike Frysinger.



git-svn-id: svn://svn.savannah.gnu.org/nano/trunk/nano@4427 35c25a1d-7b9e-4130-9fde-d3aeb78583b8
2009-11-16 00:15:45 +00:00
54 changed files with 10324 additions and 10061 deletions

2
BUGS
View File

@@ -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$

View File

@@ -1,3 +1,66 @@
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.
* prompt.c (update_statusbar_line): Set statusbar_pww when updating the line.
Fixes Savannah bug 24957 by Mike Frysinger.
2009-11-19 Chris Allegretta <chrisa@asty.org>
* nano.c (die_save_file) Try nd match the permissions of the file we were
editing but only make a minimal effort to do so. Fixes Savannah bug 27273
reported by Mike Frysinger.
2009-11-18 Adrian Bunk <bunk via Savannah>
* nano.c (main): Allow --fill and --nowrap to override nanorc entries and each other
on the command line.
2009-11-15 Chris Allegretta <chrisa@asty.org>
* winio.c (edit_refresh): Always computer maxsize regardless of whether smooth scrolling
is enabled. Fixes Savannah bug 28024 by Mike Frysinger.
GNU nano 2.1.99pre1 - 2009.11.15
2009-11-14 Chris Allegretta <chrisa@asty.org>
* move.c (do_first_line, do_last_line): Just set edit_refresh_needed rather than

33
NEWS
View File

@@ -1,3 +1,36 @@
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
caused by the soft wrapping code, and a fix for
a long standing issue with hittig the home key when
going through the search history. On the features
front, nano will now attempt to retain the proper
ownership and permissions when trying to create a
.save file due to receiving a signal. Nano can also
now unbind keys from one or more menus via the 'unbind'
keyword. Finally, passing --fill or --nowrap on
the command line will now override any related
.nanorc entries. Speak now or forever hold your bugs!
2009.11.15 - GNU nano 2.1.99pre1 "take a bow" is out there, man, it's
out there all right. This release contains mainly
bugfixes, underscoring that we are preparing for the

View File

@@ -20,7 +20,7 @@
#
# $Id$
AC_INIT([GNU nano], [2.1.99pre1], [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])

View File

@@ -116,7 +116,7 @@
<blockquote><p>For the 'bleeding edge' current version of nano, you can use subversion to download the current source code. <b>Note:</b> believe it or not, by downloading code that has not yet stabilized into an official release, there could quite possibly be bugs, in fact the code may not even compile! Anyway, see <a href="http://svn.savannah.gnu.org/viewvc/trunk/nano/README.SVN?root=nano&view=markup">the nano SVN document</a> for info on anonymous SVN access to the nano source.</p></blockquote>
<hr width="100%">
<h1><a name="3"></a>3. Installation and Configuration</h1>
<h2><a name="3.1"></a>3.1. How do install the RPM or DEB package?</h2>
<h2><a name="3.1"></a>3.1. How do I install the RPM or DEB package?</h2>
<blockquote><p>It's simple really! As root, type <b>rpm -Uvh nano-x.y.z-1.i386.rpm</b> if you have a RedHat-ish system or <b>dpkg -i nano_x.y.z-1.deb</b> if you have a Debian-ish system, where <b>x.y.z</b> is the release of nano. There are other programs to install packages, and if you wish to use those, knock yourself out.</p></blockquote>
<h2><a name="3.2"></a>3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</h2>
<blockquote><p>Okay, take a deep breath, this really isn't hard. Unpack the nano source with a command like:</p>

View File

@@ -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.

View File

@@ -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

View File

@@ -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.

View File

@@ -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.
@@ -534,6 +534,13 @@ The 'go to directory' menu.
.TP
.B all
A special name meaning: apply to all menus where this function exists.
.TP
.B unbind \fIkey\fP \fImenu\fP
Unbind the key \fIkey\fP from the menu named \fImenu\fP or from all
menus by using \fIall\fP. Same key syntax as for binding.
Rebinds the key \fIkey\fP to a new function named \fIfunction\fP in the
context of menu \fImenu\fP. The format of \fIkey\fP should be one of:
.SH FILES
.TP
.I SYSCONFDIR/nanorc

View File

@@ -238,6 +238,9 @@
## C/C++
# include "@PKGDATADIR@/c.nanorc"
## Makefiles
# include "@PKGDATADIR@/makefile.nanorc"
## Cascading Style Sheets
# include "@PKGDATADIR@/css.nanorc"

View File

@@ -22,6 +22,7 @@ pkgdata_DATA = asm.nanorc \
xml.nanorc \
ocaml.nanorc \
objc.nanorc \
fortran.nanorc
fortran.nanorc \
makefile.nanorc
EXTRA_DIST = $(pkgdata_DATA)

View File

@@ -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!

View 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 "#.*$"

635
po/bg.po

File diff suppressed because it is too large Load Diff

635
po/ca.po

File diff suppressed because it is too large Load Diff

713
po/cs.po

File diff suppressed because it is too large Load Diff

635
po/da.po

File diff suppressed because it is too large Load Diff

635
po/de.po

File diff suppressed because it is too large Load Diff

635
po/es.po

File diff suppressed because it is too large Load Diff

635
po/eu.po

File diff suppressed because it is too large Load Diff

635
po/fi.po

File diff suppressed because it is too large Load Diff

647
po/fr.po

File diff suppressed because it is too large Load Diff

635
po/ga.po

File diff suppressed because it is too large Load Diff

635
po/gl.po

File diff suppressed because it is too large Load Diff

635
po/hu.po

File diff suppressed because it is too large Load Diff

635
po/id.po

File diff suppressed because it is too large Load Diff

635
po/it.po

File diff suppressed because it is too large Load Diff

635
po/ms.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

635
po/nb.po

File diff suppressed because it is too large Load Diff

635
po/nl.po

File diff suppressed because it is too large Load Diff

693
po/nn.po

File diff suppressed because it is too large Load Diff

635
po/pl.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

635
po/ro.po

File diff suppressed because it is too large Load Diff

635
po/ru.po

File diff suppressed because it is too large Load Diff

697
po/rw.po

File diff suppressed because it is too large Load Diff

635
po/sr.po

File diff suppressed because it is too large Load Diff

635
po/sv.po

File diff suppressed because it is too large Load Diff

635
po/tr.po

File diff suppressed because it is too large Load Diff

635
po/uk.po

File diff suppressed because it is too large Load Diff

635
po/vi.po

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -66,6 +66,8 @@ WINDOW *bottomwin;
* messages, the statusbar prompt, and a list of shortcuts. */
int editwinrows = 0;
/* How many rows does the edit window take up? */
int maxrows = 0;
/* How many usable lines are there (due to soft wrapping) */
filestruct *cutbuffer = NULL;
/* The buffer where we store cut text. */
@@ -212,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;
@@ -287,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;
@@ -313,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);
@@ -409,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");
@@ -445,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");
@@ -488,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
@@ -1342,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:

View File

@@ -29,7 +29,7 @@
/* Move to the first line of the file. */
void do_first_line(void)
{
openfile->current = openfile->fileage;
openfile->current = openfile->edittop = openfile->fileage;
openfile->current_x = 0;
openfile->placewewant = 0;
@@ -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. */
@@ -90,7 +103,7 @@ void do_page_down(void)
/* If there's less than a page of text left on the screen, put the
* cursor at the beginning of the last line of the file, and then
* update the edit window. */
if (openfile->current->lineno + editwinrows - 2 >=
if (openfile->current->lineno + maxrows - 2 >=
openfile->filebot->lineno) {
do_last_line();
return;
@@ -107,9 +120,14 @@ void do_page_down(void)
}
#endif
for (i = editwinrows - 2; i > 0 && openfile->current !=
openfile->filebot; i--)
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 %lu\n", (unsigned long) openfile->current->lineno);
#endif
}
openfile->current_x = actual_x(openfile->current->data,
openfile->placewewant);
@@ -559,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;
}

View File

@@ -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);
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);
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)
void die_save_file(const char *die_filename
#ifndef NANO_TINY
, struct stat *die_stat
#endif
)
{
char *retval;
bool failed = TRUE;
@@ -691,6 +699,17 @@ void die_save_file(const char *die_filename)
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. */
if (die_stat) {
int shush;
shush = chmod(retval, die_stat->st_mode);
shush = chown(retval, die_stat->st_uid, die_stat->st_gid);
}
#endif
free(retval);
}
@@ -1165,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"));
@@ -1612,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");
@@ -1620,7 +1638,6 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
edit_refresh_needed = FALSE;
}
#endif
}
}
}
@@ -1734,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
@@ -2263,6 +2280,11 @@ int main(int argc, char **argv)
#ifndef DISABLE_WRAPPING
case 'w':
SET(NO_WRAP);
/* If both --fill and --nowrap are given on the command line,
the last option wins, */
fill_used = FALSE;
break;
#endif
case 'x':
@@ -2390,6 +2412,13 @@ 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. */
if (ISSET(BOLD_TEXT))

View File

@@ -868,7 +868,7 @@ void update_statusbar_line(const char *curranswer, size_t index)
free(expanded);
wattroff(bottomwin, reverse_attr);
statusbar_pww = statusbar_xplustabs();
reset_statusbar_cursor();
wnoutrefresh(bottomwin);
}
@@ -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

View File

@@ -46,6 +46,7 @@ extern WINDOW *topwin;
extern WINDOW *edit;
extern WINDOW *bottomwin;
extern int editwinrows;
extern int maxrows;
extern filestruct *cutbuffer;
extern filestruct *cutbottom;
@@ -427,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);
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);
@@ -778,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);
@@ -791,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

View File

@@ -454,7 +454,6 @@ void parse_keybinding(char *ptr)
return;
}
/* now let's have some fun. Try and delete the other entries
we found for the same menu, then make this new new
beginning */
@@ -470,6 +469,70 @@ void parse_keybinding(char *ptr)
sclist = newsc;
}
/* Let user unbind a sequence from a given (or all) menus */
void parse_unbinding(char *ptr)
{
char *keyptr = NULL, *keycopy = NULL, *menuptr = NULL;
sc *s;
int i, menu;
assert(ptr != NULL);
if (*ptr == '\0') {
rcfile_error(N_("Missing key name"));
return;
}
keyptr = ptr;
ptr = parse_next_word(ptr);
keycopy = mallocstrcpy(NULL, keyptr);
for (i = 0; i < strlen(keycopy); i++)
keycopy[i] = toupper(keycopy[i]);
#ifdef DEBUG
fprintf(stderr, "Starting unbinding code");
#endif
if (keycopy[0] != 'M' && keycopy[0] != '^' && keycopy[0] != 'F' && keycopy[0] != 'K') {
rcfile_error(
N_("keybindings must begin with \"^\", \"M\", or \"F\""));
return;
}
menuptr = ptr;
ptr = parse_next_word(ptr);
if (!strcmp(menuptr, "")) {
rcfile_error(
/* Note to translators, do not translate the word "all"
in the sentence below, everything else is fine */
N_("Must specify menu to bind key to (or \"all\")"));
return;
}
menu = strtomenu(menuptr);
if (menu < 1) {
rcfile_error(
N_("Could not map name \"%s\" to a menu"), menuptr);
return;
}
#ifdef DEBUG
fprintf(stderr, "unbinding \"%s\" from menu = %d\n", keycopy, menu);
#endif
/* Now find the apropriate entries in the menu to delete */
for (s = sclist; s != NULL; s = s->next) {
if (((s->menu & menu)) && !strcmp(s->keystr,keycopy)) {
s->menu &= ~menu;
#ifdef DEBUG
fprintf(stderr, "deleted menu entry %d\n", s->menu);
#endif
}
}
}
/* Read and parse additional syntax files. */
void parse_include(char *ptr)
@@ -829,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;
@@ -895,6 +958,8 @@ void parse_rcfile(FILE *rcstream
parse_colors(ptr, TRUE);
else if (strcasecmp(keyword, "bind") == 0)
parse_keybinding(ptr);
else if (strcasecmp(keyword, "unbind") == 0)
parse_unbinding(ptr);
#endif /* ENABLE_COLOR */
else
rcfile_error(N_("Command \"%s\" not understood"), keyword);

View File

@@ -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;

View File

@@ -41,9 +41,6 @@ static bool disable_cursorpos = FALSE;
/* Should we temporarily disable constant cursor position
* display? */
static int maxrows = 0;
/* With soft wrapping, how many lines really fit on the curent page */
/* Control character compatibility:
*
* - NANO_BACKSPACE_KEY is Ctrl-H, which is Backspace under ASCII, ANSI,
@@ -2498,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 */
}
@@ -2945,16 +2942,24 @@ void compute_maxrows(void)
int n;
filestruct *foo = openfile->edittop;
if (!ISSET(SOFTWRAP)) {
maxrows = editwinrows;
return;
}
maxrows = 0;
for (n = 0; n < editwinrows && foo; n++) {
maxrows += 1 - strlenpt(foo->data) / COLS;
maxrows ++;
n += strlenpt(foo->data) / COLS;
foo = foo->next;
}
if (n < editwinrows)
maxrows += editwinrows - n;
#ifdef DEBUG
fprintf(stderr, "compute_maxrows(): maxrows = %ld\n", maxrows);
#endif
}
/* Scroll the edit window in the given direction and the given number
@@ -3033,8 +3038,12 @@ 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();
/* Limit nlines to the number of lines we could scroll. */
nlines -= i;
@@ -3151,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;
@@ -3173,8 +3178,6 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
else
edit_scroll(DOWN_DIR, nlines);
compute_maxrows();
#ifndef NANO_TINY
/* If the mark is on, update all the lines between the old first
* line or old last line of the edit window (depending on
@@ -3224,19 +3227,20 @@ void edit_refresh(void)
int nlines;
/* Figure out what maxrows should really be */
if (ISSET(SOFTWRAP) && openfile->current->lineno > openfile->edittop->lineno)
compute_maxrows();
compute_maxrows();
if (openfile->current->lineno < openfile->edittop->lineno ||
openfile->current->lineno >= openfile->edittop->lineno +
maxrows)
maxrows) {
#ifdef DEBUG
fprintf(stderr, "edit_refresh(): line = %d, edittop %d + maxrows %d\n", openfile->current->lineno, openfile->edittop->lineno, maxrows);
#endif
/* 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;
@@ -3275,21 +3279,22 @@ void edit_update(update_type location)
* screen as before, or at the top or bottom of the screen if
* edittop is beyond either. */
if (location == CENTER)
goal = editwinrows / 2;
goal = maxrows / 2;
else {
goal = openfile->current_y;
/* Limit goal to (editwinrows - 1) lines maximum. */
if (goal > editwinrows - 1)
goal = editwinrows - 1;
if (goal > maxrows - 1)
goal = maxrows - 1;
}
for (; goal > 0 && foo->prev != NULL; goal--) {
if (ISSET(SOFTWRAP))
goal -= strlenpt(foo->data) / COLS;
goal -= 1 + strlenpt(foo->data) / COLS;
foo = foo->prev;
}
openfile->edittop = foo;
compute_maxrows();
}
/* Unconditionally redraw the entire screen. */