Compare commits
56 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9b1c868326 | ||
|
|
14d7c5de2a | ||
|
|
7a1b1ff5be | ||
|
|
461519cce7 | ||
|
|
0acca27ac7 | ||
|
|
86be3af75f | ||
|
|
0dcfa1d7f7 | ||
|
|
a2c5172db3 | ||
|
|
29e2012267 | ||
|
|
c859049041 | ||
|
|
db9d983646 | ||
|
|
181c4a999b | ||
|
|
053fabd4e1 | ||
|
|
ad8476eb7d | ||
|
|
7f61a6cb79 | ||
|
|
dbbf9a052f | ||
|
|
83a0e9013e | ||
|
|
e68616b799 | ||
|
|
9e73aeb10f | ||
|
|
0d1381adf9 | ||
|
|
cdb5b16198 | ||
|
|
35b5976e69 | ||
|
|
fe2042da8a | ||
|
|
091d5f3b0a | ||
|
|
08273aa1b2 | ||
|
|
b5e7647028 | ||
|
|
42bd871af3 | ||
|
|
f81d6fe8d3 | ||
|
|
1456a10ace | ||
|
|
8ff7f33c52 | ||
|
|
3eacb857a1 | ||
|
|
2466d933c9 | ||
|
|
4e621b5f6b | ||
|
|
b916f5cd8b | ||
|
|
6cf05d487f | ||
|
|
1a7a91b779 | ||
|
|
df8c3debc8 | ||
|
|
374216fe22 | ||
|
|
fc6ef3e1e8 | ||
|
|
8d41fb8c3e | ||
|
|
3c7dda6e7e | ||
|
|
869aca4392 | ||
|
|
d9be86f45b | ||
|
|
9c0716a73a | ||
|
|
560a8cd0ec | ||
|
|
a8bc492b8a | ||
|
|
f387f33083 | ||
|
|
2c7b506fbc | ||
|
|
5b25e07744 | ||
|
|
b27b3a18a9 | ||
|
|
96466166f1 | ||
|
|
671b2d974c | ||
|
|
c9f0799791 | ||
|
|
42a390416e | ||
|
|
8a07a96eef | ||
|
|
a97cb819f2 |
187
ChangeLog
187
ChangeLog
@@ -1,6 +1,191 @@
|
||||
GNU nano 2.2.5 - 2010.08.05
|
||||
2010-08-04 Lauri Kasanen <curaga@operamail.comcuraga@operamail.com>
|
||||
* doc/syntax/mgp.nanorc: New Magicpoint syntax highlighting definition
|
||||
|
||||
2010-08-04 Peter <exodus@savannah>
|
||||
* doc/syntax/tex.nanorc: No longer highlight escaped comments
|
||||
|
||||
2010-06-20 Chris Allegretta <chrisa@asty.org>
|
||||
* New rc file option allow_insecure_backup, allows the previous security
|
||||
fixes for backup files to be overridden if you're really positive
|
||||
you want to. Fixes Savannah bug 29732 by Brian Szymanski <skibrianski>.
|
||||
|
||||
2010-05-23 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (write_file): Don't even try to chown() the backup
|
||||
file unless we're root, since it's probably going to fail if
|
||||
we're editing a file we don't own. Fixes Savannah bug
|
||||
29514: [nano 2.2.2] backup should ignore chown errors.
|
||||
|
||||
GNU nano 2.2.4 - 2010.04.15
|
||||
2010-04-07 Chris Allegretta <chrisa@asty.org>
|
||||
* doc/man/nano.1,nanorc.5: Remove the backup file warnings now
|
||||
that a sufficient security fix exists for the backup file code.
|
||||
|
||||
2010-04-14 Chris Allegretta <chrisa@asty.org>
|
||||
* text.c (do_alt_speller): Skip invoking the alt speller if the file size
|
||||
is 0 bytes. Fixes Savannah bug 29393 reported by Mike Frysinger.
|
||||
* files.c (wirte_file): Don't set current_stat when tmp == TRUE, check
|
||||
whether current_stat is set when trying to use it, and don't do the
|
||||
modification check if the filename changed, since we have no way
|
||||
of knowing about it in that case. Fixes Savannah bug 29392, reported
|
||||
by Mike Frysinger. [CVE-2010-1160]
|
||||
|
||||
2010-04-13 Felipe Bugno <necron@bol.com.br>
|
||||
* doc/syntax/cmake.nanorc: Added cmake syntax highlighting file.
|
||||
|
||||
2010-04-09 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (do_writeout): Better security fixes for backup file writing,
|
||||
mangled from submission by Dan Rosenberg <dan.j.rosenberg at gmail>
|
||||
[CVE-2010-1161]
|
||||
|
||||
2010-04-08 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (do_writeout): Previous fixes should not cause a crash
|
||||
when saving a new file. Discovered by Mike Frysinger <vapier@gentoo.org>.
|
||||
|
||||
2010-04-07 Chris Allegretta <chrisa@asty.org>
|
||||
* doc/man/nano.1,nanorc.5: Add warnings about using backup
|
||||
mode as root due to the Dan Rosenberg security analysis.
|
||||
|
||||
2010-04-02 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (do_writeout): Expand modification check to include both the
|
||||
original file's device ID and inode number as reasons to warn the
|
||||
user that the file has been modified. Also abort on writing a backup
|
||||
file when its owner doesn't match the edited file. Based on security
|
||||
analysis on nano by Dan Rosenberg. [CVE-2010-1160]
|
||||
|
||||
|
||||
2010-03-21 Chris Allegretta <chrisa@asty.org>
|
||||
* nano.c (page_stdin et al): Don't attempt to reset/reopen the terminal
|
||||
settings when reading stdin if it was aborted with SIGINT. May fix Savannah
|
||||
bug 29114 reported by Mike Frysinger.
|
||||
|
||||
2010-03-21 Mike Frysinger <vapier@gentoo.org>
|
||||
* doc/syntax/c.nanorc: Add additional support for #include_next and #pragma
|
||||
|
||||
2010-03-21 Chris Allegretta <chrisa@asty.org>
|
||||
* move.c (do_page_up, do_page_down()): Explicitly set current_y to 0 when paging
|
||||
up when not in smooth scroll mode, as previous fixes would otherwise cause
|
||||
the cursor to not really be moved to the stop of the screen.
|
||||
|
||||
2010-03-07 Chris Allegretta <chrisa@asty.org>
|
||||
* configure.ac, nano.c (handle_sigwinch): Create check for whether LINES and
|
||||
COLS can safely be redefined. Fixes compilation issues with cygwin, and likely
|
||||
with newer versions of ncurses, fixes Savannah bug 28984 repoted by Andy Koppe
|
||||
and Eric Oliver via mailing list.
|
||||
* winio.c (get_mouseinput) - fix stray semicolon in code, also reported in
|
||||
bug 28984.
|
||||
|
||||
GNU nano 2.2.3 - 2010.02.11
|
||||
2010-01-28 Chris Allegretta <chrisa@asty.org>
|
||||
* move.c (do_page_up, do_page_down): Fix for smooth mode not preserving cusor
|
||||
position. Part one of fix for Savannah bug 21178 by Mike Frysinger.
|
||||
|
||||
GNU nano 2.2.2 - 2010.01.17
|
||||
2010-01-17 Chris Allegretta <chrisa@asty.org>
|
||||
* nano.c (main), prompt.c (do_statusbar_input): Handle problems with an unmapped
|
||||
function due to key rebinding, fixes crashes on FreeBSD repoted by Eitan
|
||||
Adler <eitanadlerlist@gmail.com>.
|
||||
|
||||
2010-01-14 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (do_writeout): Fix for crash / incorrect external modification warning
|
||||
due to earlier fix in r4467.
|
||||
|
||||
2010-01-12 Chris Allegretta <chrisa@asty.org>
|
||||
* move.c (do_page_up, do_page_down): Fix issues with not enough scrolling down/up
|
||||
and cursor centering.
|
||||
* winio.c (edit_scroll): Remove lots of needless checking of line length for
|
||||
soft wrapping code.
|
||||
* winio.c (edit_update) - Remove extra code for when updating with old_current outside
|
||||
of the new buffer boundary and centering issues.
|
||||
|
||||
2010-01-05 Tito <farmatito@tiscali.it>
|
||||
* search.c (update_history): Fix bad length check causing search crash on armel platform.
|
||||
|
||||
2010-01-04 Chris Allegretta <chrisa@asty.org>
|
||||
* winio.c: edit_update, edit_redraw: Fix search not scrolling to the middle of the screen
|
||||
(reported by alpha@qzx.com) and places where we rely on maxrows but should not.
|
||||
|
||||
2009-12-26 Jordi Mallach <jordi@gnu.org>
|
||||
* doc/man/nano.1: Avoid a groff warning by prepending a zero-width
|
||||
space to a line starting with '.
|
||||
|
||||
2009-12-22 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (write_file): Fix compatibility with previous stat fix and tiny mode.
|
||||
|
||||
2009-12-22 David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* global.c: Add new strings for forward/back in the file browser. New variables
|
||||
nano_forwardfile_msg and nano_backfile_msg.
|
||||
|
||||
2009-12-20 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (is_file_writable): remove assert check for f, since it's not
|
||||
initialized at the time. Fixes Savannah bug 28309, reported by Zoltan Kovacs.
|
||||
|
||||
2009-12-20 Brian Szymanski <skibrianski via Savannah>
|
||||
* src/files.c (write_file): Check stat struct exists, and if not use just obtained stat data.
|
||||
Fixes Ubuntu bug 471568, "reproducible crash in nano on trying to save to a file
|
||||
different than the one specified on the command line".
|
||||
|
||||
2009-12-15 Chris Allegretta <chrisa@asty.org>
|
||||
* doc/nanorc.sample.in - Remove erroneous 'set suspendenable' as it's actually a
|
||||
key binding (e.g. 'bind M-Z suspendenable all') and not a settable flag. Fixes
|
||||
Savannah bug 28299 reported by Mike Frysinger.
|
||||
|
||||
GNU nano 2.2.1 - 2009.12.12
|
||||
2009-12-12 Chris Allegretta <chrisa@asty.org>
|
||||
* text.c (do_delete), nano.c (do_output): Add check for length of current line
|
||||
before and after adding/deleting text, and do full refresh if it is now
|
||||
a different multiple of COLS. Also get rid of superfluous do_refresh
|
||||
vars now that we have edit_refresh_needed.
|
||||
|
||||
2009-12-09 David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* global.c (shortcut_init), browser.c (do_browser): Fix M-W not being bound to
|
||||
research in either main menu or browser.
|
||||
|
||||
2009-12-09 Chris Allegretta <chrisa@asty.org>
|
||||
* files.c (read_file) - Add parameter for whether we should even try to check
|
||||
file writability, as the message is useless when we're inserting into an
|
||||
existing buffer. Fixes Savannah bug 28219.
|
||||
|
||||
2009-12-07 David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* global.c (shortcut_init): Many fixes for keybindings code oversights, including
|
||||
restore page up/down and GotoDir to browser,
|
||||
* browser.c (do_browser): Fix breaking out of a submenu (e.g. gotodir) breaks out
|
||||
of browser altogether.
|
||||
* doc/nanorc.sample.in: Add missing entries for fortran/ObjC/OCaml entries.
|
||||
|
||||
2009-12-03 David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* global.c (shortcut_init) - Remove help shortcut from help shortcut list :-) Tweaked
|
||||
to reorder exit shortcut to end of list to not mess up prev/next shortcut symmetry.
|
||||
|
||||
2009-12-03 Eitan Adler <eitanadlerlist@gmail.com>
|
||||
* doc/syntax/makefile.nanorc - Fix poor regex for all alpha characters which sometimes leads to
|
||||
error messages, reported by gibboris@gmail.com.
|
||||
|
||||
2009-12-02 Chris Allegretta <chrisa@asty.org>
|
||||
* text.c (add_undo, do_undo, do_redo) - Do not execute cases for SPLIT when DISABLE_WRAPPING
|
||||
is defined. Fixes Savannah bug 28151 (anon).
|
||||
|
||||
2009-12-02 Jordi Mallach <jordi@gnu.org>
|
||||
* doc/man/nano.1: Fix escaping of hyphens for the -$ option.
|
||||
|
||||
2009-12-01 Kamil Dudka <kdudka@redhat.com>
|
||||
* chars.c, file.c - Better handle unused results for things like mbtowc(), new
|
||||
macro IGNORE_CALL_RESULT.
|
||||
|
||||
2009-12-01 Chris Allegretta <chrisa@asty.org>
|
||||
* global.c (shortcut_init) - Remove redundant entries for ^Y/^V reported by
|
||||
Christian Weisgerber.
|
||||
* doc/man/nanorc.5 - Fix typo in Meta documentation, reported by gibboris@gmail.com.
|
||||
|
||||
2009-12-01 David Lawrence Ramsey <pooka109@gmail.com>
|
||||
* global.c (shortcut_init) - Add support for ^P and ^N in the help menu.
|
||||
* Update documentation for 2.2 features including sample nanorc file, texinfo
|
||||
file, man pages, UPGRADE file, and update copyright noticed for the current year.
|
||||
|
||||
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
|
||||
* 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.
|
||||
|
||||
|
||||
68
NEWS
68
NEWS
@@ -1,3 +1,71 @@
|
||||
2010.08.05 - GNU nano 2.2.5 "Inactivity timeout" is now available.
|
||||
This release includes slightly less restrictive checkng
|
||||
when writing files in strange environments (e.g.
|
||||
when being used out of crontab). For very strange situations
|
||||
(such as where you cannot change the permissions on the
|
||||
file you're writing, there is a new rc file option
|
||||
"allow_insecure_backup" to be even more permission and
|
||||
allowing the write to proceed. Also included are
|
||||
some syntax highlighting updated, and that is about it.
|
||||
Keep fighting the good fight children.
|
||||
|
||||
2010.04.15 - GNU nano 2.2.4 is nobody's fool. First and foremost,
|
||||
this relase includes some security fixes due to
|
||||
an assessment of nano's vulnerability to symlink attacks
|
||||
on open files. The CVEs fixed with this release are
|
||||
CVE-2010-1160 and CVE-2010-1161. Also included are fixes
|
||||
for various crash modes when using the spell checker
|
||||
on new files in multibuffer mode (surely you've used
|
||||
that combination recently? No?) as well as a fixing
|
||||
the 'file was modified' message when saving to a
|
||||
new filename (since how would nano know?). And
|
||||
the list would not be complete without our
|
||||
third-times-the-charm fixes to page up/down due to
|
||||
the soft wrapping code. The lone new feature
|
||||
included is a new syntax higlighting definition for
|
||||
cmake-related files. Please do consider upgrading to
|
||||
this release if still using the 2.0 series since
|
||||
fixes for that version are still forthcoming.
|
||||
|
||||
|
||||
2010.02.11 - GNU nano 2.2.3 "fumbling toward stability" is released.
|
||||
This release contains a fix for only one bug, but a
|
||||
rather irritating one: when paging up/down with smooth
|
||||
scrolling, the cursor position was not being preserved
|
||||
due to a bug in 2.2.2. With such a targeted fix
|
||||
like this what could POSSIBLY go WRONG? Hahaha.
|
||||
Enjoy and if you find new bugs, as always please
|
||||
use Savannah's bug tracker.
|
||||
http://savannah.gnu.org/bugs/?func=additem&group=nano
|
||||
|
||||
2010.01.17 - GNU nano 2.2.2 is released for you, you, you. This
|
||||
release includes fixes for: crashed when writing
|
||||
backup files in certain conditions, improper
|
||||
screen centering when moving up/down in various
|
||||
combination of smooth scrolling and soft wrapping modes,
|
||||
a search crash on the armel arch, and issues with
|
||||
lots of keybinding customizations causing crashing
|
||||
particularly on FreeBSD. Also included are better
|
||||
help menu entries for forward/back in the file browser,
|
||||
some man page tweaks and one assert fix. As always,
|
||||
share and enjoy!
|
||||
|
||||
2009.12.12 - GNU nano 2.2.1 "DLR strikes back" is open for business.
|
||||
This release fixes many bugs, including: missing
|
||||
keybindings for page up/down and GotoDir in the browser,
|
||||
^P/^N in the help menu, and restoration of M-W as the
|
||||
default re-search binding. Other fixes include several
|
||||
issues with compiler warnings and configure options, and
|
||||
documentation updates, including the nano texinfo manual,
|
||||
nano and nanorc man pages, and UPGRADE file, and some
|
||||
missing syntax highliting entries for the saple nanorc.
|
||||
And no release would be complete without the latest round
|
||||
of 'final' soft wrapping fixes! Finally, nano will no
|
||||
longer print a warning when attempting to insert the
|
||||
contents of a read-only file into an existing buffer.
|
||||
Enjoy and Happy Hanukkah.
|
||||
|
||||
|
||||
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
|
||||
|
||||
1
TODO
1
TODO
@@ -28,6 +28,7 @@ For the future (no targeted version, catch-all)
|
||||
FFFD (Replacement Character) per sequence instead of one per byte.
|
||||
|
||||
For version 2.4:
|
||||
- New regression framework built on expect.
|
||||
- Allow text searches in the help browser.
|
||||
- Handle window resizes better. After we resize, we should stay
|
||||
wherever we were before we resized, as Pico does.
|
||||
|
||||
16
UPGRADE
16
UPGRADE
@@ -1,6 +1,22 @@
|
||||
GNU nano upgrading information
|
||||
==============================
|
||||
|
||||
Visible changes since 2.0
|
||||
-------------------------
|
||||
* Editor Features
|
||||
- The ability to rebind (reassign) keys using the nanorc.
|
||||
- The ability to read standard input like a pager ("nano -").
|
||||
- Color syntax highlighting can be set by the first line of a file.
|
||||
- The ability to silence nanorc error messages (-q).
|
||||
- Undo/redo operations (-u).
|
||||
- Soft wrapping of text (-$).
|
||||
|
||||
* File Handling
|
||||
- Better handling of backup files: if nano can't write a backup file,
|
||||
it won't try to write the original file afterward.
|
||||
- Emergency savefiles retain ownerships and permissions when possible.
|
||||
- Performance improvements in color syntax highlighting.
|
||||
|
||||
Visible changes since 1.2
|
||||
-------------------------
|
||||
* Editor Features
|
||||
|
||||
17
configure.ac
17
configure.ac
@@ -20,7 +20,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.2.0], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.2.5], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
@@ -569,6 +569,21 @@ int main(void)
|
||||
fi
|
||||
#fi
|
||||
|
||||
AC_MSG_CHECKING([whether LINES and COLS can be redefined])
|
||||
AC_TRY_RUN([
|
||||
#include <curses.h>
|
||||
int main(void)
|
||||
{
|
||||
LINES = 80;
|
||||
COLS = 25;
|
||||
return 0;
|
||||
}],
|
||||
AC_DEFINE(REDEFINIG_MACROS_OK, 1, [Define this if you know your curses library allows LINES and COLS to be redefined to deal with a resizing bug])
|
||||
AC_MSG_RESULT(yes),
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_WARN([*** Can't check for macro redefinability when cross-compiling]))
|
||||
|
||||
|
||||
# Check for groff html support
|
||||
AC_MSG_CHECKING([for HTML support in groff])
|
||||
groff -t -mandoc -Thtml </dev/null >/dev/null
|
||||
|
||||
16
doc/faq.html
16
doc/faq.html
@@ -83,9 +83,9 @@
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano *should* be 2.0.7. Of course, you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano *should* be 2.2.0. Of course, you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v2.0/nano.1.html">here</a>.</p></blockquote>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v2.2/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="2"></a>2. Where to get GNU nano.</h1>
|
||||
<h2><a name="2.1"></a>2.1. FTP and WWW sites that carry nano.</h2>
|
||||
@@ -99,8 +99,8 @@
|
||||
<h2><a name="2.2"></a>2.2. RedHat and derivatives (.rpm) packages.</h2>
|
||||
<blockquote>
|
||||
<ul>
|
||||
<li><a href="http://www.nano-editor.org/dist/v2.0/RPMS/">http://www.nano-editor.org/dist/v2.0/RPMS/</a></li>
|
||||
<li><a href="http://www.ewtoo.org/~astyanax/nano/dist/v2.0/RPMS/">http://www.ewtoo.org/~astyanax/nano/dist/v2.0/RPMS/</a></li>
|
||||
<li><a href="http://www.nano-editor.org/dist/v2.2/RPMS/">http://www.nano-editor.org/dist/v2.2/RPMS/</a></li>
|
||||
<li><a href="http://www.ewtoo.org/~astyanax/nano/dist/v2.2/RPMS/">http://www.ewtoo.org/~astyanax/nano/dist/v2.2/RPMS/</a></li>
|
||||
</ul>
|
||||
</blockquote>
|
||||
<h2><a name="2.3"></a>2.3. Debian (.deb) packages.</h2>
|
||||
@@ -246,7 +246,7 @@ Of course, due to the license change you can now use the <A HREF="http://www.was
|
||||
help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
|
||||
nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
|
||||
<h2><a name="7.2"></a>7.2. I want to send the development team a big load of cash (or just a thank you).</h2>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v2.0/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v2.0/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v2.2/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v2.2/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<h2><a name="7.3"></a>7.3. How do I submit a bug report or patch?</h2>
|
||||
<blockquote>
|
||||
<p>The best place to submit bugs is to the <A HREF="https://savannah.gnu.org/bugs/?group=nano">Savannah bug tracker</A> as you can check whether the bug you are submitting has already been submitted.
|
||||
@@ -256,8 +256,10 @@ Of course, due to the license change you can now use the <A HREF="http://www.was
|
||||
<h2><a name="7.5"></a>7.5. Can I have write access to the subversion tree?</h2>
|
||||
<blockquote><p>Re-read Section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote><p>2007/12/21 - Update maintainer information. (DLR)<br>
|
||||
2008/03/16 - Update docs to refer to subversion instead of CVS, add more words about Apline, and refer to Savannah for bugs and patches. (chrisa)
|
||||
<blockquote><p>2009/11/30 - Update various bits for nano 2.2.x. (DLR)<br>
|
||||
2009/11/18 - Typo fix. (j.mader@gmail.com)<br>
|
||||
2008/03/16 - Update docs to refer to subversion instead of CVS, add more words about Alpine, and refer to Savannah for bugs and patches. (chrisa)<br>
|
||||
2007/12/21 - Update maintainer information. (DLR)<br>
|
||||
2007/12/09 - Add minor punctuation and wording fixes, and update various sections to account for Alpine. (DLR)<br>
|
||||
2007/08/26 - Update links to the Free Translation Project. (DLR)<br>
|
||||
2007/07/29 - Update RPM links for nano 2.0.x. (DLR)<br>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
.\" Free Software Foundation, Inc.
|
||||
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
.\" 2008, 2009 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -19,7 +19,7 @@
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 2.0.0" "August 23, 2007"
|
||||
.TH NANO 1 "version 2.2.0" "November 30, 2009"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -62,7 +62,7 @@ line.
|
||||
.TP
|
||||
.B \-B (\-\-backup)
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
filename suffixed with a ~.
|
||||
.TP
|
||||
.B \-C \fIdir\fP (\-\-backupdir=\fIdir\fP)
|
||||
Set the directory where \fBnano\fP puts unique backup files if file
|
||||
@@ -79,11 +79,11 @@ Enable multiple file buffers, if available.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Log search and replace strings to \fI~/.nano_history\fP, so they can be
|
||||
retrieved in later sessions, if nanorc support is available.
|
||||
retrieved in later sessions, if \fInanorc\fP support is available.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
Don't look at \fISYSCONFDIR/nanorc\fP or \fI~/.nanorc\fP, if nanorc
|
||||
support is available.
|
||||
Don't look at \fISYSCONFDIR/nanorc\fP or \fI~/.nanorc\fP, if
|
||||
\fInanorc\fP support is available.
|
||||
.TP
|
||||
.B \-K (\-\-rebindkeypad)
|
||||
Interpret the numeric keypad keys so that they all work properly. You
|
||||
@@ -107,10 +107,11 @@ Tab.
|
||||
.TP
|
||||
.B \-R (\-\-restricted)
|
||||
Restricted mode: don't read or write to any file not specified on the
|
||||
command line; read any nanorc files; allow suspending; allow a file
|
||||
to be appended to, prepended to, or saved under a different name if it
|
||||
already has one; or use backup files or spell checking. Also accessible
|
||||
by invoking \fBnano\fP with any name beginning with 'r' (e.g. "rnano").
|
||||
command line; read any \fInanorc\fP files; allow suspending; allow a
|
||||
file to be appended to, prepended to, or saved under a different name if
|
||||
it already has one; or use backup files or spell checking. Also
|
||||
accessible by invoking \fBnano\fP with any name beginning with 'r' (e.g.
|
||||
"rnano").
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Enable smooth scrolling. Text will scroll line-by-line, instead of the
|
||||
@@ -173,8 +174,8 @@ Preserve the XON and XOFF sequences (^Q and ^S) so they will be caught
|
||||
by the terminal.
|
||||
.TP
|
||||
.B \-q (\-\-quiet)
|
||||
Do not report errors in the nanorc file and ask them to
|
||||
be acknowledged by pressing enter at startup.
|
||||
Do not report errors in the \fInanorc\fP file and ask them to be
|
||||
acknowledged by pressing Enter at startup.
|
||||
.TP
|
||||
.B \-r \fIcols\fP (\-\-fill=\fIcols\fP)
|
||||
Wrap lines at column \fIcols\fP. If this value is 0 or less, wrapping
|
||||
@@ -206,11 +207,11 @@ Disable help screen at bottom of editor.
|
||||
Enable suspend ability.
|
||||
.TP
|
||||
.B \-$ (\-\-softwrap)
|
||||
Enable 'soft wrapping'. Nano will attempt to display lines the entire
|
||||
contents of a line, even if it is longer than the screen width.
|
||||
Since '$' normally refers to a variable in the Unix shell, you should
|
||||
specify this option last when using other options (e.g. 'nano -wS$')
|
||||
or pass it separately (e.g. 'nano -wS -$').
|
||||
Enable 'soft wrapping'. \fBnano\fP will attempt to display the entire
|
||||
contents of a line, even if it is longer than the screen width. Since
|
||||
\&'$' normally refers to a variable in the Unix shell, you should specify
|
||||
this option last when using other options (e.g. 'nano \-wS$') or pass it
|
||||
separately (e.g. 'nano \-wS \-$').
|
||||
.TP
|
||||
.B \-a, \-b, \-e, \-f, \-g, \-j
|
||||
Ignored, for compatibility with Pico.
|
||||
@@ -223,7 +224,7 @@ should be provided with \fBnano\fP.
|
||||
|
||||
.SH NOTES
|
||||
If no alternative spell checker command is specified on the command
|
||||
line or in one of the nanorc files, \fBnano\fP will check the
|
||||
line or in one of the \fInanorc\fP files, \fBnano\fP will check the
|
||||
\fBSPELL\fP environment variable for one.
|
||||
|
||||
In some cases \fBnano\fP will try to dump the buffer into an emergency
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007
|
||||
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009
|
||||
.\" Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
@@ -45,9 +45,9 @@ the command line options. Additionally, the \fBsyntax\fP, \fBcolor\fP,
|
||||
and \fBicolor\fP keywords are used to define syntax highlighting rules
|
||||
for different text patterns. \fBnano\fP will read one command per line.
|
||||
|
||||
Options in nanorc files take precedence over nano's defaults, and
|
||||
command line options override nanorc settings. Also, options are unset
|
||||
by default, except for those that take arguments.
|
||||
Options in \fInanorc\fP files take precedence over nano's defaults, and
|
||||
command line options override \fInanorc\fP settings. Also, options are
|
||||
unset by default, except for those that take arguments.
|
||||
|
||||
Quotes inside string parameters don't have to be escaped with
|
||||
backslashes. The last double quote in the string will be treated as its
|
||||
@@ -57,6 +57,11 @@ match \fI"\fP, \fI'\fP, \fI)\fP, \fI>\fP, \fI]\fP, and \fI}\fP.
|
||||
The supported commands and arguments are:
|
||||
|
||||
.TP 3
|
||||
.B set/unset allow_insecure_backup
|
||||
When backing up files, allow the backup to succeed even if its permissions
|
||||
can't be (re)set due to special OS considerations. You should
|
||||
NOT enable this option unless you are sure you need it.
|
||||
.TP
|
||||
.B set/unset autoindent
|
||||
Use auto-indentation.
|
||||
.TP
|
||||
@@ -146,9 +151,9 @@ punctuation, optionally followed by closing brackets, can end sentences.
|
||||
The default value is "\fI!.?\fP".
|
||||
.TP
|
||||
.B set/unset quiet
|
||||
\fBnano\fP will not report errors in the nanorc file and ask them to
|
||||
be acknowledged by pressing enter at startup. If this is used it should
|
||||
be placed at the top of the file to be fully effective.
|
||||
\fBnano\fP will not report errors in the \fInanorc\fP file and ask them
|
||||
to be acknowledged by pressing enter at startup. If this is used it
|
||||
should be placed at the top of the file to be fully effective.
|
||||
.TP
|
||||
.B set/unset quickblank
|
||||
Do quick statusbar blanking. Statusbar messages will disappear after 1
|
||||
@@ -276,7 +281,7 @@ followed by an alpha character or the word "Space".
|
||||
Example: ^C
|
||||
.TP
|
||||
.B M-
|
||||
followed by a prinable character or the word "Space".
|
||||
followed by a printable character or the word "Space".
|
||||
Example: M-C
|
||||
.TP
|
||||
.B F
|
||||
@@ -414,7 +419,7 @@ Refresh the screen.
|
||||
Undo the text action peformed (add text, delete text, etc).
|
||||
.TP
|
||||
.B redo
|
||||
"Re-do" the last undone action (i.e. undo an undo)
|
||||
Redo the last undone action (i.e., undo an undo).
|
||||
.TP
|
||||
.B suspend
|
||||
Suspend the editor (if the suspend function is enabled, see the
|
||||
@@ -451,7 +456,7 @@ When writing a file, append to the end instead of overwriting.
|
||||
When writing a file, 'prepend' (write at the beginning) instead of overwriting.
|
||||
.TP
|
||||
.B backup
|
||||
When writing a file, create a backup of the current file.
|
||||
When writing a file, create a backup of the current file.
|
||||
.TP
|
||||
.B firstfile
|
||||
Move to the first file when using the file browser (reading or writing files).
|
||||
|
||||
@@ -141,6 +141,9 @@
|
||||
## Use smooth scrolling as the default.
|
||||
# set smooth
|
||||
|
||||
## Enable soft line wrapping (AKA full line display).
|
||||
# set softwrap
|
||||
|
||||
## Use this spelling checker instead of the internal one. This option
|
||||
## does not properly have a default value.
|
||||
##
|
||||
@@ -158,6 +161,10 @@
|
||||
## Save automatically on exit, don't prompt.
|
||||
# set tempfile
|
||||
|
||||
## Enable the new (EXPERIMENTAL) generic undo code, not just for line
|
||||
## cuts.
|
||||
# set undo
|
||||
|
||||
## Disallow file modification. Why would you want this in an rcfile? ;)
|
||||
# set view
|
||||
|
||||
@@ -170,12 +177,6 @@
|
||||
## characters as parts of words.
|
||||
# set wordbounds
|
||||
|
||||
## Enable the new (EXPERIMENTAL) generic undo code, not just for line cuts
|
||||
# set undo
|
||||
|
||||
## Enable soft line wrapping (AKA full line display)
|
||||
# set softwrap
|
||||
|
||||
|
||||
## Color setup
|
||||
##
|
||||
@@ -286,6 +287,15 @@
|
||||
## Java
|
||||
# include "@PKGDATADIR@/java.nanorc"
|
||||
|
||||
## Fortran
|
||||
# include "@PKGDATADIR@/fortran.nanorc"
|
||||
|
||||
## Objective-C
|
||||
# include "@PKGDATADIR@/objc.nanorc"
|
||||
|
||||
## OCaml
|
||||
# include "@PKGDATADIR@/ocaml.nanorc"
|
||||
|
||||
## AWK
|
||||
# include "@PKGDATADIR@/awk.nanorc"
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
pkgdata_DATA = asm.nanorc \
|
||||
c.nanorc \
|
||||
cmake.nanorc \
|
||||
groff.nanorc \
|
||||
html.nanorc \
|
||||
java.nanorc \
|
||||
@@ -23,6 +24,7 @@ pkgdata_DATA = asm.nanorc \
|
||||
ocaml.nanorc \
|
||||
objc.nanorc \
|
||||
fortran.nanorc \
|
||||
makefile.nanorc
|
||||
makefile.nanorc \
|
||||
mgp.nanorc
|
||||
|
||||
EXTRA_DIST = $(pkgdata_DATA)
|
||||
|
||||
@@ -8,7 +8,7 @@ color green "\<(class|namespace|template|public|protected|private|typename|this|
|
||||
color brightyellow "\<(for|if|while|do|else|case|default|switch)\>"
|
||||
color brightyellow "\<(try|throw|catch|operator|new|delete)\>"
|
||||
color magenta "\<(goto|continue|break|return)\>"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|include|(un|ifn?)def|endif|el(if|se)|if|warning|error)"
|
||||
color brightcyan "^[[:space:]]*#[[:space:]]*(define|include(_next)?|(un|ifn?)def|endif|el(if|se)|if|warning|error|pragma)"
|
||||
color brightmagenta "'([^'\]|(\\["'abfnrtv\\]))'" "'\\(([0-3]?[0-7]{1,2}))'" "'\\x[0-9A-Fa-f]{1,2}'"
|
||||
##
|
||||
## GCC builtins
|
||||
|
||||
19
doc/syntax/cmake.nanorc
Normal file
19
doc/syntax/cmake.nanorc
Normal file
@@ -0,0 +1,19 @@
|
||||
## CMake syntax highlighter for GNU Nano
|
||||
##
|
||||
syntax "cmake" "(CMakeLists\.txt|\.cmake)$"
|
||||
|
||||
icolor green "^[[:space:]]*[A-Z0-9_]+"
|
||||
icolor brightyellow "^[[:space:]]*(include|include_directories|include_external_msproject)\>"
|
||||
|
||||
icolor brightgreen "^[[:space:]]*\<((else|end)?if|else|(end)?while|(end)?foreach|break)\>"
|
||||
color brightgreen "\<(NOT|COMMAND|POLICY|TARGET|EXISTS|IS_(DIRECTORY|ABSOLUTE)|DEFINED)\>[[:space:]]"
|
||||
color brightgreen "[[:space:]]\<(OR|AND|IS_NEWER_THAN|MATCHES|(STR|VERSION_)?(LESS|GREATER|EQUAL))\>[[:space:]]"
|
||||
|
||||
icolor brightred "^[[:space:]]*\<((end)?(function|macro)|return)"
|
||||
|
||||
icolor cyan start="\$(\{|ENV\{)" end="\}"
|
||||
color magenta "\<(APPLE|UNIX|WIN32|CYGWIN|BORLAND|MINGW|MSVC(_IDE|60|71|80|90)?)\>"
|
||||
|
||||
icolor brightblue "^([[:space:]]*)?#.*"
|
||||
icolor brightblue "[[:space:]]#.*"
|
||||
color ,green "[[:space:]]+$"
|
||||
@@ -3,6 +3,6 @@
|
||||
syntax "makefile" "Makefile[^/]*$"
|
||||
color red "[:=]"
|
||||
color magenta "\<(if|ifeq|else|endif)\>"
|
||||
color blue "\$+[{(][a-Z0-9_-]+[})]"
|
||||
color blue "\$+[{(][a-zA-Z0-9_-]+[})]"
|
||||
color brightblue "^[^ ]+:"
|
||||
color green "#.*$"
|
||||
|
||||
8
doc/syntax/mgp.nanorc
Normal file
8
doc/syntax/mgp.nanorc
Normal file
@@ -0,0 +1,8 @@
|
||||
## Here is an example for Magicpoint presentations
|
||||
##
|
||||
syntax "mgp" "\.mgp$"
|
||||
header "^%include.*"
|
||||
icolor green "^%[a-z].*$"
|
||||
color cyan "(^|[[:space:]])#.*$"
|
||||
color cyan "(^|[[:space:]])%%.*$"
|
||||
color ,green "[[:space:]]+$"
|
||||
@@ -4,7 +4,7 @@ syntax "nanorc" "\.?nanorc$"
|
||||
## Possible errors and parameters
|
||||
icolor brightwhite "^[[:space:]]*((un)?set|include|syntax|i?color).*$"
|
||||
## Keywords
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|speller|suspend|tabsize|tabstospaces|tempfile|view|whitespace|wordbounds)\>"
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backupdir|backwards|boldtext|brackets|casesensitive|const|cut|fill|historylog|matchbrackets|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|operatingdir|preserve|punct)\>" "^[[:space:]]*(set|unset)[[:space:]]+(quickblank|quotestr|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|speller|suspend|suspendenable|tabsize|tabstospaces|tempfile|undo|view|whitespace|wordbounds)\>"
|
||||
icolor green "^[[:space:]]*(set|unset|include|syntax|header)\>"
|
||||
## Colors
|
||||
icolor yellow "^[[:space:]]*i?color[[:space:]]*(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
|
||||
@@ -3,4 +3,4 @@
|
||||
syntax "tex" "\.tex$"
|
||||
icolor green "\\.|\\[A-Z]*"
|
||||
color magenta "[{}]"
|
||||
color blue "%.*"
|
||||
color blue "(^|[^\])%.*"
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
@c Run 'makeinfo' rather than 'texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 2.0.0
|
||||
@set UPDATED 17 Dec 2007
|
||||
@set VERSION 2.2.0
|
||||
@set UPDATED 30 Nov 2009
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 2.0.0
|
||||
@subtitle version 2.2.0
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -33,8 +33,8 @@ editor.
|
||||
|
||||
This manual is part of the GNU @code{nano} distribution.@*
|
||||
@sp4
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
|
||||
Free Software Foundation, Inc.
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
2008, 2009 Free Software Foundation, Inc.
|
||||
|
||||
This document is dual-licensed. You may distribute and/or modify it
|
||||
under the terms of either of the following licenses:
|
||||
@@ -249,6 +249,10 @@ a chroot.
|
||||
Preserve the ^Q (XON) and ^S (XOFF) sequences so data being sent to the
|
||||
editor can be can be stopped and started.
|
||||
|
||||
@item -q, --quiet
|
||||
Do not report errors in the nanorc file and ask them to be acknowledged
|
||||
by pressing Enter at startup.
|
||||
|
||||
@item -r <#cols>, --fill=<#cols>
|
||||
Wrap lines at column #cols. If this value is 0 or less, wrapping will
|
||||
occur at the width of the screen less #cols, allowing it to vary along
|
||||
@@ -266,6 +270,10 @@ Don't ask whether or not to save the current contents of the file when
|
||||
exiting, assume yes. This is most useful when using @code{nano} as the
|
||||
composer of a mailer program.
|
||||
|
||||
@item -u, --undo
|
||||
Enable experimental generic-purpose undo code. By default, the undo and
|
||||
redo shortcuts are Meta-U and Meta-E, respectively.
|
||||
|
||||
@item -v, --view
|
||||
Don't allow the contents of the file to be altered. Note that this
|
||||
option should NOT be used in place of correct file permissions to
|
||||
@@ -288,6 +296,13 @@ disabled to display the help system navigation keys.
|
||||
Enable @code{nano}'s suspend ability using the system's suspend
|
||||
keystroke (usually ^Z).
|
||||
|
||||
@item -$, --softwrap
|
||||
Enable 'soft wrapping'. @code{nano} will attempt to display the entire
|
||||
contents of a line, even if it is longer than the screen width. Since
|
||||
'$' normally refers to a variable in the Unix shell, you should specify
|
||||
this option last when using other options (e.g. 'nano -wS$') or pass it
|
||||
separately (e.g. 'nano -wS -$').
|
||||
|
||||
@item -a, -b, -e, -f, -g, -j
|
||||
Ignored, for compatibility with Pico.
|
||||
@end table
|
||||
@@ -447,6 +462,9 @@ nanorc. See @xref{Nanorc Files}, for more info.
|
||||
@item Suspend Toggle (Meta-Z)
|
||||
toggles the -z (@code{--suspend}) command line option.
|
||||
|
||||
@item Soft Wrapping Toggle (Meta-$)
|
||||
toggles the -$ (@code{--softwrap}) command line option.
|
||||
|
||||
@end table
|
||||
|
||||
|
||||
@@ -615,6 +633,9 @@ line.
|
||||
@item set/unset smooth
|
||||
Use smooth scrolling by default.
|
||||
|
||||
@item set/unset softwrap
|
||||
Use soft wrapping by default.
|
||||
|
||||
@item set speller "spellprog"
|
||||
Use spelling checker "spellprog" instead of the built-in one, which
|
||||
calls "spell".
|
||||
@@ -622,6 +643,10 @@ calls "spell".
|
||||
@item set/unset suspend
|
||||
Allow @code{nano} to be suspended.
|
||||
|
||||
@item set/unset suspendenable
|
||||
If @code{nano} is allowed to be suspended, allow the suspend key
|
||||
(usually ^Z) to actually suspend it.
|
||||
|
||||
@item set tabsize "n"
|
||||
Use a tab size of "n" columns. The value of "n" must be greater than 0.
|
||||
The default value is 8.
|
||||
@@ -632,6 +657,9 @@ Convert typed tabs to spaces.
|
||||
@item set/unset tempfile
|
||||
Save automatically on exit, don't prompt.
|
||||
|
||||
@item set/unset undo
|
||||
Enable experimental generic-purpose undo code.
|
||||
|
||||
@item set/unset view
|
||||
Disallow file modification.
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ sub combinations {
|
||||
return @rest, map { [$first, @$_] } @rest;
|
||||
}
|
||||
|
||||
my @allargs=("--enable-debug", "--disable-justify", "--disable-extra", "--enable-tiny", "--disable-browser --disable-help --disable-mouse --disable-operatingdir --disable-speller", "--disable-multibuffer", "--disable-nanorc", "--with-slang");
|
||||
my @allargs=("--enable-debug", "--disable-wrapping", "--disable-justify", "--disable-extra", "--enable-tiny", "--disable-browser --disable-help --disable-mouse --disable-operatingdir --disable-speller", "--disable-multibuffer", "--disable-nanorc", "--with-slang");
|
||||
my @combos = combinations(@allargs);
|
||||
|
||||
my $i = 0;
|
||||
|
||||
467
po/nano.pot
467
po/nano.pot
File diff suppressed because it is too large
Load Diff
519
po/pt_BR.po
519
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
479
po/zh_CN.po
479
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
469
po/zh_TW.po
469
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* browser.c *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
@@ -184,7 +184,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
do_filesearch();
|
||||
curs_set(0);
|
||||
/* Search for another filename. */
|
||||
} else if (f->scfunc == WHEREIS_NEXT_MSG) {
|
||||
} else if (f->scfunc == DO_RESEARCH) {
|
||||
do_fileresearch();
|
||||
} else if (f->scfunc == DO_PAGE_UP) {
|
||||
if (selected >= (editwinrows + fileline % editwinrows) *
|
||||
@@ -232,7 +232,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
* blank out ans, since we're done with it. */
|
||||
statusbar(_("Cancelled"));
|
||||
ans = mallocstrcpy(ans, "");
|
||||
break;
|
||||
continue;
|
||||
} else if (i != 0) {
|
||||
/* Put back the "Go to Directory" key and save
|
||||
* answer in ans, so that the file list is displayed
|
||||
@@ -240,7 +240,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
* typed before at the prompt is displayed again. */
|
||||
unget_kbinput(sc_seq_or(DO_GOTOLINECOLUMN_VOID, 0), FALSE, FALSE);
|
||||
ans = mallocstrcpy(ans, answer);
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* We have a directory. Blank out ans, since we're done
|
||||
@@ -266,7 +266,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
_("Can't go outside of %s in restricted mode"),
|
||||
operating_dir);
|
||||
free(new_path);
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -278,7 +278,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
strerror(errno));
|
||||
beep();
|
||||
free(new_path);
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Start over again with the new path value. */
|
||||
@@ -302,7 +302,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
if (strcmp(filelist[selected], "/..") == 0) {
|
||||
statusbar(_("Can't move up a directory"));
|
||||
beep();
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
@@ -314,7 +314,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
_("Can't go outside of %s in restricted mode"),
|
||||
operating_dir);
|
||||
beep();
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -324,7 +324,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
statusbar(_("Error reading %s: %s"),
|
||||
filelist[selected], strerror(errno));
|
||||
beep();
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
/* If we've successfully opened a file, we're done, so
|
||||
@@ -332,7 +332,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
if (!S_ISDIR(st.st_mode)) {
|
||||
retval = mallocstrcpy(NULL, filelist[selected]);
|
||||
abort = TRUE;
|
||||
break;
|
||||
continue;
|
||||
/* If we've successfully opened a directory, and it's
|
||||
* "..", save the current directory in prev_dir, so that
|
||||
* we can select it later. */
|
||||
@@ -347,7 +347,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
statusbar(_("Error reading %s: %s"),
|
||||
filelist[selected], strerror(errno));
|
||||
beep();
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
path = mallocstrcpy(path, filelist[selected]);
|
||||
|
||||
42
src/chars.c
42
src/chars.c
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* chars.c *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
@@ -79,6 +79,16 @@ bool is_byte(int c)
|
||||
return ((unsigned int)c == (unsigned char)c);
|
||||
}
|
||||
|
||||
static void mbtowc_reset(void)
|
||||
{
|
||||
IGNORE_CALL_RESULT(mbtowc(NULL, NULL, 0));
|
||||
}
|
||||
|
||||
static void wctomb_reset(void)
|
||||
{
|
||||
IGNORE_CALL_RESULT(wctomb(NULL, 0));
|
||||
}
|
||||
|
||||
/* This function is equivalent to isalnum() for multibyte characters. */
|
||||
bool is_alnum_mbchar(const char *c)
|
||||
{
|
||||
@@ -89,7 +99,7 @@ bool is_alnum_mbchar(const char *c)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
mbtowc_reset();
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
@@ -109,7 +119,7 @@ bool is_blank_mbchar(const char *c)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
mbtowc_reset();
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
@@ -156,7 +166,7 @@ bool is_cntrl_mbchar(const char *c)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
mbtowc_reset();
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
@@ -177,7 +187,7 @@ bool is_punct_mbchar(const char *c)
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len < 0) {
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
mbtowc_reset();
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
@@ -243,14 +253,14 @@ char *control_mbrep(const char *c, char *crep, int *crep_len)
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
mbtowc_reset();
|
||||
*crep_len = bad_mbchar_len;
|
||||
strncpy(crep, bad_mbchar, *crep_len);
|
||||
} else {
|
||||
*crep_len = wctomb(crep, control_wrep(wc));
|
||||
|
||||
if (*crep_len < 0) {
|
||||
int shutup = wctomb(NULL, 0);
|
||||
wctomb_reset();
|
||||
*crep_len = 0;
|
||||
}
|
||||
}
|
||||
@@ -278,14 +288,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)) {
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
mbtowc_reset();
|
||||
*crep_len = bad_mbchar_len;
|
||||
strncpy(crep, bad_mbchar, *crep_len);
|
||||
} else {
|
||||
*crep_len = wctomb(crep, wc);
|
||||
|
||||
if (*crep_len < 0) {
|
||||
int shutup = wctomb(NULL, 0);
|
||||
wctomb_reset();
|
||||
*crep_len = 0;
|
||||
}
|
||||
}
|
||||
@@ -311,7 +321,7 @@ int mbwidth(const char *c)
|
||||
int width;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
mbtowc_reset();
|
||||
wc = bad_wchar;
|
||||
}
|
||||
|
||||
@@ -356,7 +366,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)) {
|
||||
int shutup = wctomb(NULL, 0);
|
||||
wctomb_reset();
|
||||
*chr_mb_len = 0;
|
||||
}
|
||||
} else {
|
||||
@@ -388,7 +398,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) {
|
||||
int shutup = mblen(NULL, 0);
|
||||
IGNORE_CALL_RESULT(mblen(NULL, 0));
|
||||
buf_mb_len = 1;
|
||||
} else if (buf_mb_len == 0)
|
||||
buf_mb_len++;
|
||||
@@ -545,7 +555,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) {
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
mbtowc_reset();
|
||||
ws1 = (unsigned char)*s1_mb;
|
||||
bad_s1_mb = TRUE;
|
||||
}
|
||||
@@ -553,7 +563,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) {
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
mbtowc_reset();
|
||||
ws2 = (unsigned char)*s2_mb;
|
||||
bad_s2_mb = TRUE;
|
||||
}
|
||||
@@ -781,7 +791,7 @@ char *mbstrchr(const char *s, const char *c)
|
||||
int c_mb_len = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
|
||||
if (c_mb_len < 0) {
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
mbtowc_reset();
|
||||
wc = (unsigned char)*c;
|
||||
bad_c_mb = TRUE;
|
||||
}
|
||||
@@ -790,7 +800,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) {
|
||||
int shutup = mbtowc(NULL, NULL, 0);
|
||||
mbtowc_reset();
|
||||
ws = (unsigned char)*s;
|
||||
bad_s_mb = TRUE;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* color.c *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* cut.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
|
||||
105
src/files.c
105
src/files.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* files.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -146,7 +146,7 @@ void open_buffer(const char *filename, bool undoable)
|
||||
/* If we have a non-new file, read it in. Then, if the buffer has
|
||||
* no stat, update the stat, if applicable. */
|
||||
if (rc > 0) {
|
||||
read_file(f, rc, filename, undoable);
|
||||
read_file(f, rc, filename, undoable, new_buffer);
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->current_stat == NULL) {
|
||||
openfile->current_stat =
|
||||
@@ -196,7 +196,7 @@ void replace_buffer(const char *filename)
|
||||
|
||||
/* If we have a non-new file, read it in. */
|
||||
if (rc > 0)
|
||||
read_file(f, rc, filename, FALSE);
|
||||
read_file(f, rc, filename, FALSE, TRUE);
|
||||
|
||||
/* Move back to the beginning of the first line of the buffer. */
|
||||
openfile->current = openfile->fileage;
|
||||
@@ -309,7 +309,7 @@ int is_file_writable(const char *filename)
|
||||
if (ISSET(VIEW_MODE))
|
||||
return TRUE;
|
||||
|
||||
assert(filename != NULL && f != NULL);
|
||||
assert(filename != NULL);
|
||||
|
||||
/* Get the specified file's full path. */
|
||||
full_filename = get_full_path(filename);
|
||||
@@ -390,9 +390,9 @@ filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
/* Read an open file into the current buffer. f should be set to the
|
||||
* open file, and filename should be set to the name of the file.
|
||||
* undoable means do we want to create undo records to try and undo this.
|
||||
* Will also attempt to check file writability if fd > 0
|
||||
* Will also attempt to check file writability if fd > 0 and checkwritable == TRUE
|
||||
*/
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable)
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable)
|
||||
{
|
||||
size_t num_lines = 0;
|
||||
/* The number of lines in the file. */
|
||||
@@ -514,7 +514,7 @@ void read_file(FILE *f, int fd, const char *filename, bool undoable)
|
||||
if (ferror(f))
|
||||
nperror(filename);
|
||||
fclose(f);
|
||||
if (fd > 0) {
|
||||
if (fd > 0 && checkwritable) {
|
||||
close(fd);
|
||||
writable = is_file_writable(filename);
|
||||
}
|
||||
@@ -1092,7 +1092,6 @@ 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;
|
||||
@@ -1191,7 +1190,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. */
|
||||
shutup = chdir(d_here);
|
||||
IGNORE_CALL_RESULT(chdir(d_here));
|
||||
|
||||
/* Free d_here, since we're done using it. */
|
||||
free(d_here);
|
||||
@@ -1459,6 +1458,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
/* The actual file, realname, we are writing to. */
|
||||
char *tempname = NULL;
|
||||
/* The temp file name we write to on prepend. */
|
||||
int backup_cflags;
|
||||
|
||||
assert(name != NULL);
|
||||
|
||||
@@ -1501,14 +1501,22 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
realexists = (stat(realname, &st) != -1);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* if we have not stat()d this file before (say, the user just
|
||||
* specified it interactively), stat and save the value
|
||||
* or else we will chase null pointers when we do
|
||||
* modtime checks, preserve file times, etc. during backup */
|
||||
if (openfile->current_stat == NULL && !tmp && realexists)
|
||||
stat(realname, openfile->current_stat);
|
||||
|
||||
/* We backup only if the backup toggle is set, the file isn't
|
||||
* temporary, and the file already exists. Furthermore, if we
|
||||
* aren't appending, prepending, or writing a selection, we backup
|
||||
* only if the file has not been modified by someone else since nano
|
||||
* opened it. */
|
||||
if (ISSET(BACKUP_FILE) && !tmp && realexists && ((append !=
|
||||
OVERWRITE || openfile->mark_set) ||
|
||||
openfile->current_stat->st_mtime == st.st_mtime)) {
|
||||
OVERWRITE || openfile->mark_set) || (openfile->current_stat &&
|
||||
openfile->current_stat->st_mtime == st.st_mtime))) {
|
||||
int backup_fd;
|
||||
FILE *backup_file;
|
||||
char *backupname;
|
||||
struct utimbuf filetime;
|
||||
@@ -1582,18 +1590,51 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
sprintf(backupname, "%s~", realname);
|
||||
}
|
||||
|
||||
/* Open the destination backup file. Before we write to it, we
|
||||
* set its permissions, so no unauthorized person can read it as
|
||||
* we write. */
|
||||
backup_file = fopen(backupname, "wb");
|
||||
/* First, unlink any existing backups. Next, open the backup
|
||||
file with O_CREAT and O_EXCL. If it succeeds, we
|
||||
have a file descriptor to a new backup file. */
|
||||
if (unlink(backupname) < 0 && errno != ENOENT && !ISSET(INSECURE_BACKUP)) {
|
||||
statusbar(_("Error writing backup file %s: %s"), backupname,
|
||||
strerror(errno));
|
||||
free(backupname);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
if (backup_file == NULL || chmod(backupname,
|
||||
openfile->current_stat->st_mode) == -1) {
|
||||
if (ISSET(INSECURE_BACKUP))
|
||||
backup_cflags = O_WRONLY | O_CREAT | O_APPEND;
|
||||
else
|
||||
backup_cflags = O_WRONLY | O_CREAT | O_EXCL | O_APPEND;
|
||||
|
||||
backup_fd = open(backupname, backup_cflags,
|
||||
S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH);
|
||||
/* Now we've got a safe file stream. If the previous open()
|
||||
call failed, this will return NULL. */
|
||||
backup_file = fdopen(backup_fd, "wb");
|
||||
|
||||
if (backup_fd < 0 || backup_file == NULL) {
|
||||
statusbar(_("Error writing backup file %s: %s"), backupname,
|
||||
strerror(errno));
|
||||
free(backupname);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
/* We shouldn't worry about chown()ing something if we're not
|
||||
root, since it's likely to fail! */
|
||||
if (geteuid() == NANO_ROOT_UID && fchown(backup_fd,
|
||||
openfile->current_stat->st_uid, openfile->current_stat->st_gid) == -1
|
||||
&& !ISSET(INSECURE_BACKUP)) {
|
||||
statusbar(_("Error writing backup file %s: %s"), backupname,
|
||||
strerror(errno));
|
||||
free(backupname);
|
||||
if (backup_file != NULL)
|
||||
fclose(backup_file);
|
||||
fclose(backup_file);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
if (fchmod(backup_fd, openfile->current_stat->st_mode) == -1 && !ISSET(INSECURE_BACKUP)) {
|
||||
statusbar(_("Error writing backup file %s: %s"), backupname,
|
||||
strerror(errno));
|
||||
free(backupname);
|
||||
fclose(backup_file);
|
||||
/* If we can't write to the backup, DONT go on, since
|
||||
whatever caused the backup file to fail (e.g. disk
|
||||
full may well cause the real file write to fail, which
|
||||
@@ -1608,17 +1649,16 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
/* Copy the file. */
|
||||
copy_status = copy_file(f, backup_file);
|
||||
|
||||
/* And set its metadata. */
|
||||
if (copy_status != 0 || chown(backupname,
|
||||
openfile->current_stat->st_uid,
|
||||
openfile->current_stat->st_gid) == -1 ||
|
||||
utime(backupname, &filetime) == -1) {
|
||||
if (copy_status == -1) {
|
||||
statusbar(_("Error reading %s: %s"), realname,
|
||||
if (copy_status != 0) {
|
||||
statusbar(_("Error reading %s: %s"), realname,
|
||||
strerror(errno));
|
||||
beep();
|
||||
} else
|
||||
statusbar(_("Error writing backup file %s: %s"), backupname,
|
||||
beep();
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
/* And set its metadata. */
|
||||
if (utime(backupname, &filetime) == -1 && !ISSET(INSECURE_BACKUP)) {
|
||||
statusbar(_("Error writing backup file %s: %s"), backupname,
|
||||
strerror(errno));
|
||||
/* If we can't write to the backup, DONT go on, since
|
||||
whatever caused the backup file to fail (e.g. disk
|
||||
@@ -2119,7 +2159,10 @@ bool do_writeout(bool exiting)
|
||||
}
|
||||
}
|
||||
#ifndef NANO_TINY
|
||||
if (name_exists && openfile->current_stat && openfile->current_stat->st_mtime < st.st_mtime) {
|
||||
/* Complain if the file exists, the name hasn't changed, and the
|
||||
stat information we had before does not match what we have now */
|
||||
else if (name_exists && openfile->current_stat && (openfile->current_stat->st_mtime < st.st_mtime ||
|
||||
openfile->current_stat->st_dev != st.st_dev || openfile->current_stat->st_ino != st.st_ino)) {
|
||||
i = do_yesno_prompt(FALSE,
|
||||
_("File was modified since you opened it, continue saving ? "));
|
||||
if (i == 0 || i == -1)
|
||||
|
||||
73
src/global.c
73
src/global.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* global.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -638,8 +638,9 @@ void shortcut_init(bool unjustify)
|
||||
N_("Go to the first file in the list");
|
||||
const char *nano_lastfile_msg =
|
||||
N_("Go to the last file in the list");
|
||||
const char *nano_forwardfile_msg = N_("Go to the next file in the list");
|
||||
const char *nano_backfile_msg = N_("Go to the previous file in the list");
|
||||
const char *nano_gotodir_msg = N_("Go to directory");
|
||||
|
||||
#endif
|
||||
#endif /* !DISABLE_HELP */
|
||||
|
||||
@@ -655,8 +656,9 @@ void shortcut_init(bool unjustify)
|
||||
free(f);
|
||||
}
|
||||
|
||||
add_to_funcs(DO_HELP_VOID, MALL, get_help_msg, IFSCHELP(nano_help_msg),
|
||||
FALSE, VIEW);
|
||||
add_to_funcs(DO_HELP_VOID,
|
||||
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR),
|
||||
get_help_msg, IFSCHELP(nano_help_msg), FALSE, VIEW);
|
||||
|
||||
add_to_funcs( CANCEL_MSG,
|
||||
(MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MWHEREISFILE|MGOTODIR|MYESNO),
|
||||
@@ -669,8 +671,6 @@ void shortcut_init(bool unjustify)
|
||||
#endif
|
||||
exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW);
|
||||
|
||||
add_to_funcs(DO_EXIT, MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
add_to_funcs(DO_EXIT, MBROWSER, exit_msg, IFSCHELP(nano_exitbrowser_msg), FALSE, VIEW);
|
||||
#endif
|
||||
@@ -702,9 +702,9 @@ void shortcut_init(bool unjustify)
|
||||
add_to_funcs(DO_SEARCH, MMAIN|MBROWSER, whereis_msg,
|
||||
IFSCHELP(nano_whereis_msg), FALSE, VIEW);
|
||||
|
||||
add_to_funcs(DO_PAGE_UP, MMAIN|MHELP,
|
||||
add_to_funcs(DO_PAGE_UP, MMAIN|MHELP|MBROWSER,
|
||||
prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW);
|
||||
add_to_funcs(DO_PAGE_DOWN, MMAIN|MHELP,
|
||||
add_to_funcs(DO_PAGE_DOWN, MMAIN|MHELP|MBROWSER,
|
||||
next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW);
|
||||
|
||||
|
||||
@@ -739,11 +739,11 @@ void shortcut_init(bool unjustify)
|
||||
#endif
|
||||
|
||||
add_to_funcs(DO_FIRST_LINE,
|
||||
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP),
|
||||
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE),
|
||||
first_line_msg, IFSCHELP(nano_firstline_msg), FALSE, VIEW);
|
||||
|
||||
add_to_funcs(DO_LAST_LINE,
|
||||
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MHELP),
|
||||
(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE),
|
||||
last_line_msg, IFSCHELP(nano_lastline_msg), TRUE, VIEW);
|
||||
|
||||
|
||||
@@ -793,18 +793,24 @@ void shortcut_init(bool unjustify)
|
||||
|
||||
#endif
|
||||
|
||||
add_to_funcs(DO_PAGE_UP, MBROWSER,
|
||||
prev_page_msg, IFSCHELP(nano_prevpage_msg), FALSE, VIEW);
|
||||
add_to_funcs(DO_PAGE_DOWN, MBROWSER,
|
||||
next_page_msg, IFSCHELP(nano_nextpage_msg), TRUE, VIEW);
|
||||
|
||||
|
||||
add_to_funcs(DO_RIGHT, (MMAIN|MBROWSER), N_("Forward"), IFSCHELP(nano_forward_msg),
|
||||
add_to_funcs(DO_RIGHT, MMAIN, N_("Forward"), IFSCHELP(nano_forward_msg),
|
||||
FALSE, VIEW);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
add_to_funcs(DO_RIGHT, MBROWSER, N_("Forward"), IFSCHELP(nano_forwardfile_msg),
|
||||
FALSE, VIEW);
|
||||
#endif
|
||||
|
||||
add_to_funcs(DO_RIGHT, MALL, "", "", FALSE, VIEW);
|
||||
|
||||
add_to_funcs(DO_LEFT, (MMAIN|MBROWSER), N_("Back"), IFSCHELP(nano_back_msg),
|
||||
add_to_funcs(DO_LEFT, MMAIN, N_("Back"), IFSCHELP(nano_back_msg),
|
||||
FALSE, VIEW);
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
add_to_funcs(DO_LEFT, MBROWSER, N_("Back"), IFSCHELP(nano_backfile_msg),
|
||||
FALSE, VIEW);
|
||||
#endif
|
||||
|
||||
add_to_funcs(DO_LEFT, MALL, "", "", FALSE, VIEW);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
@@ -1001,6 +1007,10 @@ void shortcut_init(bool unjustify)
|
||||
#ifndef DISABLE_HELP
|
||||
add_to_funcs( REFRESH_MSG, MHELP,
|
||||
refresh_msg, nano_refresh_msg, FALSE, VIEW);
|
||||
|
||||
add_to_funcs(DO_EXIT, MHELP, exit_msg, IFSCHELP(nano_exit_msg), FALSE, VIEW);
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
@@ -1019,12 +1029,15 @@ void shortcut_init(bool unjustify)
|
||||
|
||||
currmenu = MMAIN;
|
||||
|
||||
add_to_sclist(MALL, "^G", DO_HELP_VOID, 0, TRUE);
|
||||
add_to_sclist(MALL, "F1", DO_HELP_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR,
|
||||
"^G", DO_HELP_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MWHEREIS|MREPLACE|MREPLACE2|MGOTOLINE|MWRITEFILE|MINSERTFILE|MEXTCMD|MSPELL|MBROWSER|MWHEREISFILE|MGOTODIR,
|
||||
"F1", DO_HELP_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^X", DO_EXIT, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "F2", DO_EXIT, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "^_", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "F13", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-G", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "^O", DO_WRITEOUT_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "F3", DO_WRITEOUT_VOID, 0, TRUE);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -1052,9 +1065,6 @@ void shortcut_init(bool unjustify)
|
||||
add_to_sclist(MMAIN, "^T", DO_SPELL, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "F12", DO_SPELL, 0, TRUE);
|
||||
#endif
|
||||
add_to_sclist(MMAIN, "^_", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "F13", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-G", DO_GOTOLINECOLUMN_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "^\\", DO_REPLACE, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "F14", DO_REPLACE, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-R", DO_REPLACE, 0, TRUE);
|
||||
@@ -1065,8 +1075,8 @@ void shortcut_init(bool unjustify)
|
||||
add_to_sclist(MMAIN, "^^", DO_MARK, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "F15", DO_MARK, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-A", DO_MARK, 0, TRUE);
|
||||
add_to_sclist(MALL, "M-W", DO_RESEARCH, 0, TRUE);
|
||||
add_to_sclist(MALL, "F16", DO_RESEARCH, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MBROWSER, "M-W", DO_RESEARCH, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MBROWSER, "F16", DO_RESEARCH, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-^", DO_COPY_TEXT, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-6", DO_COPY_TEXT, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M-}", DO_INDENT_VOID, 0, TRUE);
|
||||
@@ -1084,10 +1094,10 @@ void shortcut_init(bool unjustify)
|
||||
add_to_sclist(MALL, "kleft", DO_LEFT, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "^Q", XON_COMPLAINT, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "^S", XOFF_COMPLAINT, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^P", DO_UP_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MBROWSER, "kup", DO_UP_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^N", DO_DOWN_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MBROWSER, "kdown", DO_DOWN_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", DO_UP_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "kup", DO_UP_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", DO_DOWN_VOID, 0, TRUE);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "kdown", DO_DOWN_VOID, 0, TRUE);
|
||||
add_to_sclist(MALL, "^A", DO_HOME, 0, TRUE);
|
||||
add_to_sclist(MALL, "khome", DO_HOME, 0, TRUE);
|
||||
add_to_sclist(MALL, "^E", DO_END, 0, TRUE);
|
||||
@@ -1132,6 +1142,9 @@ void shortcut_init(bool unjustify)
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-|", FIRST_FILE_MSG, 0, TRUE);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-/", LAST_FILE_MSG, 0, TRUE);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", LAST_FILE_MSG, 0, TRUE);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "^_", GOTO_DIR_MSG, 0, TRUE);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "F13", GOTO_DIR_MSG, 0, TRUE);
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-G", GOTO_DIR_MSG, 0, TRUE);
|
||||
#ifndef NANO_TINY
|
||||
add_to_sclist(MMAIN, "M-]", DO_FIND_BRACKET, 0, TRUE);
|
||||
add_to_sclist(MMAIN, "M--", DO_SCROLL_UP, 0, TRUE);
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* help.c *
|
||||
* *
|
||||
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, *
|
||||
* 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
|
||||
23
src/move.c
23
src/move.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* move.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -55,7 +55,8 @@ void do_page_up(void)
|
||||
/* 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 (!ISSET(SOFTWRAP) && openfile->current->lineno <= editwinrows - 2) {
|
||||
if (openfile->current->lineno == 1 || (!ISSET(SOFTWRAP) &&
|
||||
openfile->current->lineno <= editwinrows - 2)) {
|
||||
do_first_line();
|
||||
return;
|
||||
}
|
||||
@@ -67,7 +68,7 @@ void do_page_up(void)
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
#endif
|
||||
openfile->current = openfile->edittop;
|
||||
openfile->placewewant = 0;
|
||||
openfile->placewewant = openfile->current_y = 0;
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
@@ -92,7 +93,7 @@ openfile->current->lineno, strlenpt(openfile->current->data));
|
||||
#endif
|
||||
|
||||
/* Scroll the edit window up a page. */
|
||||
edit_scroll(UP_DIR, editwinrows - skipped - 2);
|
||||
edit_update(NONE);
|
||||
}
|
||||
|
||||
/* Move down one page. */
|
||||
@@ -115,7 +116,7 @@ void do_page_down(void)
|
||||
if (!ISSET(SMOOTH_SCROLL)) {
|
||||
#endif
|
||||
openfile->current = openfile->edittop;
|
||||
openfile->placewewant = 0;
|
||||
openfile->placewewant = openfile->current_y = 0;
|
||||
#ifndef NANO_TINY
|
||||
}
|
||||
#endif
|
||||
@@ -133,7 +134,7 @@ void do_page_down(void)
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window down a page. */
|
||||
edit_scroll(DOWN_DIR, editwinrows - 2);
|
||||
edit_update(NONE);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
@@ -521,7 +522,7 @@ void do_up(
|
||||
#ifndef NANO_TINY
|
||||
(ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
editwinrows / 2 + 1);
|
||||
|
||||
/* If we're below the first line of the edit window, update the
|
||||
* line we were on before and the line we're on now. The former
|
||||
@@ -590,13 +591,15 @@ void do_down(
|
||||
#ifndef NANO_TINY
|
||||
|| scroll_only
|
||||
#endif
|
||||
)
|
||||
) {
|
||||
edit_scroll(DOWN_DIR,
|
||||
#ifndef NANO_TINY
|
||||
(ISSET(SMOOTH_SCROLL) || scroll_only) ? 1 :
|
||||
#endif
|
||||
editwinrows / 2);
|
||||
editwinrows / 2 + 1);
|
||||
|
||||
edit_refresh_needed = TRUE;
|
||||
}
|
||||
/* If we're above the last line of the edit window, update the line
|
||||
* we were on before and the line we're on now. The former needs to
|
||||
* be redrawn if we're not on the first page, and the latter needs
|
||||
|
||||
57
src/nano.c
57
src/nano.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* nano.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -518,6 +518,7 @@ openfilestruct *make_new_opennode(void)
|
||||
newnode->edittop = NULL;
|
||||
newnode->current = NULL;
|
||||
#ifndef NANO_TINY
|
||||
newnode->current_stat = NULL;
|
||||
newnode->last_action = OTHER;
|
||||
#endif
|
||||
|
||||
@@ -936,8 +937,8 @@ void version(void)
|
||||
{
|
||||
printf(_(" GNU nano version %s (compiled %s, %s)\n"), VERSION,
|
||||
__TIME__, __DATE__);
|
||||
printf(" (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007\n");
|
||||
printf(" Free Software Foundation, Inc.\n");
|
||||
printf(" (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,\n");
|
||||
printf(" 2008, 2009 Free Software Foundation, Inc.\n");
|
||||
printf(
|
||||
_(" Email: nano@nano-editor.org Web: http://www.nano-editor.org/"));
|
||||
printf(_("\n Compiled options:"));
|
||||
@@ -1066,6 +1067,8 @@ void do_exit(void)
|
||||
|
||||
static struct sigaction pager_oldaction, pager_newaction; /* Original and temporary handlers for SIGINT. */
|
||||
static bool pager_sig_failed = FALSE; /* Did sigaction() fail without changing the signal handlers? */
|
||||
static bool pager_input_aborted = FALSE; /* Did someone invoke the pager and abort it via ^C? */
|
||||
|
||||
|
||||
/* Things which need to be run regardless of whether
|
||||
we finished the stdin pipe correctly or not */
|
||||
@@ -1079,14 +1082,15 @@ void finish_stdin_pager(void)
|
||||
if (f == NULL)
|
||||
nperror("fopen");
|
||||
|
||||
read_file(f, 0, "stdin", TRUE);
|
||||
read_file(f, 0, "stdin", TRUE, FALSE);
|
||||
ttystdin = open("/dev/tty", O_RDONLY);
|
||||
if (!ttystdin)
|
||||
die(_("Couldn't reopen stdin from keyboard, sorry\n"));
|
||||
|
||||
dup2(ttystdin,0);
|
||||
close(ttystdin);
|
||||
tcgetattr(0, &oldterm);
|
||||
if (!pager_input_aborted)
|
||||
tcgetattr(0, &oldterm);
|
||||
if (!pager_sig_failed && sigaction(SIGINT, &pager_oldaction, NULL) == -1)
|
||||
nperror("sigaction");
|
||||
terminal_init();
|
||||
@@ -1098,13 +1102,15 @@ void finish_stdin_pager(void)
|
||||
RETSIGTYPE cancel_stdin_pager(int signal)
|
||||
{
|
||||
/* Currently do nothing, just handle the intr silently */
|
||||
pager_input_aborted = TRUE;
|
||||
}
|
||||
|
||||
/* Let nano read stdin for the first file at least */
|
||||
void stdin_pager(void)
|
||||
{
|
||||
endwin();
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
if (!pager_input_aborted)
|
||||
tcsetattr(0, TCSANOW, &oldterm);
|
||||
fprintf(stderr, _("Reading from stdin, ^C to abort\n"));
|
||||
|
||||
/* Set things up so that Ctrl-C will cancel the new process. */
|
||||
@@ -1124,7 +1130,7 @@ void stdin_pager(void)
|
||||
nperror("sigaction");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
open_buffer("", FALSE);
|
||||
finish_stdin_pager();
|
||||
}
|
||||
@@ -1262,8 +1268,10 @@ RETSIGTYPE handle_sigwinch(int signal)
|
||||
* otherwise. However, COLS and LINES are curses global variables,
|
||||
* and in some cases curses has already updated them. But not in
|
||||
* all cases. Argh. */
|
||||
#ifdef REDEFINIG_MACROS_OK
|
||||
COLS = win.ws_col;
|
||||
LINES = win.ws_row;
|
||||
#endif
|
||||
|
||||
/* If we've partitioned the filestruct, unpartition it now. */
|
||||
if (filepart != NULL)
|
||||
@@ -1625,7 +1633,7 @@ int do_input(bool *meta_key, bool *func_key, bool *s_or_t, bool
|
||||
#endif
|
||||
iso_me_harder_funcmap(s->scfunc);
|
||||
#ifdef ENABLE_COLOR
|
||||
if (!f->viewok && openfile->syntax != NULL
|
||||
if (f && !f->viewok && openfile->syntax != NULL
|
||||
&& openfile->syntax->nmultis > 0) {
|
||||
reset_multis(openfile->current, FALSE);
|
||||
}
|
||||
@@ -1893,17 +1901,15 @@ precalc_cleanup:
|
||||
* TRUE. */
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
{
|
||||
size_t current_len, i = 0;
|
||||
bool do_refresh = FALSE;
|
||||
/* Do we have to call edit_refresh(), or can we get away with
|
||||
* just update_line()? */
|
||||
|
||||
size_t current_len, orig_lenpt, i = 0;
|
||||
char *char_buf = charalloc(mb_cur_max());
|
||||
int char_buf_len;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
current_len = strlen(openfile->current->data);
|
||||
if (ISSET(SOFTWRAP))
|
||||
orig_lenpt = strlenpt(openfile->current->data);
|
||||
|
||||
while (i < output_len) {
|
||||
/* If allow_cntrls is TRUE, convert nulls and newlines
|
||||
@@ -1967,26 +1973,25 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
/* If we're wrapping text, we need to call edit_refresh(). */
|
||||
if (!ISSET(NO_WRAP)) {
|
||||
bool do_refresh_save = do_refresh;
|
||||
|
||||
do_refresh = do_wrap(openfile->current, FALSE);
|
||||
|
||||
/* If we needed to call edit_refresh() before this, we'll
|
||||
* still need to after this. */
|
||||
if (do_refresh_save)
|
||||
do_refresh = TRUE;
|
||||
}
|
||||
if (!ISSET(NO_WRAP))
|
||||
if (do_wrap(openfile->current, FALSE))
|
||||
edit_refresh_needed = TRUE;
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
/* If color syntaxes are available and turned on, we need to
|
||||
* call edit_refresh(). */
|
||||
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX))
|
||||
do_refresh = TRUE;
|
||||
edit_refresh_needed = TRUE;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Well we might also need a full refresh if we've changed the
|
||||
line length to be a new multiple of COLS */
|
||||
if (ISSET(SOFTWRAP) && edit_refresh_needed == FALSE)
|
||||
if (strlenpt(openfile->current->data) / COLS != orig_lenpt / COLS)
|
||||
edit_refresh_needed = TRUE;
|
||||
|
||||
free(char_buf);
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
@@ -1995,7 +2000,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
#ifdef ENABLE_COLOR
|
||||
reset_multis(openfile->current, FALSE);
|
||||
#endif
|
||||
if (do_refresh) {
|
||||
if (edit_refresh_needed == TRUE) {
|
||||
edit_refresh();
|
||||
edit_refresh_needed = FALSE;
|
||||
} else
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* nano.h *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -54,6 +54,9 @@
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
/* Suppress warnings for __attribute__((warn_unused_result)) */
|
||||
#define IGNORE_CALL_RESULT(call) do { if (call) {} } while(0)
|
||||
|
||||
/* Macros for flags. */
|
||||
#define FLAGOFF(flag) ((flag) / (sizeof(unsigned) * 8))
|
||||
#define FLAGMASK(flag) (1 << ((flag) % (sizeof(unsigned) * 8)))
|
||||
@@ -477,6 +480,7 @@ enum
|
||||
REBIND_KEYPAD,
|
||||
NO_CONVERT,
|
||||
BACKUP_FILE,
|
||||
INSECURE_BACKUP,
|
||||
NO_COLOR_SYNTAX,
|
||||
PRESERVE,
|
||||
HISTORYLOG,
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* prompt.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -229,7 +229,7 @@ int do_statusbar_input(bool *meta_key, bool *func_key, bool *have_shortcut,
|
||||
f = sctofunc((sc *) s);
|
||||
if (s->scfunc != 0 && s->execute == TRUE) {
|
||||
*ran_func = TRUE;
|
||||
if (!ISSET(VIEW_MODE) || f->viewok)
|
||||
if (f && (!ISSET(VIEW_MODE) || (f->viewok)))
|
||||
iso_me_harder_funcmap(f->scfunc);
|
||||
}
|
||||
*finished = TRUE;
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* proto.h *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -271,7 +271,7 @@ bool close_buffer(void);
|
||||
#endif
|
||||
filestruct *read_line(char *buf, filestruct *prevnode, bool
|
||||
*first_line_ins, size_t buf_len);
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable);
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable, bool checkwritable);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
void do_insertfile(
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
/**************************************************************************
|
||||
* rcfile.c *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
@@ -77,6 +77,7 @@ static const rcoption rcopts[] = {
|
||||
#ifndef NANO_TINY
|
||||
{"autoindent", AUTOINDENT},
|
||||
{"backup", BACKUP_FILE},
|
||||
{"allow_insecure_backup", INSECURE_BACKUP},
|
||||
{"backupdir", 0},
|
||||
{"backwards", BACKWARDS_SEARCH},
|
||||
{"casesensitive", CASE_SENSITIVE},
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* search.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -1357,7 +1357,7 @@ void update_history(filestruct **h, const char *s)
|
||||
assert(hage != NULL && hbot != NULL);
|
||||
|
||||
/* If this string is already in the history, delete it. */
|
||||
p = find_history(*hage, *hbot, s, (size_t)-1);
|
||||
p = find_history(*hage, *hbot, s, strlen(s));
|
||||
|
||||
if (p != NULL) {
|
||||
filestruct *foo, *bar;
|
||||
|
||||
36
src/text.c
36
src/text.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* text.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -66,9 +66,7 @@ void do_mark(void)
|
||||
/* Delete the character under the cursor. */
|
||||
void do_delete(void)
|
||||
{
|
||||
bool do_refresh = FALSE;
|
||||
/* Do we have to call edit_refresh(), or can we get away with
|
||||
* just update_line()? */
|
||||
size_t orig_lenpt = 0;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
update_undo(DEL);
|
||||
@@ -86,6 +84,9 @@ void do_delete(void)
|
||||
|
||||
assert(openfile->current_x < strlen(openfile->current->data));
|
||||
|
||||
if (ISSET(SOFTWRAP))
|
||||
orig_lenpt = strlenpt(openfile->current->data);
|
||||
|
||||
/* Let's get dangerous. */
|
||||
charmove(&openfile->current->data[openfile->current_x],
|
||||
&openfile->current->data[openfile->current_x +
|
||||
@@ -108,7 +109,7 @@ void do_delete(void)
|
||||
/* If we're deleting at the end of a line, we need to call
|
||||
* edit_refresh(). */
|
||||
if (openfile->current->data[openfile->current_x] == '\0')
|
||||
do_refresh = TRUE;
|
||||
edit_refresh_needed = TRUE;
|
||||
|
||||
openfile->current->data = charealloc(openfile->current->data,
|
||||
openfile->current_x + strlen(foo->data) + 1);
|
||||
@@ -138,11 +139,13 @@ void do_delete(void)
|
||||
} else
|
||||
return;
|
||||
|
||||
if (ISSET(SOFTWRAP) && edit_refresh_needed == FALSE)
|
||||
if (strlenpt(openfile->current->data) / COLS != orig_lenpt / COLS)
|
||||
edit_refresh_needed = TRUE;
|
||||
|
||||
set_modified();
|
||||
|
||||
if (do_refresh)
|
||||
edit_refresh_needed = TRUE;
|
||||
else
|
||||
if (edit_refresh_needed == FALSE)
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
|
||||
@@ -481,6 +484,7 @@ void do_undo(void)
|
||||
if (u->xflags == UNDO_DEL_BACKSPACE)
|
||||
openfile->current_x += strlen(u->strdata);
|
||||
break;
|
||||
#ifndef DISABLE_WRAPPING
|
||||
case SPLIT:
|
||||
undidmsg = _("line wrap");
|
||||
f->data = (char *) nrealloc(f->data, strlen(f->data) + strlen(u->strdata) + 1);
|
||||
@@ -494,6 +498,7 @@ void do_undo(void)
|
||||
}
|
||||
renumber(f);
|
||||
break;
|
||||
#endif /* DISABLE_WRAPPING */
|
||||
case UNSPLIT:
|
||||
undidmsg = _("line join");
|
||||
t = make_new_node(f);
|
||||
@@ -618,6 +623,7 @@ void do_redo(void)
|
||||
do_gotolinecolumn(u->lineno, u->begin+1, FALSE, FALSE, FALSE, FALSE);
|
||||
do_enter(TRUE);
|
||||
break;
|
||||
#ifndef DISABLE_WRAPPING
|
||||
case SPLIT:
|
||||
undidmsg = _("line wrap");
|
||||
if (u->xflags & UNDO_SPLIT_MADENEW)
|
||||
@@ -625,6 +631,7 @@ void do_redo(void)
|
||||
do_wrap(f, TRUE);
|
||||
renumber(f);
|
||||
break;
|
||||
#endif /* DISABLE_WRAPPING */
|
||||
case UNSPLIT:
|
||||
undidmsg = _("line join");
|
||||
len = strlen(f->data) + strlen(u->strdata + 1);
|
||||
@@ -812,7 +819,7 @@ bool execute_command(const char *command)
|
||||
if (f == NULL)
|
||||
nperror("fdopen");
|
||||
|
||||
read_file(f, 0, "stdin", TRUE);
|
||||
read_file(f, 0, "stdin", TRUE, FALSE);
|
||||
|
||||
if (wait(NULL) == -1)
|
||||
nperror("wait");
|
||||
@@ -900,6 +907,7 @@ void add_undo(undo_type current_action)
|
||||
u->strdata = data;
|
||||
}
|
||||
break;
|
||||
#ifndef DISABLE_WRAPPING
|
||||
case SPLIT:
|
||||
wrap_loc = break_line(openfile->current->data, fill
|
||||
#ifndef DISABLE_HELP
|
||||
@@ -913,6 +921,7 @@ void add_undo(undo_type current_action)
|
||||
u->strdata2 = mallocstrcpy(NULL, fs->current->next->data);
|
||||
u->begin = wrap_loc;
|
||||
break;
|
||||
#endif /* DISABLE_WRAPPING */
|
||||
case INSERT:
|
||||
case REPLACE:
|
||||
data = mallocstrcpy(NULL, fs->current->data);
|
||||
@@ -1058,11 +1067,13 @@ void update_undo(undo_type action)
|
||||
case INSERT:
|
||||
u->mark_begin_lineno = openfile->current->lineno;
|
||||
break;
|
||||
#ifndef DISABLE_WRAPPING
|
||||
case SPLIT:
|
||||
/* This will only be called if we made a completely new line,
|
||||
and as such we should note that so we can destroy it later */
|
||||
u->xflags = UNDO_SPLIT_MADENEW;
|
||||
break;
|
||||
#endif /* DISABLE_WRAPPING */
|
||||
case UNSPLIT:
|
||||
/* These cases are handled by the earlier check for a new line and action */
|
||||
case ENTER:
|
||||
@@ -2741,6 +2752,11 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
}
|
||||
#endif
|
||||
|
||||
if (openfile->totsize == 0) {
|
||||
statusbar(_("Finished checking spelling"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
endwin();
|
||||
|
||||
/* Set up an argument list to pass execvp(). */
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* utils.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
|
||||
69
src/winio.c
69
src/winio.c
@@ -2,8 +2,8 @@
|
||||
/**************************************************************************
|
||||
* winio.c *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 *
|
||||
* Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009 Free Software Foundation, Inc. *
|
||||
* This program is free software; you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published by *
|
||||
* the Free Software Foundation; either version 3, or (at your option) *
|
||||
@@ -1746,7 +1746,7 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts)
|
||||
* wheel is equivalent to moving down three lines. */
|
||||
for (i = 0; i < 3; i++)
|
||||
unget_kbinput((mevent.bstate & BUTTON4_PRESSED) ?
|
||||
sc_seq_or(do_up_void, 0) : sc_seq_or(DO_DOWN_VOID, 0);, FALSE,
|
||||
sc_seq_or(DO_UP_VOID, 0) : sc_seq_or(DO_DOWN_VOID, 0), FALSE,
|
||||
FALSE);
|
||||
|
||||
return 1;
|
||||
@@ -2935,7 +2935,7 @@ bool need_vertical_update(size_t pww_save)
|
||||
}
|
||||
|
||||
/* When edittop changes, try and figure out how many lines
|
||||
* we really have to work with (i.e. set maxrows)
|
||||
* we really have to work with (i.e. set maxrows)
|
||||
*/
|
||||
void compute_maxrows(void)
|
||||
{
|
||||
@@ -2988,12 +2988,9 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Softwrap: Entering check for extracuzsoft\n");
|
||||
#endif
|
||||
for (i = editwinrows, foo = openfile->edittop; foo && i > 0; i--, foo = foo->next) {
|
||||
ssize_t len = strlenpt(foo->data) / COLS;
|
||||
if (len > 0)
|
||||
do_redraw = TRUE;
|
||||
i -= len;
|
||||
}
|
||||
for (i = maxrows, foo = openfile->edittop; foo && i > 0; i--, foo = foo->next)
|
||||
;
|
||||
|
||||
if (foo) {
|
||||
extracuzsoft += strlenpt(foo->data) / COLS;
|
||||
#ifdef DEBUG
|
||||
@@ -3001,7 +2998,6 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
(unsigned long) strlenpt(foo->data), (unsigned long) foo->lineno);
|
||||
#endif
|
||||
|
||||
|
||||
/* Now account for whether the edittop line itself is >COLS, if scrolling down */
|
||||
for (foo = openfile->edittop; foo && extracuzsoft > 0; nlines++) {
|
||||
extracuzsoft -= 1 + strlenpt(foo->data) / COLS;
|
||||
@@ -3013,13 +3009,6 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
foo = foo->next;
|
||||
}
|
||||
}
|
||||
} else if (ISSET(SOFTWRAP) && direction == UP_DIR) {
|
||||
for (foo = openfile->edittop, i = editwinrows; foo && i > 0; i--, foo = foo->prev) {
|
||||
if (strlenpt(foo->data) / COLS > 0) {
|
||||
do_redraw = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Part 1: nlines is the number of lines we're going to scroll the
|
||||
@@ -3039,11 +3028,14 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
openfile->edittop = openfile->edittop->next;
|
||||
}
|
||||
/* Don't over-scroll on long lines */
|
||||
if (ISSET(SOFTWRAP))
|
||||
i -= strlenpt(openfile->edittop->data) / COLS;
|
||||
if (ISSET(SOFTWRAP)) {
|
||||
ssize_t len = strlenpt(openfile->edittop->data) / COLS;
|
||||
i -= len;
|
||||
if (len > 0)
|
||||
do_redraw = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
compute_maxrows();
|
||||
/* Limit nlines to the number of lines we could scroll. */
|
||||
nlines -= i;
|
||||
|
||||
@@ -3052,7 +3044,7 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
* call edit_refresh() beforehand if we need to. */
|
||||
if (nlines == 0 || do_redraw || nlines >= editwinrows) {
|
||||
if (do_redraw || nlines >= editwinrows)
|
||||
edit_refresh();
|
||||
edit_refresh_needed = TRUE;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3128,6 +3120,10 @@ void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
openfile->edittop->lineno || openfile->current->lineno >=
|
||||
openfile->edittop->lineno + maxrows) {
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "edit_redraw(): line %lu was offscreen, oldcurrent = %lu edittop = %lu", openfile->current->lineno,
|
||||
old_current->lineno, openfile->edittop->lineno);
|
||||
#endif
|
||||
filestruct *old_edittop = openfile->edittop;
|
||||
ssize_t nlines;
|
||||
|
||||
@@ -3160,24 +3156,13 @@ 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(NONE);
|
||||
|
||||
nlines = openfile->edittop->lineno - old_edittop->lineno;
|
||||
|
||||
openfile->edittop = old_edittop;
|
||||
edit_update(CENTER);
|
||||
|
||||
/* Update old_current if we're not on the same page as
|
||||
* before. */
|
||||
if (do_redraw)
|
||||
update_line(old_current, 0);
|
||||
|
||||
/* Scroll the edit window up or down until edittop is in range
|
||||
* of current. */
|
||||
if (nlines < 0)
|
||||
edit_scroll(UP_DIR, -nlines);
|
||||
else
|
||||
edit_scroll(DOWN_DIR, nlines);
|
||||
|
||||
#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
|
||||
@@ -3239,7 +3224,7 @@ void edit_refresh(void)
|
||||
|
||||
/* Put the top line of the edit window in range of the current
|
||||
* line. */
|
||||
edit_update(NONE);
|
||||
edit_update(CENTER);
|
||||
}
|
||||
|
||||
foo = openfile->edittop;
|
||||
@@ -3279,22 +3264,26 @@ 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 = maxrows / 2;
|
||||
goal = editwinrows / 2;
|
||||
else {
|
||||
goal = openfile->current_y;
|
||||
|
||||
/* Limit goal to (editwinrows - 1) lines maximum. */
|
||||
if (goal > maxrows - 1)
|
||||
goal = maxrows - 1;
|
||||
if (goal > editwinrows - 1)
|
||||
goal = editwinrows - 1;
|
||||
}
|
||||
|
||||
for (; goal > 0 && foo->prev != NULL; goal--) {
|
||||
if (ISSET(SOFTWRAP))
|
||||
goal -= 1 + strlenpt(foo->data) / COLS;
|
||||
foo = foo->prev;
|
||||
if (ISSET(SOFTWRAP) && foo)
|
||||
goal -= strlenpt(foo->data) / COLS;
|
||||
}
|
||||
openfile->edittop = foo;
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "edit_udpate(), setting edittop to lineno %d\n", openfile->edittop->lineno);
|
||||
#endif
|
||||
compute_maxrows();
|
||||
edit_refresh_needed = TRUE;
|
||||
}
|
||||
|
||||
/* Unconditionally redraw the entire screen. */
|
||||
|
||||
Reference in New Issue
Block a user