Compare commits
90 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0f45b26cb9 | ||
|
|
6f352038da | ||
|
|
de5b2634c8 | ||
|
|
e39938c1fa | ||
|
|
d4118efea5 | ||
|
|
6c82fd65ad | ||
|
|
65efed5f97 | ||
|
|
b8e0e22d64 | ||
|
|
fddad2636d | ||
|
|
9646d7c87d | ||
|
|
14d1b3bd36 | ||
|
|
d83bd7e305 | ||
|
|
ef2cfa31a7 | ||
|
|
0dbc867a16 | ||
|
|
cdeb90515b | ||
|
|
e853c1ee7c | ||
|
|
e5fee7e649 | ||
|
|
836fa7066a | ||
|
|
98a8c06394 | ||
|
|
12f27299f1 | ||
|
|
05334a2b3c | ||
|
|
22a01cad9e | ||
|
|
8585bf2dd4 | ||
|
|
2cfa96bde9 | ||
|
|
d844f05a1e | ||
|
|
97dcd377e7 | ||
|
|
cc2d37053c | ||
|
|
6829241433 | ||
|
|
cca22bb10a | ||
|
|
5a5144b75a | ||
|
|
2a2e012064 | ||
|
|
7ade5deabe | ||
|
|
7b74fedc05 | ||
|
|
ba987350a9 | ||
|
|
f96f4fe616 | ||
|
|
68ab4b848b | ||
|
|
98e72f50e6 | ||
|
|
41f08534d9 | ||
|
|
f8ed6bb099 | ||
|
|
d8801ec10e | ||
|
|
a93a11eb42 | ||
|
|
5688c160a9 | ||
|
|
65c7c810bc | ||
|
|
7256b055b1 | ||
|
|
3331828696 | ||
|
|
2b72f1d1f1 | ||
|
|
ae42240c33 | ||
|
|
87460b5998 | ||
|
|
decee32067 | ||
|
|
f01dd29f48 | ||
|
|
53c8ada24b | ||
|
|
eed1aab3f0 | ||
|
|
b8d32d8b7b | ||
|
|
8c705b5dc2 | ||
|
|
cd1d435ac7 | ||
|
|
3a3b1764af | ||
|
|
0af2f9e55c | ||
|
|
a443760d80 | ||
|
|
7a1709f03b | ||
|
|
aa7edb7fc2 | ||
|
|
a68e1627dc | ||
|
|
fe3d849a75 | ||
|
|
a91a1c7bbd | ||
|
|
8bd76d8302 | ||
|
|
f8f2d63107 | ||
|
|
13ba5432cd | ||
|
|
a3a69eec02 | ||
|
|
ffae582aab | ||
|
|
f845938e86 | ||
|
|
38acacb461 | ||
|
|
caa759be31 | ||
|
|
dfeb0f938f | ||
|
|
0ee7729666 | ||
|
|
63370954bd | ||
|
|
33fb1746dd | ||
|
|
431cec477d | ||
|
|
8a9f71639f | ||
|
|
8f463778d1 | ||
|
|
ba7ac78e36 | ||
|
|
34fbb1f4de | ||
|
|
ecf3cd7244 | ||
|
|
96b9249f91 | ||
|
|
774c8ba1bf | ||
|
|
73ee7d7ee5 | ||
|
|
deb271d708 | ||
|
|
cb832bef1b | ||
|
|
583b67bad2 | ||
|
|
5b350b86ba | ||
|
|
53991cf073 | ||
|
|
3f31bbcb7a |
3
AUTHORS
3
AUTHORS
@@ -1,5 +1,4 @@
|
||||
$Id$
|
||||
This file lists people who have made significant contribution to the
|
||||
This file lists people who have made significant contributions to the
|
||||
nano editor. Please see the ChangeLog for specific changes by author.
|
||||
-------------------------------------------------------------------------
|
||||
|
||||
|
||||
186
ChangeLog
186
ChangeLog
@@ -1,4 +1,186 @@
|
||||
GNU nano 2.5.0 - 2016.01.11
|
||||
GNU nano 2.5.2 - 2016.02.12
|
||||
|
||||
2016-02-11 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_linter): Go to the next item in the list before
|
||||
freeing the current one. This fixes Savannah bug #46796.
|
||||
* src/text.c (do_formatter): Don't leave curses mode, as that would
|
||||
hide any error messages upon reentry. And if there are any messages,
|
||||
allow the user a little time to read them.
|
||||
* src/text.c (do_linter, do_formatter): Condense some declarations,
|
||||
rewrap some lines, and improve a few comments.
|
||||
* doc/syntax/go.nanorc: Make the formatter command more visible.
|
||||
|
||||
2016-02-10 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (discard_until): Prevent a chain of editing actions from
|
||||
continuing after a discard. This fixes Savannah bug #47104.
|
||||
* src/files.c (get_full_path): Plug a sneaky memory leak. This fixes
|
||||
Savannah bug #47003 reported and solved by Mike Frysinger.
|
||||
* src/rcfile.c (parse_binding): Allow only control sequences in the
|
||||
proper range to be rebound. This fixes Savannah bug #47025.
|
||||
* THANKS: Add a Spanish, a Catalan, and a Croat translator.
|
||||
* AUTHORS, THANKS: Remove SVN Id tags and a duplication.
|
||||
* src/winio.c (get_kbinput), src/nano.c (main): Switch the cursor on
|
||||
in the right place: in the central input routine.
|
||||
* src/files.c (load_poshistory): Free any records that are dropped.
|
||||
This fixes Savannah bug #47111 reported by Mike Frysinger.
|
||||
|
||||
2016-02-09 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (stat_with_alloc, open_buffer, write_file): Check the
|
||||
result of a stat() to avoid referencing unitialized data. Original
|
||||
patch was by Kamil Dudka.
|
||||
* doc/man/{nano.1,rnano.1,nanorc.5}: Adjust version for release.
|
||||
|
||||
2016-02-07 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (update_poshistory): Don't put files in the history list
|
||||
when they have the default cursor position (line 1, column 1).
|
||||
* src/files.c (write_file): Avoid a pointless lstat() when not writing
|
||||
to a temp file, and in the bargain elide two variables.
|
||||
* src/files.c (write_file): Elide an unneeded 'if'.
|
||||
* doc/syntax/c.nanorc: Use a character class instead of a literal tab
|
||||
and space. The change was inspired by David Niklas.
|
||||
* src/prompt.c (do_yesno_prompt): Normalize the indentation.
|
||||
* src/prompt.c (do_yesno_prompt): Rename a variable.
|
||||
|
||||
2016-02-06 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (write_file): Remove the --nofollow option that hasn't
|
||||
been working for a dozen years.
|
||||
* src/winio.c (statusbar): Update the screen immediately whenever a
|
||||
message has been posted on the status bar.
|
||||
* src/winio.c (statusbar), src/nano.c (do_input): Turn the cursor off
|
||||
when writing in the status bar, and on when waiting for input.
|
||||
* src/prompt.c (update_the_statusbar): Chop two parameters that are
|
||||
always the same, and that are global variables anyway.
|
||||
* src/prompt.c (update_bar_if_needed): Rename this for more contrast.
|
||||
* src/prompt.c (do_statusbar_backspace): Avoid updating the bar twice.
|
||||
* src/cut.c, src/files.c, src/prompt.c: Rewrap some lines and remove
|
||||
some useless comments.
|
||||
|
||||
2016-02-05 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/texinfo/nano.texi: Condense the descriptions of command-key
|
||||
sequences and of the screen layout, mention how to enter Unicode,
|
||||
and mention that regular expressions are line oriented.
|
||||
* src/global.c (shortcut_init): Put four strings in standard order.
|
||||
* src/text.c (do_undo), src/global.c (shortcut_init): Guide the
|
||||
translators a little bit.
|
||||
|
||||
2016-01-31 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (has_valid_path): Be more specific in how a given path
|
||||
is invalid. The change was improved by Rishabh Dave.
|
||||
* doc/syntax/nanorc.nanorc: Show ^^ and M-^ as valid key names.
|
||||
* src/prompt.c (do_statusbar_home): Make Home go always fully home.
|
||||
|
||||
2016-01-29 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (do_insertfile): Do display the buffer when configured
|
||||
with only --disable-histories. This fixes Savannah bug #47011.
|
||||
* src/nano.c (main): Check position history only when 'positionlog'
|
||||
is set. This fixes a bug unconsciously reported by Mike Frysinger.
|
||||
* src/files.c (do_lockfile): Plug a couple of memory leaks.
|
||||
* src/files.c (update_poshistory): Plug another memory leak.
|
||||
* src/files.c (close_buffer): Update position history only when
|
||||
the option 'positionlog' is set.
|
||||
|
||||
2016-01-26 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (update_poshistory): Do not add directories to the
|
||||
list of file positions. This fixes Savannah bug #46971.
|
||||
* src/*.c: Adjust some indentation and some line wrapping.
|
||||
* src/prompt.c (do_statusbar_prev_word): When in the middle of a
|
||||
word, jump to the start of the current word, not to the start of
|
||||
the preceding one. This fixes Savannah bug #46970.
|
||||
* src/prompt.c (do_statusbar_next_word): Use simpler algorithm.
|
||||
|
||||
2016-01-25 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (update_poshistory): Handle an update of the first
|
||||
element correctly.
|
||||
* doc/texinfo/nano.texi: Document the --enable-altrcname option.
|
||||
The lack of this was pointed out by Frank.
|
||||
* doc/man/nano.1, doc/man/nanorc.5, doc/texinfo/nano.texi: Mention
|
||||
that the position history is limited to the 200 most recent files.
|
||||
|
||||
2016-01-24 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (update_poshistory): Move an updated item to the end
|
||||
of the list, so that it won't be dropped any time soon. The problem
|
||||
was pointed out by David Niklas.
|
||||
* src/winio.c (edit_redraw): Condense by removing a triplication.
|
||||
* src/prompt.c (do_statusbar_prev_word, do_statusbar_next_word):
|
||||
Chop an always-FALSE parameter and delete an unused return value.
|
||||
* src/prompt.c (do_prompt): Remove a superfluous free.
|
||||
* src/prompt.c (update_the_bar): Bundle some statements.
|
||||
* src/prompt.c (need_statusbar_update): Elide this function.
|
||||
* src/prompt.c (total_statusbar_refresh): Elide this function too.
|
||||
|
||||
2016-01-22 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/utils.c (get_homedir): Don't use $HOME when we're root, because
|
||||
some sudos don't filter it out of the environment (which can lead to
|
||||
a root-owned .nano/ directory in the invoking user's home directory).
|
||||
It fixes https://bugs.launchpad.net/ubuntu/+source/nano/+bug/1471459.
|
||||
* src/files.c (read_line): Rename a variable for clarity and contrast.
|
||||
|
||||
2016-01-21 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/prompt.c (get_prompt_string): Preserve the cursor position on
|
||||
the statusbar when just toggling a setting or making an excursion to
|
||||
the file browser. This fixes Savannah bug #46945.
|
||||
* src/prompt.c (do_prompt_abort): Remove this unneeded function, as
|
||||
nothing can break out of do_prompt(), not a SIGWINCH either.
|
||||
* src/prompt.c (get_prompt_string): Delete code that is dead now.
|
||||
* src/prompt.c (get_prompt_string): Elide an unneeded variable.
|
||||
* src/browser.c (do_browser): Delete unneeded blanking of a variable.
|
||||
|
||||
2016-01-20 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (open_buffer): Readjust the indentation and a comment.
|
||||
* src/files.c (has_valid_path): Get rid of a global variable.
|
||||
|
||||
2016-01-20 Rishabh Dave <rishabhddave@gmail.com>
|
||||
* src/files.c (verify_path, open_buffer): When opening a new buffer,
|
||||
verify that the containing directory of the given filename exists.
|
||||
This fixes Savannah bug #44950.
|
||||
* src/files.c (do_lockfile): Remove the existence check on the
|
||||
directory, as this is now covered by verify_path().
|
||||
|
||||
2016-01-17 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/global.c: Fix typo in #ifndef symbol. Reported by Frank.
|
||||
* doc/syntax/nanorc.nanorc: Remove '+' as only one menu is allowed.
|
||||
* src/files.c (load_poshistory): Limit the number of loaded items.
|
||||
|
||||
2016-01-17 Mike Frysinger <vapier@gentoo.org>
|
||||
* doc/syntax/nanorc.nanorc: Allow inline comments with key bindings.
|
||||
|
||||
2016-01-15 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/winio.c (set_modified): Plug another memory leak.
|
||||
* src/files.c (set_modified): Move this function to its habitat.
|
||||
* src/files.c (open_file): Return the fantastic file descriptor
|
||||
when opening a non-existent file for reading succeeds.
|
||||
* src/nano.c (delete_opennode), src/text.c (discard_until):
|
||||
Free the items on the undo stack when a buffer is closed.
|
||||
This fixes Savannah bug #46904 reported by Mike Frysinger.
|
||||
|
||||
2016-01-15 Mike Frysinger <vapier@gentoo.org>
|
||||
* src/files.c (open_file): Free the full filename in all cases.
|
||||
|
||||
2016-01-14 Benno Schulenberg <bensberg@justemail.net>
|
||||
* doc/nanorc.sample.in: Remove a reference to an obsolete file.
|
||||
Reported by Mike Frysinger.
|
||||
* src/winio.c (edit_redraw): Delete an 'if' that is always FALSE.
|
||||
* src/winio.c (edit_redraw): Elide an unneeded variable and adjust
|
||||
some wrappings and whitespace.
|
||||
* src/proto.h: Delete two duplicate declarations.
|
||||
* src/rcfile.c (check_bad_binding): Elide this unneeded function.
|
||||
* src/rcfile.c (parse_binding): Show key only when it was rebound.
|
||||
|
||||
2016-01-13 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/files.c (save_poshistory): Reduce the indentation.
|
||||
* src/*.c: Adjust a few comments and rewrap some lines.
|
||||
|
||||
2016-01-12 Benno Schulenberg <bensberg@justemail.net>
|
||||
* NEWS: Fix some typos and whitespace, and normalize the dates.
|
||||
* src/files.c (load_poshistory): Rename a variable.
|
||||
* src/files.c (load_poshistory): Remove some code duplication.
|
||||
* src/files.c (save_poshistory, update_poshistory, check_poshistory,
|
||||
load_poshistory): Differentiate variable name from function names.
|
||||
* src/files.c (load_poshistory): Remove a senseless iteration.
|
||||
* src/files.c (load_poshistory): Condense the reading of a line.
|
||||
* src/files.c (load_poshistory): Reduce the indentation.
|
||||
|
||||
GNU nano 2.5.1 - 2016.01.11
|
||||
|
||||
2016-01-10 Benno Schulenberg <bensberg@justemail.net>
|
||||
* NEWS: Add item for upcoming 2.5.1.
|
||||
@@ -53,7 +235,7 @@ GNU nano 2.5.0 - 2016.01.11
|
||||
2015-12-31 Benno Schulenberg <bensberg@justemail.net>
|
||||
* src/text.c (do_formatter): Restore the cursor position differently.
|
||||
* src/search.c (do_gotopos): Delete this now unused function.
|
||||
* src/search.c (do_gotolinecolumn): Chop an always FALSE parameter.
|
||||
* src/search.c (do_gotolinecolumn): Chop an always-FALSE parameter.
|
||||
* src/search.c (do_gotolinecolumn): Chop a duplicate parameter --
|
||||
'allow_update' always has the same value as 'interactive'.
|
||||
|
||||
|
||||
156
NEWS
156
NEWS
@@ -1,3 +1,11 @@
|
||||
2016.02.12 - GNU nano 2.5.2 is carrying too many dogs. This release includes
|
||||
several fixes for various memory leaks, position history
|
||||
size growth, and a long standing issue with using
|
||||
nano under sudo creading root-owned files. There are also
|
||||
the usual bevy of documentation and other miscellaneous
|
||||
fixes and touch ups. Upgrade today while supplies last,
|
||||
operators are standing by!
|
||||
|
||||
2016.01.11 - GNU nano 2.5.1 "Salzburg" is released. It includes fixes
|
||||
for a syntax-highlighting bug and a positionlog bug, it
|
||||
disables a time-eating multiline regex in the C syntax,
|
||||
@@ -8,9 +16,9 @@
|
||||
invited to upgrade. Enjoy!
|
||||
|
||||
2015.12.05 - GNU nano 2.5.0 "Karma", the first release of the 2.5 series,
|
||||
is now available. Please note that as of this release,
|
||||
is now available. Please note that as of this release,
|
||||
there will no longer be separate stable and unstable
|
||||
branches. The development team will prioritize bug fixes
|
||||
branches. The development team will prioritize bug fixes
|
||||
as needed, and make new releases in proportion to the
|
||||
severity of the bugs which are fixed.
|
||||
This release includes all of the fixes now in
|
||||
@@ -229,7 +237,7 @@
|
||||
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 sample nanorc.
|
||||
missing syntax highlighting entries for the sample 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
|
||||
@@ -259,7 +267,7 @@
|
||||
Friday discount. Included are some (hopefully
|
||||
final) fixes for issues with last page display
|
||||
caused by the soft wrapping code, and a fix for
|
||||
a long standing issue with hittig the home key when
|
||||
a long standing issue with hitting the Home key when
|
||||
going through the search history. On the features
|
||||
front, nano will now attempt to retain the proper
|
||||
ownership and permissions when trying to create a
|
||||
@@ -340,7 +348,7 @@
|
||||
modifications when saving a file, some code and
|
||||
documentation cleanups, and more bug fixes for
|
||||
the new undo code (but we continue to welcome your bug
|
||||
reports via the Savananh bug page at
|
||||
reports via the Savannah bug page at
|
||||
http://savannah.gnu.org/bugs/?func=additem&group=nano.
|
||||
Come get some.
|
||||
|
||||
@@ -377,8 +385,8 @@
|
||||
files when using backup mode has changed as well: if writing
|
||||
the backup file fails, nano will not attempt to write the
|
||||
current file. This should help folks who enjoy "extreme
|
||||
text editing" i.e. editing files on file systems which
|
||||
are likely to run out of space; see Savannah bug 24000.
|
||||
text editing", i.e. editing files on file systems which
|
||||
are likely to run out of space; see Savannah bug #24000.
|
||||
Have fun with it!
|
||||
|
||||
2008.08.04 - GNU nano 2.1.3 "least stable version ever" is released. This
|
||||
@@ -413,7 +421,7 @@
|
||||
|
||||
2008.03.18 - GNU nano 2.1.0 "under old mismanagement" is released.
|
||||
This first release in the 2.1 development series
|
||||
introduces rebinadble keys for most actions inside
|
||||
introduces rebindable keys for most actions inside
|
||||
the editor. Please see the nanorc(5) page for
|
||||
more information on configuring key bindings. Please
|
||||
also report all keybinding bugs (crashes, missing
|
||||
@@ -707,7 +715,7 @@
|
||||
features in this release, including a restricted mode
|
||||
that provides better security than just setting an
|
||||
operating directory, the ability to justify the entire
|
||||
file at once, support for a "smart" home key that can
|
||||
file at once, support for a "smart" Home key that can
|
||||
leap from the beginning of text on a line to the true
|
||||
beginning of the line (or the reverse) in one stroke,
|
||||
support for specifying an alternative spell checker in
|
||||
@@ -856,7 +864,7 @@
|
||||
Please send all new feedback on this release
|
||||
direct to the development list (nano-devel@gnu.org).
|
||||
|
||||
10/24/2002 - GNU nano 1.1.12 "Make Jordi happy" is released. This
|
||||
2002.10.24 - GNU nano 1.1.12 "Make Jordi happy" is released. This
|
||||
release demonstrates that nano is starting to freeze for
|
||||
version 1.2. New features include a Meta-Y toggle for
|
||||
syntax highlighting, pluralized i18n, and a handler for
|
||||
@@ -869,7 +877,7 @@
|
||||
(currently up in the air) search history behavior, the
|
||||
next version of nano should be 1.1.99pre1. Have fun!
|
||||
|
||||
10/01/2002 - GNU nano 1.1.11 "Oddball" is released. This release
|
||||
2002.10.01 - GNU nano 1.1.11 "Oddball" is released. This release
|
||||
features a new version of gettext, a new and improved
|
||||
syntax highlighting engine, and some updates for the
|
||||
nanorc.sample file. The toggles for case sensitivity
|
||||
@@ -886,7 +894,7 @@
|
||||
word and next word, nanorc parser and line wrapping
|
||||
code. Have fun!
|
||||
|
||||
07/25/2002 - At long last! GNU nano 1.1.10 "What didn't we break?" is
|
||||
2002.07.25 - At long last! GNU nano 1.1.10 "What didn't we break?" is
|
||||
released. This version of GNU nano features version
|
||||
0.11.2 of gettext, building with automake 1.6, some new
|
||||
code for displaying control characters, browser
|
||||
@@ -900,7 +908,7 @@
|
||||
updated, and the --quotestr and --regexp really work
|
||||
now ;-) Enjoy :)
|
||||
|
||||
05/12/2002 - GNU nano 1.1.9 is released, happy Mother's Day! This
|
||||
2002.05.12 - GNU nano 1.1.9 is released, happy Mother's Day! This
|
||||
release includes many new features, including a prepend
|
||||
mode (^O,M-P), a new "syntax" command in the .nanorc to
|
||||
allow multiple syntax highlighting types, and a new -Y,
|
||||
@@ -915,7 +923,7 @@
|
||||
been fixed. A lot of new stuff for everyone's favorite
|
||||
text editor ;) Have fun!
|
||||
|
||||
03/30/2002 - GNU nano 1.1.8 is released. New features include an
|
||||
2002.03.30 - GNU nano 1.1.8 is released. New features include an
|
||||
"Insert Output of External Command", ^R^X, and a .spec
|
||||
file is now included in the distribution. There are
|
||||
cleanups in the usage code, fixes for regex parsing, the
|
||||
@@ -925,9 +933,9 @@
|
||||
Also, the "show position" code now shows the starting
|
||||
column as 1 instead of 0. Have fun!
|
||||
|
||||
03/05/2002 - GNU nano 1.1.7 "lets change everything and see what breaks"
|
||||
2002.03.05 - GNU nano 1.1.7 "lets change everything and see what breaks"
|
||||
is released. New features include new flags
|
||||
-N,--noconvert to stop any file format conversion and
|
||||
-N, --noconvert to stop any file format conversion and
|
||||
-Q, --quotestr for the new quoted text justification, a
|
||||
new tempnam() implementation to avoid silly warnings,
|
||||
DOS and Mac file options in the Write File dialog,
|
||||
@@ -944,7 +952,7 @@
|
||||
conditions, variable width for shortcuts, and the usual
|
||||
ton of translation updates.
|
||||
|
||||
01/25/2002 - GNU nano 1.1.6 is released. Lots of new features in this
|
||||
2002.01.25 - GNU nano 1.1.6 is released. Lots of new features in this
|
||||
release. New Meta-keys were added as alternates for
|
||||
control sequences: Meta-A for the marker key (^^), and
|
||||
Meta-G for the 'goto dir' key in the file browser (^_).
|
||||
@@ -961,21 +969,21 @@
|
||||
There are also oodles of translation updates. Have fun
|
||||
with it.
|
||||
|
||||
01/05/2002 - GNU nano 1.1.5 is out. The main new feature in this
|
||||
2002.01.05 - GNU nano 1.1.5 is out. The main new feature in this
|
||||
release is the changed behavior of the keypad. Nano now
|
||||
does the Right Thing and used keypad() by default. If
|
||||
you wish to use the keypad arrow keys in certain
|
||||
terminals, you may use the -K or --keypad flag to use
|
||||
the old behavior. Users of other OSes should see better
|
||||
handling of their non-keypad keys in this release. Other
|
||||
changes include more Hurd fixes, fixes parsing the
|
||||
.nanorc, display fixes for the color syntax
|
||||
handling of their non-keypad keys in this release.
|
||||
Other changes include more Hurd fixes, fixes parsing
|
||||
the .nanorc, display fixes for the color syntax
|
||||
highlighting, gettext stabilization and many translation
|
||||
updates. This is almost like a stable release, much
|
||||
like in the 0.9.x series when every other release was
|
||||
the most stable one :) Have fun!
|
||||
|
||||
12/11/2001 - GNU nano 1.1.4 is released. This release contains
|
||||
2001.12.11 - GNU nano 1.1.4 is released. This release contains
|
||||
rudimentary color syntax support (but it's still
|
||||
broken), compatibility fixes for the Hurd and FreeBSD,
|
||||
spell checker and wrapping fixes, and more. It seems
|
||||
@@ -984,7 +992,7 @@
|
||||
so it's time to show the world all the changes since
|
||||
1.1.3 ;) Have fun with it!
|
||||
|
||||
10/26/2001 - GNU nano 1.1.3 is released. As far as new features go,
|
||||
2001.10.26 - GNU nano 1.1.3 is released. As far as new features go,
|
||||
the help system is now available for all functions in
|
||||
the editor. Also, nano will also now print a message on
|
||||
the status bar when it automatically converts a file
|
||||
@@ -1007,7 +1015,7 @@
|
||||
wait for version 1.0.6 which should be available early
|
||||
next week. Enjoy!
|
||||
|
||||
10/03/2001 - GNU nano 1.1.2 is out there. Many new features in this
|
||||
2001.10.03 - GNU nano 1.1.2 is out there. Many new features in this
|
||||
release, including support for auto-converting from DOS
|
||||
and Mac formatted files, as well as toggles for writing
|
||||
out files in these formats. Pico's -o flag has been
|
||||
@@ -1021,7 +1029,7 @@
|
||||
also the usual helping of bugfixes, translation updates
|
||||
and, surely a bug or two. You better get ready!
|
||||
|
||||
07/28/2001 - GNU nano 1.1.1 is released. Our second 1.1 unstable
|
||||
2001.07.28 - GNU nano 1.1.1 is released. Our second 1.1 unstable
|
||||
release features many bugfixes from the initial release,
|
||||
in particular fixes for the multibuffer code, and
|
||||
various compiler macro fixes. The shortcut lists for
|
||||
@@ -1033,7 +1041,7 @@
|
||||
configure script to work on platforms regardless of
|
||||
their gettext version.
|
||||
|
||||
07/15/2001 - GNU nano 1.1.0 is released. This is the first release
|
||||
2001.07.15 - GNU nano 1.1.0 is released. This is the first release
|
||||
in the 1.1.x unstable series of GNU nano. It
|
||||
incorporates all changes up to the 1.0.3 release, and
|
||||
also includes many many new features, including
|
||||
@@ -1045,7 +1053,7 @@
|
||||
introduce lots of bugs ;-) Have fun with it, but be
|
||||
careful, unstable means unstable.
|
||||
|
||||
07/01/2001 - GNU nano 1.0.3 is the "mutt" release. This release
|
||||
2001.07.01 - GNU nano 1.0.3 is the "mutt" release. This release
|
||||
features oodles of bug fixes with cutting text,
|
||||
especially with the -k (cut to end) option. There is
|
||||
also a new suspend handler which should make nano play
|
||||
@@ -1056,7 +1064,7 @@
|
||||
function for more speed and less memory usage. Two new
|
||||
translations are included, Ukrainian and Russian.
|
||||
|
||||
05/12/2001 - GNU nano 1.0.2 is the "just the bugfixes ma'am" release.
|
||||
2001.05.12 - GNU nano 1.0.2 is the "just the bugfixes ma'am" release.
|
||||
The most noticeable fixes are for display errors using
|
||||
page up/down with the marker code, and view mode (-v)
|
||||
not stopping the replace function. Other fixes include
|
||||
@@ -1066,7 +1074,7 @@
|
||||
a new Galician translation (provided by Jacobo Tarrío).
|
||||
Have fun with it!
|
||||
|
||||
04/06/2001 - GNU nano 1.0.1 is out there. The only new feature is a
|
||||
2001.04.06 - GNU nano 1.0.1 is out there. The only new feature is a
|
||||
configure option for those who want to disable all word
|
||||
wrapping from nano, --disable-wrapping. Bug fixes this
|
||||
release include some bugs with autoconf and i18n, and
|
||||
@@ -1075,7 +1083,7 @@
|
||||
and nano now sorts files case insensitively like Pilot.
|
||||
Have fun with it.
|
||||
|
||||
03/22/2001 - GNU Nano 1.0 is released! The autoindent wrapping bug
|
||||
2001.03.22 - GNU Nano 1.0 is released! The autoindent wrapping bug
|
||||
has been fixed, as well as strange bug when using Pico
|
||||
mode and regex search. There have also been some minor
|
||||
spelling and documentation updates. As stated on the
|
||||
@@ -1085,7 +1093,7 @@
|
||||
this first stable release of nano, and as always,
|
||||
feedback is welcome! nano@nano-editor.org.
|
||||
|
||||
02/19/2001 - Nano 0.9.99pre3 brings a lot of changes! The most
|
||||
2001.02.19 - Nano 0.9.99pre3 brings a lot of changes! The most
|
||||
important being that nano is now officially a GNU
|
||||
program. Some changes have been made for GNU
|
||||
compatibility (like the default list of shortcuts, "^G
|
||||
@@ -1098,7 +1106,7 @@
|
||||
ncurses libraries have also been fixed. All in all, a
|
||||
lot to see.
|
||||
|
||||
01/31/2001 - Nano 0.9.99pre2 is released. Not surprisingly, all that is
|
||||
2001.01.31 - Nano 0.9.99pre2 is released. Not surprisingly, all that is
|
||||
new is bugfixes, bugfixes, bugfixes. There were a few
|
||||
cleanups in unneeded global variables and duplicate
|
||||
functions, but most is just fixing. Specifically, there
|
||||
@@ -1110,7 +1118,7 @@
|
||||
an initial write error). Slowly but surely, on toward
|
||||
1.0 we travel.
|
||||
|
||||
01/17/2001 - Nano 0.9.99pre1 is released. This is the first pre-1.0
|
||||
2001.01.17 - Nano 0.9.99pre1 is released. This is the first pre-1.0
|
||||
release of nano, and is also the first release since the
|
||||
code freeze for nano 1.0. Don't expect (or request) any
|
||||
new features between now and nano 1.0, only bugfixes,
|
||||
@@ -1121,7 +1129,7 @@
|
||||
autoconf fixes, and support for the KDE konsole keypad
|
||||
layout. Have fun.
|
||||
|
||||
01/07/2001 - Nano 0.9.25 is the "Just one more feature I swear!"
|
||||
2001.01.07 - Nano 0.9.25 is the "Just one more feature I swear!"
|
||||
release. It includes one new feature that Pico has had
|
||||
forever, a built-in file browser. Since not everyone
|
||||
may want this option, there is a --disable-browser
|
||||
@@ -1130,7 +1138,7 @@
|
||||
for crashes when tab completion in certain instances.
|
||||
Have fun and Happy New Year!
|
||||
|
||||
12/18/2000 - Nano 0.9.24 is released. This version contains the last of
|
||||
2000.12.18 - Nano 0.9.24 is released. This version contains the last of
|
||||
the security fixes for writing files, as well as for a
|
||||
nasty segfault when nano is unable to open a file for
|
||||
reading, among other fixes. Nano also now cowardly
|
||||
@@ -1141,7 +1149,7 @@
|
||||
Pico compatibility. Upgrading to this version is highly
|
||||
recommended.
|
||||
|
||||
12/08/2000 - Nano 0.9.23 is the "race conditions bite" release. The
|
||||
2000.12.08 - Nano 0.9.23 is the "race conditions bite" release. The
|
||||
main reason for this release is the less-than-optimal
|
||||
fix for the security issue in nano with following
|
||||
symbolic links. Hopefully this will fix the problem
|
||||
@@ -1151,7 +1159,7 @@
|
||||
function was renamed to --disable-speller to be in line
|
||||
with nano and Pico's "speller" term.
|
||||
|
||||
12/02/2000 - Nano 0.9.22 is released, with many more changes and
|
||||
2000.12.02 - Nano 0.9.22 is released, with many more changes and
|
||||
additions than imaginable. The most important change is
|
||||
a fix for unsafe handling of symbolic links which could
|
||||
lead to symlink attacks if nano were to exit because of
|
||||
@@ -1166,13 +1174,13 @@
|
||||
surprises). All in all, a whole lot of changes in a
|
||||
little over a week.
|
||||
|
||||
11/23/2000 - Happy Thanksgiving! Nano 0.9.21 is our "last version was
|
||||
2000.11.23 - Happy Thanksgiving! Nano 0.9.21 is our "last version was
|
||||
a big turkey" release. It fixes several bugs introduced
|
||||
by the previous version, as well as a few long- standing
|
||||
display bugs. All 0.9.20 users are strongly encouraged
|
||||
to upgrade to this release.
|
||||
|
||||
11/18/2000 - Nano 0.9.20 is finally out the door. Probably the biggest
|
||||
2000.11.18 - Nano 0.9.20 is finally out the door. Probably the biggest
|
||||
change is the brand new way nano displays previous
|
||||
search and replace strings (they are now editable!)
|
||||
This is a break from Pico's (inconsistent) interface, so
|
||||
@@ -1190,7 +1198,7 @@
|
||||
something, don't like something, or just want to order a
|
||||
pizza, let us know!
|
||||
|
||||
10/02/2000 - Nano 0.9.19 is the "Chris is getting married in less than
|
||||
2000.10.02 - Nano 0.9.19 is the "Chris is getting married in less than
|
||||
a week and needs a distraction" release. There are only
|
||||
a few actual code changes, mainly portability and
|
||||
compiler warning fixes. Nano now also supports
|
||||
@@ -1199,35 +1207,35 @@
|
||||
nano site has changed (again) as well, check out
|
||||
www.nano-editor.org for all the latest nano schtuff.
|
||||
|
||||
09/18/2000 - Nano 0.9.18 is unleashed. It has some new keyboard
|
||||
2000.09.18 - Nano 0.9.18 is unleashed. It has some new keyboard
|
||||
handling code, Cygwin support out of the box, and a more
|
||||
portable handler for the NOHELP toggle. There is also a
|
||||
fix for a somewhat serious bug whereby trying to insert
|
||||
a directory instead of a normal file would destroy the
|
||||
contents of the editor. A must-see. Four stars.
|
||||
|
||||
09/04/2000 - Nano 0.9.17, the Labor Day release, is released after a
|
||||
2000.09.04 - Nano 0.9.17, the Labor Day release, is released after a
|
||||
quiet spell (almost an entire month since last release!)
|
||||
New features include better (not yet perfect) binary
|
||||
display support and toggle support for most of the
|
||||
program flags (M-c, M-i, M-z, M-x, M-p, M-w, M-m, M-k
|
||||
and M-e for -c, -i, -x, -p, -w, -k, and -R).
|
||||
|
||||
08/09/2000 - Nano 0.9.16, after some struggling, is released. This
|
||||
2000.08.09 - Nano 0.9.16, after some struggling, is released. This
|
||||
release should fix a few of the holes that 0.9.15 dug.
|
||||
The "cutting text on the first line" bug is fixed, as is
|
||||
the "cutting text on the last line" bug. Nice symmetry
|
||||
there huh? Also the --tabsize argument should now work
|
||||
as well as by using -T.
|
||||
|
||||
08/03/2000 - Nano 0.9.15 is the "I can't think of a release description"
|
||||
2000.08.03 - Nano 0.9.15 is the "I can't think of a release description"
|
||||
release. There are the usual gala of display bugfixes,
|
||||
a fix for the nasty bug in -k mode that could create
|
||||
a loop in the file being edited, and some other code
|
||||
cleanup. Also, the -T option should now work regardless
|
||||
of the curses library used. Yay.
|
||||
|
||||
07/27/2000 - Nano 0.9.14 is officially the "13 is so unlucky it should
|
||||
2000.07.27 - Nano 0.9.14 is officially the "13 is so unlucky it should
|
||||
be skipped as a version number" release. One typo
|
||||
caused unending problems (calling nano with either -t or
|
||||
-k caused both flags to be used). The -k code is also
|
||||
@@ -1238,15 +1246,15 @@
|
||||
for the next release. Until then, have fun with this
|
||||
version.
|
||||
|
||||
07/23/2000 - Nano 0.9.13 has a few new bits and bobs, most notably the
|
||||
2000.07.23 - Nano 0.9.13 has a few new bits and bobs, most notably the
|
||||
-k option from Pico (cut to end of line). The majority
|
||||
of changes in this release are bugfixes, however,
|
||||
including the usual display fixes and fixes for writing
|
||||
to symbolic links and un-writable files. Barring any
|
||||
to symbolic links and unwritable files. Barring any
|
||||
other major changes, this should be the feature set for
|
||||
nano 1.0, whenever it might be released =-)
|
||||
|
||||
07/07/2000 - Nano 0.9.12 (The "lucky day" release) is bursting with new
|
||||
2000.07.07 - Nano 0.9.12 (The "lucky day" release) is bursting with new
|
||||
features, bug fixes, and yummy fruit flavor. For
|
||||
changes, the alternate replace keystroke ^W^T is now
|
||||
^W^R to be compatible with later versions of Pico. ^W^T
|
||||
@@ -1257,7 +1265,7 @@
|
||||
flag. And, of course, there are the usual helping of
|
||||
display and other bug fixes to top it all off.
|
||||
|
||||
06/20/2000 - Nano 0.9.11 presents drastic rewrites of the most buggy
|
||||
2000.06.20 - Nano 0.9.11 presents drastic rewrites of the most buggy
|
||||
routines in the program, specifically the wrapping code
|
||||
and almost all of the display routines. There are many
|
||||
improvements and bugfixes to the display subsystem in
|
||||
@@ -1271,7 +1279,7 @@
|
||||
translation department is an Indonesian translation
|
||||
(id).
|
||||
|
||||
06/06/2000 - Nano 0.9.10 is primarily a bugfix for the loss of SIGINT
|
||||
2000.06.06 - Nano 0.9.10 is primarily a bugfix for the loss of SIGINT
|
||||
when using "run and terminate" flags (for example,
|
||||
--help). There are also some minor documentation
|
||||
updates. This version of nano is the most stable in
|
||||
@@ -1279,12 +1287,12 @@
|
||||
awhile. Users are encouraged to upgrade to this
|
||||
version.
|
||||
|
||||
05/31/2000 - Nano 0.9.9 introduces much better working i18n support,
|
||||
2000.05.31 - Nano 0.9.9 introduces much better working i18n support,
|
||||
more portability, and a ton of bugfixes. While nano is
|
||||
not likely anywhere near 1.0 in terms of code quality,
|
||||
it gets a quantum leap closer with this release.
|
||||
|
||||
05/18/2000 - Nano 0.9.8 (the 'what broke now?' release) should fix
|
||||
2000.05.18 - Nano 0.9.8 (the 'what broke now?' release) should fix
|
||||
the resize crash people have been experiencing. It also
|
||||
offers a new input method that should allow nano to do
|
||||
things the right way (like ^S, ^Q, custom suspend keys)
|
||||
@@ -1292,21 +1300,21 @@
|
||||
are also the obligatory display fixes and speedups.
|
||||
Have fun with it.
|
||||
|
||||
05/14/2000 - Nano 0.9.7 (the Mother's Day release) continues in the long
|
||||
2000.05.14 - Nano 0.9.7 (the Mother's Day release) continues in the long
|
||||
line of display fixes, and also fixes the broken symlink
|
||||
behavior (i.e. symlinks weren't being followed by
|
||||
default). Hopefully all major bugs can be worked out
|
||||
soon and we can have a 1.0 release before the end of the
|
||||
year, but who knows.
|
||||
|
||||
05/08/2000 - Nano 0.9.6 cleans up a lot of the display bugs that 0.9.5
|
||||
2000.05.08 - Nano 0.9.6 cleans up a lot of the display bugs that 0.9.5
|
||||
uncovered. There are improvements (and some remaining
|
||||
segfaults) in the wrapping code, and even more display
|
||||
optimizations. I would still say 0.9.4 or 0.9.2 are the
|
||||
most stable versions of nano to date, but this one may
|
||||
not be too bad =-)
|
||||
|
||||
05/01/2000 - Nano 0.9.5 attempts to speed up the display of text
|
||||
2000.05.01 - Nano 0.9.5 attempts to speed up the display of text
|
||||
to be at least somewhat reasonable. Much code profiling
|
||||
has been done to reduce the ridiculous number of
|
||||
redundant display updates. This will probably expose a
|
||||
@@ -1316,12 +1324,12 @@
|
||||
recently, so use that if you're not particularly
|
||||
concerned with being on the bleeding edge.
|
||||
|
||||
04/25/2000 - Nano 0.9.4 fixes some problems in 0.9.3 with the last
|
||||
2000.04.25 - Nano 0.9.4 fixes some problems in 0.9.3 with the last
|
||||
line code and related segfaults. It also now has much
|
||||
better handling for 8-bit characters. The --enable-tiny
|
||||
code also produces a smaller executable.
|
||||
|
||||
04/19/2000 - Nano 0.9.3 is officially the "Micro$oft" release. It
|
||||
2000.04.19 - Nano 0.9.3 is officially the "Micro$oft" release. It
|
||||
underscores the recent problem of bugfixes introducing
|
||||
more bugs than they fix. The most important change to
|
||||
this version of nano is the removal of the "magic line".
|
||||
@@ -1339,12 +1347,12 @@
|
||||
marker and mouse code), and --with-slang to use the
|
||||
slang libraries instead of ncurses.
|
||||
|
||||
04/15/2000 - Nano 0.9.2 just fixes the serious segfault problem if
|
||||
2000.04.15 - Nano 0.9.2 just fixes the serious segfault problem if
|
||||
nano is invoked any way other than using the absolute
|
||||
path. The bug was in the new code for checking whether
|
||||
nano is invoked as 'pico'.
|
||||
|
||||
04/14/2000 - 0.9.1 has some more Pico compatibility built-in. The
|
||||
2000.04.14 - 0.9.1 has some more Pico compatibility built-in. The
|
||||
option to switch to/from Search and Search/Replace (^T)
|
||||
is now available, and nano now displays the more
|
||||
Pico-like shortcut list when invoked as 'pico' (i.e. if
|
||||
@@ -1358,13 +1366,13 @@
|
||||
"recursive replace" bug, and more bugfixes in the
|
||||
wrapping code.
|
||||
|
||||
04/07/2000 - Nano 0.9.0 has some updates, new language support and
|
||||
2000.04.07 - Nano 0.9.0 has some updates, new language support and
|
||||
a much better refresh setup (It's still not great,
|
||||
but...) There should also be more stability editing
|
||||
long lines, as there was a stupid mistake in the
|
||||
update_line call. Silly me =)
|
||||
|
||||
03/22/2000 - Nano 0.8.9 is basically just a bugfix release of 0.8.8
|
||||
2000.03.22 - Nano 0.8.9 is basically just a bugfix release of 0.8.8
|
||||
to reflect the current stagnant status of the project.
|
||||
Most things work, the rest doesn't doesn't work because
|
||||
(a) I can't fix it or I would have already done so, and
|
||||
@@ -1374,7 +1382,7 @@
|
||||
nano pages on SourceForge. Here's hoping SF will get us
|
||||
some more visibility, translators and patches.
|
||||
|
||||
03/12/2000 - After a hiatus, I have finally moved (not unpacked though)
|
||||
2000.03.12 - After a hiatus, I have finally moved (not unpacked though)
|
||||
to my new home into Albany. Thus I should now have more
|
||||
time to work on nano. Nano 0.8.8, the "dear god what
|
||||
broke this time?" release, incorporates patches for both
|
||||
@@ -1391,25 +1399,25 @@
|
||||
file as the maintainer of the .po file, and from then on
|
||||
it is yours to take care of and keep up to date.
|
||||
|
||||
03/01/2000 - Well, to continue my trend of going back on my previous
|
||||
2000.03.01 - Well, to continue my trend of going back on my previous
|
||||
release's comments, nano 0.8.7 is released. The
|
||||
crashing behavior was still occurring, and this most
|
||||
recent fix also fixes some other wrapping problems, so
|
||||
here you go. There may be another release soon, there
|
||||
may not be, is that vague enough? =)
|
||||
|
||||
02/25/2000 - More minor bugfixes in 0.8.6, the bizarre behavior at the
|
||||
2000.02.25 - More minor bugfixes in 0.8.6, the bizarre behavior at the
|
||||
end of a page has ceased, thankfully. I'm also moving
|
||||
next weekend, so don't be shocked if you don't see a new
|
||||
version of nano next week =-)
|
||||
|
||||
02/11/2000 - Okay, here we go again. Aside from a few minor fixes and
|
||||
2000.02.11 - Okay, here we go again. Aside from a few minor fixes and
|
||||
some under-the-hood changes, you won't notice much
|
||||
different in this version of nano. I haven't gotten
|
||||
much feedback on the help feature, is it simply amazing
|
||||
or does no one care? Write and let me know! =)
|
||||
|
||||
02/08/2000 - Nano 0.8.3 marks the first time in a long time that there
|
||||
2000.02.08 - Nano 0.8.3 marks the first time in a long time that there
|
||||
has been more than three days since the last release.
|
||||
New features include an initial help mode (YAY!),
|
||||
hopefully much more support for i18n out of the box, and
|
||||
@@ -1418,7 +1426,7 @@
|
||||
distribution site, http://www.asty.org/nano and email
|
||||
address nano@asty.org for bugs, etc.
|
||||
|
||||
02/02/2000 - Okay, I hate to go back on what I said in the last release,
|
||||
2000.02.02 - Okay, I hate to go back on what I said in the last release,
|
||||
but I may be changing jobs very soon. I will release
|
||||
version 0.8.2 as is (no i18n, no help menu (yet). I
|
||||
expect things to settle down by the end of next week,
|
||||
@@ -1426,7 +1434,7 @@
|
||||
menu; look for these new features in version 0.8.5 to
|
||||
0.9.0.
|
||||
|
||||
01/28/2000 - Nano 0.8.1 marks our first official step toward
|
||||
2000.01.28 - Nano 0.8.1 marks our first official step toward
|
||||
internationalization (i18n) and the help system (^G). I
|
||||
will be merging in Jordi's patches for initial i18n in
|
||||
the next version, and will implement the help system
|
||||
@@ -1434,7 +1442,7 @@
|
||||
don't hesitate to send bug reports, as long as you're
|
||||
sure the fault lies with nano =-).
|
||||
|
||||
01/25/2000 - Nano 0.8.0 is officially the 'let's try and be at least a
|
||||
2000.01.25 - Nano 0.8.0 is officially the 'let's try and be at least a
|
||||
little portable, mmmmkay?' release. There are many
|
||||
portability checks and fixes; many thanks to Andy Kahn
|
||||
for his patches. I removed the broken do_spell behavior
|
||||
@@ -1442,7 +1450,7 @@
|
||||
'ispell' until I write a better method to handle the
|
||||
output of the normal 'spell' command.
|
||||
|
||||
01/24/2000 - Nano 0.7.9 features many new features. Among them are a
|
||||
2000.01.24 - Nano 0.7.9 features many new features. Among them are a
|
||||
new autoindent feature (-i, --autoindent), tempfile flag
|
||||
like Pico's -t flag (-t, --tempfile), and preliminary
|
||||
spelling program support. The spelling function tries
|
||||
@@ -1450,7 +1458,7 @@
|
||||
can specify another spelling program with -s or
|
||||
--speller.
|
||||
|
||||
01/17/00 - Nano 0.7.7 is officially the 'way too much stuff changed this
|
||||
2000.01.17 - Nano 0.7.7 is officially the 'way too much stuff changed this
|
||||
release' release. It's the busy time at work for me, so
|
||||
please don't get offended if your patch doesn't get
|
||||
included in the next immediate version of nano. I'm
|
||||
@@ -1462,16 +1470,14 @@
|
||||
new -x and -c flags (see nano -h for help), long command
|
||||
line flag support, and the usual array of bugfixes.
|
||||
|
||||
01/15/00 - Nano 0.7.6 is officially the 'lightning' release. It now
|
||||
2000.01.15 - Nano 0.7.6 is officially the 'lightning' release. It now
|
||||
loads large files much faster than previous versions,
|
||||
and is even much faster than Pico or vi in some rather
|
||||
rudimentary tests. Many thanks to Adam Rogoyski for the
|
||||
read_byte patch!
|
||||
|
||||
01/09/00 - As of this version (0.7.4), TIP has officially been renamed
|
||||
2000.01.09 - As of this version (0.7.4), TIP has officially been renamed
|
||||
to nano. The new homepage is at
|
||||
http://faculty.plattsburgh.edu/astyanax/nano. Please
|
||||
update your bookmarks, tell your friends, and all that
|
||||
jazz.
|
||||
|
||||
$Id$
|
||||
|
||||
11
THANKS
11
THANKS
@@ -8,11 +8,12 @@ Sharuzzaman Ahmat Raslan <sharuzzaman@excite.com> Malay
|
||||
Josef Andersson <josef.andersson@fripost.org> Swedish
|
||||
Laurentiu Buzdugan <buzdugan@voyager.net> Romanian
|
||||
Mario Blättermann <mario.blaettermann@gmail.com> German
|
||||
Wei-Lun CHAO <chaoweilun@pcmail.com.tw> Chinese (traditional)
|
||||
Ricardo Cárdenes Medina <ricardo@conisys.com> Spanish
|
||||
Antonio Ceballos <aceballos@gmail.com> Spanish
|
||||
Wei-Lun CHAO <chaoweilun@pcmail.com.tw> Chinese (traditional)
|
||||
Yuri Chornoivan <yurchor@ukr.net> Ukrainian
|
||||
Mihai Cristescu <mihai.cristescu@archlinux.info> Romanian
|
||||
Marco Colombo <magicdice@inwind.it> Italian
|
||||
Mihai Cristescu <mihai.cristescu@archlinux.info> Romanian
|
||||
Yavor Doganov <yavor@doganov.org> Bulgarian
|
||||
Karl Eichwalder <keichwa@gmx.net> German
|
||||
A. Murat EREN <meren@comu.edu.tr> Turkish
|
||||
@@ -36,6 +37,7 @@ Wojciech Kotwica <wkotwica@post.pl> Polish
|
||||
Ask Hjorth Larsen <asklarsen@gmail.com> Danish
|
||||
Clement Laforet <clem_laf@wanadoo.fr> French
|
||||
LI Daobing <lidaobing@gmail.com> Chinese (simplified)
|
||||
Jordi Mallach <jordi@gnu.org> Catalan
|
||||
João Victor Duarte Martins <jvdm@sdf.lonestar.org> Brazilian Portuguese
|
||||
Pavel Maryanov <acid@jack.kiev.ua> Russian
|
||||
Daniele Medri <madrid@linux.it> Italian
|
||||
@@ -47,6 +49,7 @@ Daniel Nylander <po@danielnylander.se> Swedish
|
||||
Mikel Olasagasti <hey_neken@mundurat.net> Basque
|
||||
Michael Piefel <piefel@informatik.hu-berlin.de> German
|
||||
Sergey Poznyakoff <gray@gnu.org> Polish
|
||||
Božidar Putanec <bozidarp@yahoo.com> Croatian
|
||||
Trần Ngọc Quân <vnwildman@gmail.com> Vietnamese
|
||||
Sergey A. Ribalchenko <fisher@obu.ck.ua> Ukrainian and Russian
|
||||
Michel Robitaille <robitail@IRO.UMontreal.CA> French
|
||||
@@ -82,13 +85,9 @@ Thijs Kinkhorst <thijs@kinkhorst.com> rnano.1 manpage
|
||||
Jim Knoble <jmknoble@pobox.com> Pico compat for browser
|
||||
Ryan Krebs <fluffy@highwire.stanford.edu> Many bug fixes and testing
|
||||
Roy Lanek <lanek@ranahminang.net> Advice and advocacy
|
||||
Mark Majeres <mark@engine12.com> Working undo/redo code
|
||||
Chuck Mead <csm@MoonGroup.com> Feedback and RPM stuff
|
||||
Mike Melanson <melanson@pcisys.net> Bugs
|
||||
Neil Parks <nparks@acsmail.com> Bug reports and fixes
|
||||
Jeremy Robichaud <robicj@yahoo.com> Beta tester
|
||||
Bill Soudan <wes0472@rit.edu> Regex code, etc
|
||||
Ken Tyler <kent@werple.net.au> Search fixes and more
|
||||
|
||||
|
||||
$Id$
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [2.5.1], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.5.2], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.5.1" "January 2016"
|
||||
.TH NANO 1 "version 2.5.2" "February 2016"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -116,8 +116,9 @@ Disable automatic conversion of files from DOS/Mac format.
|
||||
Use the blank line below the titlebar as extra editing space.
|
||||
.TP
|
||||
.BR \-P ", " \-\-positionlog
|
||||
Log and later read back the location of the cursor and place it there
|
||||
again. (The old form of this option, \fB\-\-poslog\fR, is deprecated.)
|
||||
For the 200 most recent files, log the last position of the cursor,
|
||||
and place it at that position again upon reopening such a file.
|
||||
(The old form of this option, \fB\-\-poslog\fR, is deprecated.)
|
||||
.TP
|
||||
.BR "\-Q ""\fIcharacters\fB""" ", " "\-\-quotestr=""" \fIcharacters\fR """
|
||||
Set the quoting string for justifying. The default is
|
||||
@@ -176,11 +177,6 @@ editing source code.
|
||||
Make the 'Cut Text' command (normally ^K) cut from the current cursor
|
||||
position to the end of the line, instead of cutting the entire line.
|
||||
.TP
|
||||
.BR \-l ", " \-\-nofollow
|
||||
If the file being edited is a symbolic link, replace the link with
|
||||
a new file instead of following it. Good for editing files in
|
||||
\fI/tmp\fP, perhaps?
|
||||
.TP
|
||||
.BR \-m ", " \-\-mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
clicks can be used to place the cursor, set the mark (with a double
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.5.1" "January 2016"
|
||||
.TH NANORC 5 "version 2.5.2" "February 2016"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
@@ -141,9 +141,6 @@ When reading in a file with ^R, insert it into a new buffer by default.
|
||||
.B set noconvert
|
||||
Don't convert files from DOS/Mac format.
|
||||
.TP
|
||||
.B set nofollow
|
||||
Don't follow symlinks when writing files.
|
||||
.TP
|
||||
.B set nohelp
|
||||
Don't display the two help lines at the bottom of the screen.
|
||||
.TP
|
||||
@@ -161,6 +158,7 @@ directory feature is turned off.
|
||||
.TP
|
||||
.B set positionlog
|
||||
Save the cursor position of files between editing sessions.
|
||||
The cursor position is remembered for the 200 most-recently edited files.
|
||||
(The old form of this option, '\fBset poslog\fR', is deprecated.)
|
||||
.TP
|
||||
.B set preserve
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 2.5.1" "January 2016"
|
||||
.TH RNANO 1 "version 2.5.2" "February 2016"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
## width less this number.
|
||||
# set fill -8
|
||||
|
||||
## Enable ~/.nano_history for saving and reading search/replace strings.
|
||||
## Remember the used search/replace strings for the next session.
|
||||
# set historylog
|
||||
|
||||
## Enable vim-style lock-files. This is just to let a vim user know you
|
||||
@@ -86,9 +86,6 @@
|
||||
## Don't convert files from DOS/Mac format.
|
||||
# set noconvert
|
||||
|
||||
## Don't follow symlinks when writing files.
|
||||
# set nofollow
|
||||
|
||||
## Don't display the helpful shortcut lists at the bottom of the screen.
|
||||
# set nohelp
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ color cyan "__attribute__[[:space:]]*\(\([^)]*\)\)" "__(aligned|asm|builtin|hidd
|
||||
|
||||
# Strings. In general you will want your strings and comments to come last,
|
||||
# because highlighting rules are applied in the order they are read in.
|
||||
color brightyellow "<[^= ]*>" ""(\\.|[^"])*""
|
||||
color brightyellow ""([^"]|\\")*"" "<[^[:blank:]=]*>"
|
||||
# Multiline strings. This regex is VERY resource intensive,
|
||||
# and sometimes colours things that shouldn't be coloured.
|
||||
###color brightyellow start=""(\\.|[^"])*\\[[:space:]]*$" end="^(\\.|[^"])*""
|
||||
@@ -28,7 +28,7 @@ color brightblue "//.*"
|
||||
color brightblue start="/\*" end="\*/"
|
||||
|
||||
# Reminders.
|
||||
color ,yellow "(FIXME|TODO|XXX)"
|
||||
color ,yellow "\<(FIXME|TODO|XXX)\>"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
@@ -16,7 +16,7 @@ color cyan "bug #[0-9]{5,9}" "patch #[0-9]{4,9}"
|
||||
# Probable constants, for variety.
|
||||
color brightred "\<[A-Z_][0-9A-Z_]+\>"
|
||||
# Key sequences.
|
||||
color brightblue "\^[A-Z]" "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
|
||||
color brightblue "\^[A-Z^\]" "\<M-." "\<F1?[0-9]" "(\^|M-)Space"
|
||||
|
||||
# Changed files.
|
||||
color magenta start="^( | {8})\* " end="(:( |$)|^$)"
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
syntax "go" "\.go$"
|
||||
|
||||
# Set up a formatter since spelling is probably useless...
|
||||
formatter gofmt -w
|
||||
|
||||
# Types.
|
||||
color green "\<(bool|u?int(8|16|32|64)?|float(32|64)|complex(64|128)|byte|rune|uintptr|string|error)\>"
|
||||
color green "\<((<-[[:space:]]*)chan|chan[[:space:]]*<-|const|func|interface|map|struct|type|var)\>"
|
||||
@@ -40,6 +43,3 @@ color brightblue start="/\*" end="\*/"
|
||||
|
||||
# Trailing whitespace.
|
||||
color ,green "[[:space:]]+$"
|
||||
|
||||
# Set up the formatter since spelling is probably useless...
|
||||
formatter gofmt -w
|
||||
|
||||
@@ -6,11 +6,11 @@ syntax "nanorc" "\.?nanorc$"
|
||||
icolor brightred "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|i?color|extendsyntax).*$"
|
||||
|
||||
# Keywords
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const(antshow)?|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nofollow|nohelp|nonewlines|nowrap|pos(ition)?log|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|unix|view|wordbounds)\>"
|
||||
icolor brightgreen "^[[:space:]]*(set|unset)[[:space:]]+(allow_insecure_backup|autoindent|backup|backwards|boldtext|casesensitive|const(antshow)?|cut|fill|historylog|locking|morespace|mouse|multibuffer|noconvert|nohelp|nonewlines|nowrap|pos(ition)?log|preserve|quickblank|quiet|rebinddelete|rebindkeypad|regexp|smarthome|smooth|softwrap|suspend|tabsize|tabstospaces|tempfile|unix|view|wordbounds)\>"
|
||||
icolor yellow "^[[:space:]]*set[[:space:]]+(functioncolor|keycolor|statuscolor|titlecolor)[[:space:]]+(bright)?(white|black|red|blue|green|yellow|magenta|cyan)?(,(white|black|red|blue|green|yellow|magenta|cyan))?\>"
|
||||
icolor brightgreen "^[[:space:]]*set[[:space:]]+(backupdir|brackets|functioncolor|keycolor|matchbrackets|operatingdir|punct|quotestr|speller|statuscolor|titlecolor|whitespace)[[:space:]]+"
|
||||
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)+[[:space:]]*$"
|
||||
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)+[[:space:]]*$"
|
||||
icolor brightgreen "^[[:space:]]*bind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9^_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+[[:alpha:]]+[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
icolor brightgreen "^[[:space:]]*unbind[[:space:]]+((\^|M-)([[:alpha:]]|space|[]]|[0-9^_=+{}|;:'\",./<>\?-])|F([1-9]|1[0-6])|Ins|Del)[[:space:]]+(all|main|search|replace(2|with)?|gotoline|writeout|insert|ext(ernal)?cmd|help|spell|linter|browser|whereisfile|gotodir)([[:space:]]+#|[[:space:]]*$)"
|
||||
icolor brightgreen "^[[:space:]]*extendsyntax[[:space:]]+[[:alpha:]]+[[:space:]]+(i?color|header|magic|linter|formatter)[[:space:]]+.*$"
|
||||
icolor green "^[[:space:]]*((un)?(bind|set)|include|syntax|header|magic|linter|formatter|extendsyntax)\>"
|
||||
|
||||
@@ -21,7 +21,7 @@ icolor magenta "^[[:space:]]*i?color\>" "\<(start|end)="
|
||||
# Strings
|
||||
icolor brightmagenta ""(\\.|[^"])*""
|
||||
# Comments
|
||||
icolor brightblue "^[[:space:]]*#.*$"
|
||||
icolor brightblue "(^|[[:space:]]+)#.*$"
|
||||
icolor cyan "^[[:space:]]*##.*$"
|
||||
|
||||
# Trailing whitespace
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
@smallbook
|
||||
@set EDITION 0.3
|
||||
@set VERSION 2.5.1
|
||||
@set UPDATED December 2015
|
||||
@set VERSION 2.5.2
|
||||
@set UPDATED February 2016
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -21,7 +21,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 2.5.1
|
||||
@subtitle version 2.5.2
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -89,6 +89,7 @@ as possible while offering a superset of Pico's functionality. See
|
||||
|
||||
Please report bugs via @url{https://savannah.gnu.org/bugs/?group=nano}.
|
||||
|
||||
|
||||
@node Invoking
|
||||
@chapter Invoking
|
||||
|
||||
@@ -113,6 +114,7 @@ But normallly you would set your preferred options in your
|
||||
(making @code{nano} remember the cursor position when you close a file),
|
||||
you will rarely need to specify a line number.
|
||||
|
||||
|
||||
@node Command-line Options
|
||||
@chapter Command-line Options
|
||||
|
||||
@@ -188,8 +190,8 @@ Use the blank line below the titlebar as extra editing space.
|
||||
|
||||
@item -P
|
||||
@itemx --positionlog
|
||||
Log for each file the last location of the cursor, and read it
|
||||
back upon reopening the file and place it there again.
|
||||
For the 200 most recent files, log the last position of the cursor,
|
||||
and place it at that position again upon reopening such a file.
|
||||
(The old form of this option, @code{--poslog}, is deprecated.)
|
||||
|
||||
@item -Q "@var{characters}"
|
||||
@@ -264,11 +266,6 @@ the previous line.
|
||||
Make the 'Cut Text' command (normally ^K) cut from the current cursor
|
||||
position to the end of the line, instead of cutting the entire line.
|
||||
|
||||
@item -l
|
||||
@itemx --nofollow
|
||||
When writing files, if the given file is a symbolic link, it is removed
|
||||
and a new file is created.
|
||||
|
||||
@item -m
|
||||
@itemx --mouse
|
||||
Enable mouse support, if available for your system. When enabled, mouse
|
||||
@@ -342,7 +339,7 @@ Don't hard-wrap long lines at any length. This option conflicts with
|
||||
@anchor{Expert Mode}
|
||||
@item -x
|
||||
@itemx --nohelp
|
||||
Expert Mode: don't show the Shortcut Lists at the bottom of the screen.
|
||||
Expert Mode: don't show the Shortcut List at the bottom of the screen.
|
||||
This affects the location of the statusbar as well, as in Expert Mode it
|
||||
is located at the very bottom of the editor.
|
||||
|
||||
@@ -379,12 +376,11 @@ Ignored, for compatibility with Pico.
|
||||
|
||||
@menu
|
||||
* Entering Text::
|
||||
* Special Functions::
|
||||
* Commands::
|
||||
* The Cutbuffer::
|
||||
* The Mark::
|
||||
* The Titlebar::
|
||||
* The Statusbar::
|
||||
* Shortcut Lists::
|
||||
* Screen Layout::
|
||||
* Search and Replace::
|
||||
* Using the Mouse::
|
||||
* Limitation::
|
||||
@end menu
|
||||
@@ -392,34 +388,46 @@ Ignored, for compatibility with Pico.
|
||||
@node Entering Text
|
||||
@section Entering Text
|
||||
|
||||
@code{nano} is a "modeless" editor. All keystrokes, with the exception
|
||||
of Control and Meta key sequences, enter text into the file being edited.
|
||||
All key sequences in @code{nano} are entered using the keyboard.
|
||||
@code{nano} is a "modeless" editor. This means that all keystrokes,
|
||||
with the exception of Control and Meta sequences, enter text into the
|
||||
file being edited.
|
||||
|
||||
@node Special Functions
|
||||
@section Special Functions
|
||||
|
||||
Special functions use the Control key (Ctrl), displayed in the help and
|
||||
shortcut lists as ^; the Meta key (Alt or Cmd), displayed as M-; or the
|
||||
Escape key (Esc).
|
||||
Characters not present on the keyboard can be entered in two ways:
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
Control key sequences are entered by holding down the Ctrl key and
|
||||
pressing the desired key, or by pressing the Esc key twice and then
|
||||
pressing the desired key.
|
||||
For characters with a single-byte code,
|
||||
pressing the Esc key twice and then typing a three-digit decimal number
|
||||
(from 000 to 255) will enter the character with the corresponding value.
|
||||
|
||||
@item
|
||||
Pressing the Esc key twice and then typing a three-digit number from
|
||||
000 to 255 will enter the character with the corresponding value.
|
||||
@item
|
||||
Meta key sequences are entered by holding down the Meta key (normally
|
||||
the Alt key) and pressing the desired key, or by pressing the Esc key
|
||||
once and then pressing the desired key. Certain operating systems "swallow"
|
||||
the Alt key so that it never reaches the application; if your operating
|
||||
system does this, you should use the Esc key to generate Meta key
|
||||
sequences.
|
||||
For any possible character, pressing M-V (Alt+V) and then typing a
|
||||
six-digit hexadecimal number (starting with 0 or 1) will enter the
|
||||
character with the corresponding Unicode value.
|
||||
@end itemize
|
||||
|
||||
@node Commands
|
||||
@section Commands
|
||||
|
||||
Commands are given by using the Control key (Ctrl, shown as @code{^})
|
||||
or the Meta key (Alt or Cmd, shown as @code{M-}).
|
||||
|
||||
@itemize @bullet
|
||||
@item
|
||||
A control-key sequence is entered by holding down the Ctrl key and
|
||||
pressing the desired key.
|
||||
|
||||
@item
|
||||
A meta-key sequence is entered by holding down the Meta key (normally
|
||||
the Alt key) and pressing the desired key.
|
||||
@end itemize
|
||||
|
||||
If for some reason on your system the combinations with Ctrl or Alt do
|
||||
not work, you can generate them by using the Esc key. A control-key
|
||||
sequence is generated by pressing the Esc key twice and then pressing
|
||||
the desired key, and a meta-key sequence by pressing the Esc key once
|
||||
and then pressing the desired key.
|
||||
|
||||
@node The Cutbuffer
|
||||
@section The Cutbuffer
|
||||
|
||||
@@ -448,35 +456,42 @@ search-and-replace (^\) or spell-checking session (^T).
|
||||
Cutting or copying selected text will toggle the mark off automatically.
|
||||
If necessary, it can be toggled off manually with another ^6 or M-A.
|
||||
|
||||
@node The Titlebar
|
||||
@section The Titlebar
|
||||
@node Screen Layout
|
||||
@section Screen Layout
|
||||
|
||||
The titlebar is the line displayed at the top of the editor. There are
|
||||
The default screen of nano consists of five areas. From top to bottom
|
||||
these are: the titlebar, a blank line, the edit window, the statusbar,
|
||||
and two help lines.
|
||||
|
||||
The titlebar consists of
|
||||
three sections: left, center and right. The section on the left
|
||||
displays the version of @code{nano} being used. The center section
|
||||
displays the current filename, or "New Buffer" if the file has not yet
|
||||
been named. The section on the right will display "Modified" if the
|
||||
been named. The section on the right displays "Modified" if the
|
||||
file has been modified since it was last saved or opened.
|
||||
|
||||
Special modes: When @code{nano} is in "File browser" mode, the center
|
||||
section will display the current directory instead of the filename. See
|
||||
@xref{The File Browser}, for more info.
|
||||
|
||||
@node The Statusbar
|
||||
@section The Statusbar
|
||||
|
||||
The statusbar is the third line from the bottom of the screen, or the
|
||||
bottom line in Expert Mode. See @xref{Expert Mode}, for more info. It
|
||||
The statusbar is the third line from the bottom of the screen. It
|
||||
shows important and informational messages. Any error messages that
|
||||
occur from using the editor will appear on the statusbar. Any questions
|
||||
that are asked of the user will be asked on the statusbar, and any user
|
||||
input (search strings, filenames, etc.) will be input on the statusbar.
|
||||
|
||||
@node Shortcut Lists
|
||||
@section Shortcut Lists
|
||||
The two help lines at the bottom of the screen show some of the most
|
||||
essential functions of the editor. These two lines are called the
|
||||
Shortcut List.
|
||||
|
||||
The Shortcut Lists are the two lines at the bottom of the screen which
|
||||
show some of the more commonly used functions in the editor.
|
||||
@node Search and Replace
|
||||
@section Search and Replace
|
||||
|
||||
One can search the current buffer for the occurrence of any string
|
||||
with the Search command (default key binding: ^W). The default search
|
||||
mode is forward, case-insensitive, and for literal strings. But one
|
||||
can search backwards by pressing M-B, search case sensitively with M-C,
|
||||
and interpret regular expressions in the search string with M-R.
|
||||
|
||||
A regular expression in a search string always covers just one line;
|
||||
it cannot span multiple lines. And when replacing (with ^\ or M-R)
|
||||
the replacement string cannot contain a newline (LF).
|
||||
|
||||
@node Using the Mouse
|
||||
@section Using the Mouse
|
||||
@@ -515,7 +530,7 @@ and ^V (Page Down) keys. ^X exits the help system.
|
||||
|
||||
Toggles allow you to change on-the-fly certain aspects of the editor
|
||||
which would normally be specified via command-line options. They are
|
||||
invoked via Meta-key sequences. See @xref{Special Functions}, for more info.
|
||||
invoked via Meta-key sequences (see @xref{Commands}, for more info).
|
||||
The following global toggles are available:
|
||||
|
||||
@table @code
|
||||
@@ -700,9 +715,6 @@ When reading in a file with ^R, insert it into a new buffer by default.
|
||||
@item set noconvert
|
||||
Don't convert files from DOS/Mac format.
|
||||
|
||||
@item set nofollow
|
||||
Don't follow symlinks when writing files.
|
||||
|
||||
@item set nohelp
|
||||
Don't display the help lists at the bottom of the screen.
|
||||
|
||||
@@ -720,6 +732,7 @@ directory feature is turned off.
|
||||
|
||||
@item set positionlog
|
||||
Save the cursor position of files between editing sessions.
|
||||
The cursor position is remembered for the 200 most-recently edited files.
|
||||
(The old form of this option, @code{set poslog}, is deprecated.)
|
||||
|
||||
@item set preserve
|
||||
@@ -1459,6 +1472,10 @@ Disable support for reading and writing Unicode files. Normally the
|
||||
configure script auto-detects whether to enable UTF-8 support or not.
|
||||
You can use this or the previous option to override that detection.
|
||||
|
||||
@item --enable-altrcname=@var{name}
|
||||
Use the file with the given @var{name} (in the user's home directory)
|
||||
as nano's settings file, instead of the default @code{.nanorc}.
|
||||
|
||||
@item --with-slang
|
||||
Compile @code{nano} against Slang instead of against ncurses or other
|
||||
curses libraries.
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
# List of available languages.
|
||||
bg ca cs da de eo es eu fi fr ga gl hu id it ja ms nb nl nn pl pt_BR ro ru sl sr sv tr uk vi zh_CN zh_TW
|
||||
bg ca cs da de eo es eu fi fr ga gl hr hu id it ja ms nb nl nn pl pt_BR ro ru sl sr sv tr uk vi zh_CN zh_TW
|
||||
|
||||
719
po/nano.pot
719
po/nano.pot
File diff suppressed because it is too large
Load Diff
752
po/pt_BR.po
752
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
719
po/zh_CN.po
719
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
719
po/zh_TW.po
719
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -217,10 +217,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
/* If the directory begins with a newline (i.e. an
|
||||
* encoded null), treat it as though it's blank. */
|
||||
if (i < 0 || *answer == '\n') {
|
||||
/* We canceled. Indicate that on the statusbar, and
|
||||
* blank out ans, since we're done with it. */
|
||||
statusbar(_("Cancelled"));
|
||||
ans = mallocstrcpy(ans, "");
|
||||
continue;
|
||||
} else if (i != 0) {
|
||||
/* Put back the "Go to Directory" key and save
|
||||
@@ -232,12 +229,7 @@ char *do_browser(char *path, DIR *dir)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* We have a directory. Blank out ans, since we're done
|
||||
* with it. */
|
||||
ans = mallocstrcpy(ans, "");
|
||||
|
||||
/* Convert newlines to nulls, just before we go to the
|
||||
* directory. */
|
||||
/* Convert newlines to nulls in the directory name. */
|
||||
sunder(answer);
|
||||
align(&answer);
|
||||
|
||||
|
||||
37
src/cut.c
37
src/cut.c
@@ -28,10 +28,8 @@
|
||||
|
||||
static bool keep_cutbuffer = FALSE;
|
||||
/* Should we keep the contents of the cutbuffer? */
|
||||
/* Pointer to the end of the cutbuffer. */
|
||||
|
||||
/* Indicate that we should no longer keep the contents of the
|
||||
* cutbuffer. */
|
||||
/* Indicate that we should no longer keep the contents of the cutbuffer. */
|
||||
void cutbuffer_reset(void)
|
||||
{
|
||||
keep_cutbuffer = FALSE;
|
||||
@@ -68,7 +66,7 @@ void cut_marked(void)
|
||||
size_t top_x, bot_x;
|
||||
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, top, top_x, bot, bot_x);
|
||||
openfile->placewewant = xplustabs();
|
||||
@@ -107,9 +105,9 @@ void cut_to_eol(void)
|
||||
* file into the cutbuffer. */
|
||||
void cut_to_eof(void)
|
||||
{
|
||||
move_to_filestruct(&cutbuffer, &cutbottom, openfile->current,
|
||||
openfile->current_x, openfile->filebot,
|
||||
strlen(openfile->filebot->data));
|
||||
move_to_filestruct(&cutbuffer, &cutbottom,
|
||||
openfile->current, openfile->current_x,
|
||||
openfile->filebot, strlen(openfile->filebot->data));
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -127,8 +125,7 @@ void do_cut_text(
|
||||
{
|
||||
#ifndef NANO_TINY
|
||||
filestruct *cb_save = NULL;
|
||||
/* The current end of the cutbuffer, before we add text to
|
||||
* it. */
|
||||
/* The current end of the cutbuffer, before we add text to it. */
|
||||
size_t cb_save_len = 0;
|
||||
/* The length of the string at the current end of the cutbuffer,
|
||||
* before we add text to it. */
|
||||
@@ -162,24 +159,20 @@ void do_cut_text(
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Set keep_cutbuffer to TRUE, so that the text we're going to move
|
||||
* into the cutbuffer will be added to the text already in the
|
||||
* cutbuffer instead of replacing it. */
|
||||
/* Ensure that the text we're going to move into the cutbuffer will
|
||||
* be added to the text already there, instead of replacing it. */
|
||||
keep_cutbuffer = TRUE;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (cut_till_eof) {
|
||||
/* If cut_till_eof is TRUE, move all text up to the end of the
|
||||
* file into the cutbuffer. */
|
||||
/* Move all text up to the end of the file into the cutbuffer. */
|
||||
cut_to_eof();
|
||||
} else if (openfile->mark_set) {
|
||||
/* If the mark is on, move the marked text to the cutbuffer, and
|
||||
* turn the mark off. */
|
||||
/* Move the marked text to the cutbuffer, and turn the mark off. */
|
||||
cut_marked();
|
||||
openfile->mark_set = FALSE;
|
||||
} else if (ISSET(CUT_TO_END))
|
||||
/* If the CUT_TO_END flag is set, move all text up to the end of
|
||||
* the line into the cutbuffer. */
|
||||
/* Move all text up to the end of the line into the cutbuffer. */
|
||||
cut_to_eol();
|
||||
else
|
||||
#endif
|
||||
@@ -209,15 +202,10 @@ void do_cut_text(
|
||||
* disturbing the text. */
|
||||
if (!old_no_newlines)
|
||||
UNSET(NO_NEWLINES);
|
||||
}
|
||||
|
||||
/* Leave the text in the cutbuffer, and mark the file as
|
||||
* modified. */
|
||||
if (!copy_text)
|
||||
} else
|
||||
#endif /* !NANO_TINY */
|
||||
set_modified();
|
||||
|
||||
/* Update the screen. */
|
||||
edit_refresh_needed = TRUE;
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
@@ -296,7 +284,6 @@ void do_uncut_text(void)
|
||||
/* Mark the file as modified. */
|
||||
set_modified();
|
||||
|
||||
/* Update the screen. */
|
||||
edit_refresh_needed = TRUE;
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
|
||||
474
src/files.c
474
src/files.c
@@ -33,6 +33,40 @@
|
||||
#include <pwd.h>
|
||||
#include <libgen.h>
|
||||
|
||||
/* Verify that the containing directory of the given filename exists. */
|
||||
bool has_valid_path(const char *filename)
|
||||
{
|
||||
char *parentdir;
|
||||
struct stat parentinfo;
|
||||
bool validity = FALSE;
|
||||
|
||||
if (strrchr(filename, '/') == NULL)
|
||||
parentdir = mallocstrcpy(NULL, ".");
|
||||
else
|
||||
parentdir = dirname(mallocstrcpy(NULL, filename));
|
||||
|
||||
if (stat(parentdir, &parentinfo) == -1) {
|
||||
if (errno == ENOENT)
|
||||
statusbar(_("Directory '%s' does not exist"), parentdir);
|
||||
else
|
||||
statusbar(_("Path '%s': %s"), parentdir, strerror(errno));
|
||||
} else if (!S_ISDIR(parentinfo.st_mode)) {
|
||||
statusbar(_("Path '%s' is not a directory"), parentdir);
|
||||
} else {
|
||||
if (access(parentdir, X_OK) == -1)
|
||||
statusbar(_("Path '%s' is not accessible"), parentdir);
|
||||
else
|
||||
validity = TRUE;
|
||||
}
|
||||
|
||||
free(parentdir);
|
||||
|
||||
if (!validity)
|
||||
beep();
|
||||
|
||||
return validity;
|
||||
}
|
||||
|
||||
/* Add an entry to the openfile openfilestruct. This should only be
|
||||
* called from open_buffer(). */
|
||||
void make_new_buffer(void)
|
||||
@@ -101,6 +135,32 @@ void initialize_buffer_text(void)
|
||||
openfile->totsize = 0;
|
||||
}
|
||||
|
||||
/* Mark the current file as modified if it isn't already, and then
|
||||
* update the titlebar to display the file's new status. */
|
||||
void set_modified(void)
|
||||
{
|
||||
if (openfile->modified)
|
||||
return;
|
||||
|
||||
openfile->modified = TRUE;
|
||||
titlebar(NULL);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (!ISSET(LOCKING) || openfile->filename[0] == '\0')
|
||||
return;
|
||||
|
||||
if (openfile->lock_filename == NULL) {
|
||||
/* TRANSLATORS: Try to keep this at most 76 characters. */
|
||||
statusbar(_("Warning: Modifying a file which is not locked,"
|
||||
" check directory permission?"));
|
||||
} else {
|
||||
char *fullname = get_full_path(openfile->filename);
|
||||
write_lockfile(openfile->lock_filename, fullname, TRUE);
|
||||
free(fullname);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Actually write the lockfile. This function will ALWAYS annihilate
|
||||
* any previous version of the file. We'll borrow INSECURE_BACKUP here
|
||||
@@ -256,10 +316,9 @@ int do_lockfile(const char *filename)
|
||||
size_t locknamesize = strlen(filename) + strlen(locking_prefix)
|
||||
+ strlen(locking_suffix) + 3;
|
||||
char *lockfilename = charalloc(locknamesize);
|
||||
char *lockfiledir = NULL;
|
||||
static char lockprog[11], lockuser[17];
|
||||
struct stat fileinfo;
|
||||
int lockfd, lockpid;
|
||||
int lockfd, lockpid, retval = -1;
|
||||
|
||||
snprintf(lockfilename, locknamesize, "%s/%s%s%s", dirname(namecopy1),
|
||||
locking_prefix, basename(namecopy2), locking_suffix);
|
||||
@@ -271,14 +330,16 @@ int do_lockfile(const char *filename)
|
||||
if (stat(lockfilename, &fileinfo) != -1) {
|
||||
ssize_t readtot = 0;
|
||||
ssize_t readamt = 0;
|
||||
char *lockbuf = charalloc(8192);
|
||||
char *promptstr = charalloc(128);
|
||||
char *lockbuf, *promptstr;
|
||||
int ans;
|
||||
|
||||
if ((lockfd = open(lockfilename, O_RDONLY)) < 0) {
|
||||
statusbar(_("Error opening lock file %s: %s"),
|
||||
lockfilename, strerror(errno));
|
||||
return -1;
|
||||
goto free_the_name;
|
||||
}
|
||||
|
||||
lockbuf = charalloc(8192);
|
||||
do {
|
||||
readamt = read(lockfd, &lockbuf[readtot], BUFSIZ);
|
||||
readtot += readamt;
|
||||
@@ -287,37 +348,54 @@ int do_lockfile(const char *filename)
|
||||
if (readtot < 48) {
|
||||
statusbar(_("Error reading lock file %s: Not enough data read"),
|
||||
lockfilename);
|
||||
return -1;
|
||||
free(lockbuf);
|
||||
goto free_the_name;
|
||||
}
|
||||
|
||||
strncpy(lockprog, &lockbuf[2], 10);
|
||||
lockpid = (unsigned char)lockbuf[25] * 256 + (unsigned char)lockbuf[24];
|
||||
strncpy(lockuser, &lockbuf[28], 16);
|
||||
free(lockbuf);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "lockpid = %d\n", lockpid);
|
||||
fprintf(stderr, "program name which created this lock file should be %s\n", lockprog);
|
||||
fprintf(stderr, "user which created this lock file should be %s\n", lockuser);
|
||||
#endif
|
||||
promptstr = charalloc(128);
|
||||
/* TRANSLATORS: The second %s is the name of the user, the third that of the editor. */
|
||||
sprintf(promptstr, _("File %s is being edited (by %s with %s, PID %d); continue?"),
|
||||
filename, lockuser, lockprog, lockpid);
|
||||
ans = do_yesno_prompt(FALSE, promptstr);
|
||||
free(promptstr);
|
||||
|
||||
if (ans < 1) {
|
||||
blank_statusbar();
|
||||
return -1;
|
||||
goto free_the_name;
|
||||
}
|
||||
} else {
|
||||
lockfiledir = mallocstrcpy(NULL, lockfilename);
|
||||
lockfiledir = dirname(lockfiledir);
|
||||
if (stat(lockfiledir, &fileinfo) == -1) {
|
||||
statusbar(_("Error writing lock file: Directory \'%s\' doesn't exist"),
|
||||
lockfiledir);
|
||||
free(lockfiledir);
|
||||
return 0;
|
||||
}
|
||||
free(lockfiledir);
|
||||
}
|
||||
|
||||
return write_lockfile(lockfilename, filename, FALSE);
|
||||
retval = write_lockfile(lockfilename, filename, FALSE);
|
||||
|
||||
free_the_name:
|
||||
if (retval < 1)
|
||||
free(lockfilename);
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Perform a stat call on the given filename, allocating a stat struct
|
||||
* if necessary. On success, *pstat points to the stat's result. On
|
||||
* failure, *pstat is freed and made NULL. */
|
||||
void stat_with_alloc(const char *filename, struct stat **pstat)
|
||||
{
|
||||
if (*pstat == NULL)
|
||||
*pstat = (struct stat *)nmalloc(sizeof(struct stat));
|
||||
|
||||
if (stat(filename, *pstat) != 0) {
|
||||
free(*pstat);
|
||||
*pstat = NULL;
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -363,25 +441,28 @@ bool open_buffer(const char *filename, bool undoable)
|
||||
}
|
||||
|
||||
/* If we're going to load into a new buffer, first create the new
|
||||
* buffer and lock the corresponding file. */
|
||||
* buffer and (if possible) lock the corresponding file. */
|
||||
if (new_buffer) {
|
||||
make_new_buffer();
|
||||
|
||||
if (!has_valid_path(filename))
|
||||
quiet = TRUE;
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING) && filename[0] != '\0') {
|
||||
int lockstatus = do_lockfile(filename);
|
||||
if (lockstatus < 0) {
|
||||
else {
|
||||
if (ISSET(LOCKING) && filename[0] != '\0') {
|
||||
int lockstatus = do_lockfile(filename);
|
||||
if (lockstatus < 0) {
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
if (openfile->next) {
|
||||
close_buffer(TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
if (openfile->next) {
|
||||
close_buffer(TRUE);
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
} else if (lockstatus == 0) {
|
||||
quiet = TRUE;
|
||||
} else if (lockstatus == 0)
|
||||
quiet = TRUE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif /* !NANO_TINY */
|
||||
}
|
||||
|
||||
/* If the filename isn't blank, and we are not in NOREAD_MODE,
|
||||
@@ -399,11 +480,8 @@ bool open_buffer(const char *filename, bool undoable)
|
||||
if (rc > 0) {
|
||||
read_file(f, rc, filename, undoable, new_buffer);
|
||||
#ifndef NANO_TINY
|
||||
if (openfile->current_stat == NULL) {
|
||||
openfile->current_stat =
|
||||
(struct stat *)nmalloc(sizeof(struct stat));
|
||||
stat(filename, openfile->current_stat);
|
||||
}
|
||||
if (openfile->current_stat == NULL)
|
||||
stat_with_alloc(filename, &openfile->current_stat);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -533,7 +611,9 @@ bool close_buffer(bool quiet)
|
||||
return FALSE;
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
update_poshistory(openfile->filename, openfile->current->lineno, xplustabs() + 1);
|
||||
if (ISSET(POS_HISTORY))
|
||||
update_poshistory(openfile->filename,
|
||||
openfile->current->lineno, xplustabs() + 1);
|
||||
#endif
|
||||
|
||||
/* Switch to the next file buffer. */
|
||||
@@ -593,42 +673,42 @@ int is_file_writable(const char *filename)
|
||||
* Then attach this line after prevnode. */
|
||||
filestruct *read_line(char *buf, size_t buf_len, filestruct *prevnode)
|
||||
{
|
||||
filestruct *fileptr = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
filestruct *freshline = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
|
||||
/* Convert nulls to newlines. buf_len is the string's real length. */
|
||||
unsunder(buf, buf_len);
|
||||
|
||||
assert(openfile->fileage != NULL && strlen(buf) == buf_len);
|
||||
|
||||
fileptr->data = mallocstrcpy(NULL, buf);
|
||||
freshline->data = mallocstrcpy(NULL, buf);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If it's a DOS file ("\r\n"), and file conversion isn't disabled,
|
||||
* strip the '\r' part from fileptr->data. */
|
||||
* strip the '\r' part from the data. */
|
||||
if (!ISSET(NO_CONVERT) && buf_len > 0 && buf[buf_len - 1] == '\r')
|
||||
fileptr->data[buf_len - 1] = '\0';
|
||||
freshline->data[buf_len - 1] = '\0';
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
fileptr->multidata = NULL;
|
||||
freshline->multidata = NULL;
|
||||
#endif
|
||||
|
||||
fileptr->prev = prevnode;
|
||||
freshline->prev = prevnode;
|
||||
|
||||
if (prevnode == NULL) {
|
||||
/* Special case: we're inserting into the first line. */
|
||||
fileptr->next = openfile->fileage;
|
||||
openfile->fileage = fileptr;
|
||||
fileptr->lineno = 1;
|
||||
freshline->next = openfile->fileage;
|
||||
openfile->fileage = freshline;
|
||||
freshline->lineno = 1;
|
||||
/* Make sure that our edit window stays on the first line. */
|
||||
openfile->edittop = fileptr;
|
||||
openfile->edittop = freshline;
|
||||
} else {
|
||||
prevnode->next = fileptr;
|
||||
fileptr->next = NULL;
|
||||
fileptr->lineno = prevnode->lineno + 1;
|
||||
prevnode->next = freshline;
|
||||
freshline->next = NULL;
|
||||
freshline->lineno = prevnode->lineno + 1;
|
||||
}
|
||||
|
||||
return fileptr;
|
||||
return freshline;
|
||||
}
|
||||
|
||||
/* Read an open file into the current buffer. f should be set to the
|
||||
@@ -922,16 +1002,18 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
|
||||
* permissions, just try the relative one. */
|
||||
if (full_filename == NULL || (stat(full_filename, &fileinfo) == -1 &&
|
||||
stat(filename, &fileinfo2) != -1))
|
||||
full_filename = mallocstrcpy(NULL, filename);
|
||||
full_filename = mallocstrcpy(full_filename, filename);
|
||||
|
||||
if (stat(full_filename, &fileinfo) == -1) {
|
||||
/* All cases below return. */
|
||||
free(full_filename);
|
||||
|
||||
/* Well, maybe we can open the file even if the OS says it's
|
||||
* not there. */
|
||||
if ((fd = open(filename, O_RDONLY)) != -1) {
|
||||
if (!quiet)
|
||||
statusbar(_("Reading File"));
|
||||
free(full_filename);
|
||||
return 0;
|
||||
return fd;
|
||||
}
|
||||
|
||||
if (newfie) {
|
||||
@@ -944,6 +1026,8 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
|
||||
return -1;
|
||||
} else if (S_ISDIR(fileinfo.st_mode) || S_ISCHR(fileinfo.st_mode) ||
|
||||
S_ISBLK(fileinfo.st_mode)) {
|
||||
free(full_filename);
|
||||
|
||||
/* Don't open directories, character files, or block files.
|
||||
* Sorry, /dev/sndstat! */
|
||||
statusbar(S_ISDIR(fileinfo.st_mode) ?
|
||||
@@ -952,6 +1036,7 @@ int open_file(const char *filename, bool newfie, bool quiet, FILE **f)
|
||||
beep();
|
||||
return -1;
|
||||
} else if ((fd = open(full_filename, O_RDONLY)) == -1) {
|
||||
free(full_filename);
|
||||
statusbar(_("Error reading %s: %s"), filename, strerror(errno));
|
||||
beep();
|
||||
return -1;
|
||||
@@ -1196,20 +1281,23 @@ void do_insertfile(
|
||||
open_buffer(answer, TRUE);
|
||||
}
|
||||
|
||||
#if !defined(DISABLE_MULTIBUFFER) && !defined(DISABLE_HISTORIES)
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
if (ISSET(MULTIBUFFER)) {
|
||||
/* Update the screen to account for the current buffer. */
|
||||
display_buffer();
|
||||
|
||||
ssize_t savedposline, savedposcol;
|
||||
if (ISSET(POS_HISTORY) &&
|
||||
#ifndef DISABLE_HISTORIES
|
||||
if (ISSET(POS_HISTORY)) {
|
||||
ssize_t priorline, priorcol;
|
||||
#ifndef NANO_TINY
|
||||
!execute &&
|
||||
if (!execute)
|
||||
#endif
|
||||
check_poshistory(answer, &savedposline, &savedposcol))
|
||||
do_gotolinecolumn(savedposline, savedposcol, FALSE, FALSE);
|
||||
if (check_poshistory(answer, &priorline, &priorcol))
|
||||
do_gotolinecolumn(priorline, priorcol, FALSE, FALSE);
|
||||
}
|
||||
#endif /* !DISABLE_HISTORIES */
|
||||
} else
|
||||
#endif /* !DISABLE_MULTIBUFFER && !DISABLE_HISTORIES */
|
||||
#endif /* !DISABLE_MULTIBUFFER */
|
||||
{
|
||||
filestruct *top_save = openfile->fileage;
|
||||
|
||||
@@ -1416,10 +1504,10 @@ char *get_full_path(const char *origpath)
|
||||
* where we were before. We don't check for a chdir()
|
||||
* error, since we can do nothing if we get one. */
|
||||
IGNORE_CALL_RESULT(chdir(d_here));
|
||||
|
||||
/* Free d_here, since we're done using it. */
|
||||
free(d_here);
|
||||
}
|
||||
|
||||
/* Free d_here, since we're done using it. */
|
||||
free(d_here);
|
||||
}
|
||||
|
||||
/* At this point, if path_only is FALSE and d_there isn't NULL,
|
||||
@@ -1446,7 +1534,6 @@ char *check_writable_directory(const char *path)
|
||||
{
|
||||
char *full_path = get_full_path(path);
|
||||
|
||||
/* If get_full_path() fails, return NULL. */
|
||||
if (full_path == NULL)
|
||||
return NULL;
|
||||
|
||||
@@ -1457,7 +1544,6 @@ char *check_writable_directory(const char *path)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Otherwise, return the full path. */
|
||||
return full_path;
|
||||
}
|
||||
|
||||
@@ -1685,17 +1771,12 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
/* The result of stat(). TRUE if the file exists, FALSE
|
||||
* otherwise. If name is a link that points nowhere, realexists
|
||||
* is FALSE. */
|
||||
#endif
|
||||
struct stat st;
|
||||
/* The status fields filled in by stat(). */
|
||||
#endif
|
||||
bool anyexists;
|
||||
/* The result of lstat(). The same as realexists, unless name
|
||||
* is a link. */
|
||||
struct stat lst;
|
||||
/* The status fields filled in by lstat(). */
|
||||
char *realname;
|
||||
/* name after tilde expansion. */
|
||||
FILE *f = NULL;
|
||||
FILE *f = f_open;
|
||||
/* The actual file, realname, we are writing to. */
|
||||
char *tempname = NULL;
|
||||
/* The name of the temporary file we write to on prepend. */
|
||||
@@ -1705,9 +1786,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
if (*name == '\0')
|
||||
return -1;
|
||||
|
||||
if (f_open != NULL)
|
||||
f = f_open;
|
||||
|
||||
if (!tmp)
|
||||
titlebar(NULL);
|
||||
|
||||
@@ -1722,20 +1800,10 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
}
|
||||
#endif
|
||||
|
||||
anyexists = (lstat(realname, &lst) != -1);
|
||||
|
||||
/* If the temp file exists and isn't already open, give up. */
|
||||
if (tmp && anyexists && f_open == NULL)
|
||||
if (tmp && (lstat(realname, &st) != -1) && f_open == NULL)
|
||||
goto cleanup_and_exit;
|
||||
|
||||
/* If NOFOLLOW_SYMLINKS is set, it doesn't make sense to prepend or
|
||||
* append to a symlink. Here we warn about the contradiction. */
|
||||
if (ISSET(NOFOLLOW_SYMLINKS) && anyexists && S_ISLNK(lst.st_mode)) {
|
||||
statusbar(
|
||||
_("Cannot prepend or append to a symlink with --nofollow set"));
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Check whether the file (at the end of the symlink) exists. */
|
||||
realexists = (stat(realname, &st) != -1);
|
||||
@@ -1744,10 +1812,8 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
* specified it interactively), stat and save the value now,
|
||||
* or else we will chase null pointers when we do modtime checks,
|
||||
* preserve file times, and so on, during backup. */
|
||||
if (openfile->current_stat == NULL && !tmp && realexists) {
|
||||
openfile->current_stat = (struct stat *)nmalloc(sizeof(struct stat));
|
||||
stat(realname, openfile->current_stat);
|
||||
}
|
||||
if (openfile->current_stat == NULL && !tmp && realexists)
|
||||
stat_with_alloc(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
|
||||
@@ -1925,15 +1991,6 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
skip_backup:
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* If NOFOLLOW_SYMLINKS is set and the file is a link, we aren't
|
||||
* doing prepend or append. So we delete the link first, and just
|
||||
* overwrite. */
|
||||
if (ISSET(NOFOLLOW_SYMLINKS) && anyexists && S_ISLNK(lst.st_mode) &&
|
||||
unlink(realname) == -1) {
|
||||
statusbar(_("Error writing %s: %s"), realname, strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
if (f_open == NULL) {
|
||||
original_umask = umask(0);
|
||||
|
||||
@@ -2133,12 +2190,9 @@ bool write_file(const char *name, FILE *f_open, bool tmp, append_type
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Update current_stat to reference the file as it is now. */
|
||||
if (openfile->current_stat == NULL)
|
||||
openfile->current_stat =
|
||||
(struct stat *)nmalloc(sizeof(struct stat));
|
||||
if (!openfile->mark_set)
|
||||
stat(realname, openfile->current_stat);
|
||||
/* Get or update the stat info to reflect the current state. */
|
||||
stat_with_alloc(realname, &openfile->current_stat);
|
||||
#endif
|
||||
|
||||
statusbar(P_("Wrote %lu line", "Wrote %lu lines",
|
||||
@@ -2259,9 +2313,8 @@ int do_writeout(bool exiting)
|
||||
(append == APPEND) ? _("File Name to Append to") :
|
||||
_("File Name to Write");
|
||||
|
||||
/* If we're using restricted mode, the filename isn't blank,
|
||||
* and we're at the "Write File" prompt, disable tab
|
||||
* completion. */
|
||||
/* If we're using restricted mode, and the filename isn't blank,
|
||||
* disable tab completion. */
|
||||
i = do_prompt(!ISSET(RESTRICTED) ||
|
||||
openfile->filename[0] == '\0',
|
||||
#ifndef DISABLE_TABCOMP
|
||||
@@ -3107,69 +3160,93 @@ void save_history(void)
|
||||
/* Save the recorded last file positions to ~/.nano/filepos_history. */
|
||||
void save_poshistory(void)
|
||||
{
|
||||
char *poshist;
|
||||
char *poshist = poshistfilename();
|
||||
char *statusstr = NULL;
|
||||
poshiststruct *posptr;
|
||||
FILE *hist;
|
||||
|
||||
poshist = poshistfilename();
|
||||
if (poshist == NULL)
|
||||
return;
|
||||
|
||||
if (poshist != NULL) {
|
||||
FILE *hist = fopen(poshist, "wb");
|
||||
hist = fopen(poshist, "wb");
|
||||
|
||||
if (hist == NULL)
|
||||
fprintf(stderr, _("Error writing %s: %s\n"), poshist,
|
||||
strerror(errno));
|
||||
else {
|
||||
/* Make sure no one else can read from or write to the
|
||||
* history file. */
|
||||
chmod(poshist, S_IRUSR | S_IWUSR);
|
||||
if (hist == NULL)
|
||||
fprintf(stderr, _("Error writing %s: %s\n"), poshist, strerror(errno));
|
||||
else {
|
||||
/* Don't allow others to read or write the history file. */
|
||||
chmod(poshist, S_IRUSR | S_IWUSR);
|
||||
|
||||
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
|
||||
statusstr = charalloc(strlen(posptr->filename) + 2 * sizeof(ssize_t) + 4);
|
||||
sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno,
|
||||
for (posptr = position_history; posptr != NULL; posptr = posptr->next) {
|
||||
statusstr = charalloc(strlen(posptr->filename) + 2 * sizeof(ssize_t) + 4);
|
||||
sprintf(statusstr, "%s %ld %ld\n", posptr->filename, (long)posptr->lineno,
|
||||
(long)posptr->xno);
|
||||
if (fwrite(statusstr, sizeof(char), strlen(statusstr), hist) < strlen(statusstr))
|
||||
fprintf(stderr, _("Error writing %s: %s\n"), poshist,
|
||||
strerror(errno));
|
||||
free(statusstr);
|
||||
}
|
||||
fclose(hist);
|
||||
if (fwrite(statusstr, sizeof(char), strlen(statusstr), hist) < strlen(statusstr))
|
||||
fprintf(stderr, _("Error writing %s: %s\n"), poshist, strerror(errno));
|
||||
free(statusstr);
|
||||
}
|
||||
free(poshist);
|
||||
fclose(hist);
|
||||
}
|
||||
free(poshist);
|
||||
}
|
||||
|
||||
/* Update the recorded last file positions, given a filename, a line
|
||||
* and a column. If no entry is found, add a new one at the end. */
|
||||
void update_poshistory(char *filename, ssize_t lineno, ssize_t xpos)
|
||||
{
|
||||
poshiststruct *posptr, *posprev = NULL;
|
||||
poshiststruct *posptr, *theone, *posprev = NULL;
|
||||
char *fullpath = get_full_path(filename);
|
||||
|
||||
if (fullpath == NULL)
|
||||
if (fullpath == NULL || fullpath[strlen(fullpath) - 1] == '/') {
|
||||
free(fullpath);
|
||||
return;
|
||||
}
|
||||
|
||||
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
|
||||
if (!strcmp(posptr->filename, fullpath)) {
|
||||
posptr->lineno = lineno;
|
||||
posptr->xno = xpos;
|
||||
free(fullpath);
|
||||
return;
|
||||
}
|
||||
/* Look for a matching filename in the list. */
|
||||
for (posptr = position_history; posptr != NULL; posptr = posptr->next) {
|
||||
if (!strcmp(posptr->filename, fullpath))
|
||||
break;
|
||||
posprev = posptr;
|
||||
}
|
||||
|
||||
/* Didn't find it, make a new node yo! */
|
||||
posptr = (poshiststruct *)nmalloc(sizeof(poshiststruct));
|
||||
posptr->filename = mallocstrcpy(NULL, fullpath);
|
||||
posptr->lineno = lineno;
|
||||
posptr->xno = xpos;
|
||||
posptr->next = NULL;
|
||||
/* Don't record files that have the default cursor position. */
|
||||
if (lineno == 1 && xpos == 1) {
|
||||
if (posptr != NULL) {
|
||||
if (posprev == NULL)
|
||||
position_history = posptr->next;
|
||||
else
|
||||
posprev->next = posptr->next;
|
||||
free(posptr->filename);
|
||||
free(posptr);
|
||||
}
|
||||
free(fullpath);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!poshistory)
|
||||
poshistory = posptr;
|
||||
else
|
||||
posprev->next = posptr;
|
||||
theone = posptr;
|
||||
|
||||
/* If we didn't find it, make a new node; otherwise, if we're
|
||||
* not at the end, move the matching one to the end. */
|
||||
if (theone == NULL) {
|
||||
theone = (poshiststruct *)nmalloc(sizeof(poshiststruct));
|
||||
theone->filename = mallocstrcpy(NULL, fullpath);
|
||||
if (position_history == NULL)
|
||||
position_history = theone;
|
||||
else
|
||||
posprev->next = theone;
|
||||
} else if (posptr->next != NULL) {
|
||||
if (posprev == NULL)
|
||||
position_history = posptr->next;
|
||||
else
|
||||
posprev->next = posptr->next;
|
||||
while (posptr->next != NULL)
|
||||
posptr = posptr->next;
|
||||
posptr->next = theone;
|
||||
}
|
||||
|
||||
/* Store the last cursor position. */
|
||||
theone->lineno = lineno;
|
||||
theone->xno = xpos;
|
||||
theone->next = NULL;
|
||||
|
||||
free(fullpath);
|
||||
}
|
||||
@@ -3185,7 +3262,7 @@ int check_poshistory(const char *file, ssize_t *line, ssize_t *column)
|
||||
if (fullpath == NULL)
|
||||
return 0;
|
||||
|
||||
for (posptr = poshistory; posptr != NULL; posptr = posptr->next) {
|
||||
for (posptr = position_history; posptr != NULL; posptr = posptr->next) {
|
||||
if (!strcmp(posptr->filename, fullpath)) {
|
||||
*line = posptr->lineno;
|
||||
*column = posptr->xno;
|
||||
@@ -3200,59 +3277,64 @@ int check_poshistory(const char *file, ssize_t *line, ssize_t *column)
|
||||
/* Load the recorded file positions from ~/.nano/filepos_history. */
|
||||
void load_poshistory(void)
|
||||
{
|
||||
char *nanohist = poshistfilename();
|
||||
char *poshist = poshistfilename();
|
||||
FILE *hist;
|
||||
|
||||
/* Assume do_rcfile() has reported a missing home directory. */
|
||||
if (nanohist != NULL) {
|
||||
FILE *hist = fopen(nanohist, "rb");
|
||||
/* If the home directory is missing, do_rcfile() will have reported it. */
|
||||
if (poshist == NULL)
|
||||
return;
|
||||
|
||||
if (hist == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
/* Don't save history when we quit. */
|
||||
UNSET(POS_HISTORY);
|
||||
history_error(N_("Error reading %s: %s"), nanohist,
|
||||
strerror(errno));
|
||||
}
|
||||
} else {
|
||||
char *line = NULL, *lineptr, *xptr;
|
||||
size_t buf_len = 0;
|
||||
ssize_t read, lineno, xno;
|
||||
poshiststruct *posptr;
|
||||
hist = fopen(poshist, "rb");
|
||||
|
||||
/* Read and parse each line, and put the data into the
|
||||
* positions history structure. */
|
||||
while ((read = getline(&line, &buf_len, hist)) >= 0) {
|
||||
if (read > 0 && line[read - 1] == '\n') {
|
||||
read--;
|
||||
line[read] = '\0';
|
||||
}
|
||||
if (read > 0)
|
||||
unsunder(line, read);
|
||||
lineptr = parse_next_word(line);
|
||||
xptr = parse_next_word(lineptr);
|
||||
lineno = atoi(lineptr);
|
||||
xno = atoi(xptr);
|
||||
if (poshistory == NULL) {
|
||||
poshistory = (poshiststruct *)nmalloc(sizeof(poshiststruct));
|
||||
poshistory->filename = mallocstrcpy(NULL, line);
|
||||
poshistory->lineno = lineno;
|
||||
poshistory->xno = xno;
|
||||
poshistory->next = NULL;
|
||||
} else {
|
||||
for (posptr = poshistory; posptr->next != NULL; posptr = posptr->next)
|
||||
;
|
||||
posptr->next = (poshiststruct *)nmalloc(sizeof(poshiststruct));
|
||||
posptr->next->filename = mallocstrcpy(NULL, line);
|
||||
posptr->next->lineno = lineno;
|
||||
posptr->next->xno = xno;
|
||||
posptr->next->next = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
fclose(hist);
|
||||
free(line);
|
||||
if (hist == NULL) {
|
||||
if (errno != ENOENT) {
|
||||
/* When reading failed, don't save history when we quit. */
|
||||
UNSET(POS_HISTORY);
|
||||
history_error(N_("Error reading %s: %s"), poshist, strerror(errno));
|
||||
}
|
||||
free(nanohist);
|
||||
} else {
|
||||
char *line = NULL, *lineptr, *xptr;
|
||||
size_t buf_len = 0;
|
||||
ssize_t read, count = 0;
|
||||
poshiststruct *record_ptr = NULL, *newrecord;
|
||||
|
||||
/* Read and parse each line, and store the extracted data. */
|
||||
while ((read = getline(&line, &buf_len, hist)) > 2) {
|
||||
if (line[read - 1] == '\n')
|
||||
line[--read] = '\0';
|
||||
unsunder(line, read);
|
||||
|
||||
lineptr = parse_next_word(line);
|
||||
xptr = parse_next_word(lineptr);
|
||||
|
||||
/* Create a new position record. */
|
||||
newrecord = (poshiststruct *)nmalloc(sizeof(poshiststruct));
|
||||
newrecord->filename = mallocstrcpy(NULL, line);
|
||||
newrecord->lineno = atoi(lineptr);
|
||||
newrecord->xno = atoi(xptr);
|
||||
newrecord->next = NULL;
|
||||
|
||||
/* Add the record to the list. */
|
||||
if (position_history == NULL)
|
||||
position_history = newrecord;
|
||||
else
|
||||
record_ptr->next = newrecord;
|
||||
|
||||
record_ptr = newrecord;
|
||||
|
||||
/* Impose a limit, so the file will not grow indefinitely. */
|
||||
if (++count > 200) {
|
||||
poshiststruct *drop_record = position_history;
|
||||
|
||||
position_history = position_history->next;
|
||||
|
||||
free(drop_record->filename);
|
||||
free(drop_record);
|
||||
}
|
||||
}
|
||||
fclose(hist);
|
||||
free(line);
|
||||
}
|
||||
free(poshist);
|
||||
}
|
||||
#endif /* !DISABLE_HISTORIES */
|
||||
|
||||
13
src/global.c
13
src/global.c
@@ -190,7 +190,7 @@ filestruct *replaceage = NULL;
|
||||
/* The top of the replace string history list. */
|
||||
filestruct *replacebot = NULL;
|
||||
/* The bottom of the replace string history list. */
|
||||
poshiststruct *poshistory;
|
||||
poshiststruct *position_history = NULL;
|
||||
/* The cursor position history list. */
|
||||
#endif
|
||||
|
||||
@@ -480,7 +480,7 @@ void print_sclist(void)
|
||||
const char *exit_tag = N_("Exit");
|
||||
const char *close_tag = N_("Close");
|
||||
const char *uncut_tag = N_("Uncut Text");
|
||||
#ifndef DISABLE_JUSITIFY
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *unjust_tag = N_("Unjustify");
|
||||
#endif
|
||||
|
||||
@@ -552,11 +552,11 @@ void shortcut_init(void)
|
||||
const char *nano_undo_msg = N_("Undo the last operation");
|
||||
const char *nano_redo_msg = N_("Redo the last undone operation");
|
||||
#endif
|
||||
const char *nano_forward_msg = N_("Go forward one character");
|
||||
const char *nano_back_msg = N_("Go back one character");
|
||||
const char *nano_forward_msg = N_("Go forward one character");
|
||||
#ifndef NANO_TINY
|
||||
const char *nano_nextword_msg = N_("Go forward one word");
|
||||
const char *nano_prevword_msg = N_("Go back one word");
|
||||
const char *nano_nextword_msg = N_("Go forward one word");
|
||||
#endif
|
||||
const char *nano_prevline_msg = N_("Go to previous line");
|
||||
const char *nano_nextline_msg = N_("Go to next line");
|
||||
@@ -908,6 +908,7 @@ void shortcut_init(void)
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_to_funcs(do_cut_prev_word, MMAIN,
|
||||
/* TRANSLATORS: The next two strings refer to cutting words. */
|
||||
N_("Cut Left"), IFSCHELP(nano_cut_word_left_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_cut_next_word, MMAIN,
|
||||
N_("Cut Right"), IFSCHELP(nano_cut_word_right_msg), TOGETHER, NOVIEW);
|
||||
@@ -1014,8 +1015,8 @@ void shortcut_init(void)
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
/* TRANSLATORS: Try to keep the next two strings at most 20 characters. */
|
||||
add_to_funcs(do_page_up, MLINTER,
|
||||
/* TRANSLATORS: Try to keep the next two strings at most 20 characters. */
|
||||
N_("Prev Lint Msg"), IFSCHELP(nano_prevlint_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_page_down, MLINTER,
|
||||
N_("Next Lint Msg"), IFSCHELP(nano_nextlint_msg), TOGETHER, VIEW);
|
||||
@@ -1260,7 +1261,7 @@ void set_spell_shortcuts(void)
|
||||
replace_scs_for(do_linter, do_spell);
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
#endif /* !DISABLE_COLOR */
|
||||
|
||||
const subnfunc *sctofunc(const sc *s)
|
||||
{
|
||||
|
||||
25
src/nano.c
25
src/nano.c
@@ -561,6 +561,8 @@ void delete_opennode(openfilestruct *fileptr)
|
||||
#ifndef NANO_TINY
|
||||
free(fileptr->current_stat);
|
||||
free(fileptr->lock_filename);
|
||||
/* Free the undo stack. */
|
||||
discard_until(NULL, fileptr);
|
||||
#endif
|
||||
free(fileptr);
|
||||
}
|
||||
@@ -918,7 +920,6 @@ void usage(void)
|
||||
print_opt("-i", "--autoindent", N_("Automatically indent new lines"));
|
||||
print_opt("-k", "--cut", N_("Cut from cursor to end of line"));
|
||||
#endif
|
||||
print_opt("-l", "--nofollow", N_("Don't follow symbolic links, overwrite"));
|
||||
#ifndef DISABLE_MOUSE
|
||||
print_opt("-m", "--mouse", N_("Enable the use of the mouse"));
|
||||
#endif
|
||||
@@ -1105,7 +1106,6 @@ void no_current_file_name_warning(void)
|
||||
beep();
|
||||
|
||||
/* Ensure that we see the warning. */
|
||||
doupdate();
|
||||
napms(1800);
|
||||
|
||||
curs_set(1);
|
||||
@@ -1346,9 +1346,6 @@ RETSIGTYPE do_continue(int signal)
|
||||
/* Restore the terminal to its previous state. */
|
||||
terminal_init();
|
||||
|
||||
/* Turn the cursor back on for sure. */
|
||||
curs_set(1);
|
||||
|
||||
/* Redraw the contents of the windows that need it. */
|
||||
blank_statusbar();
|
||||
wnoutrefresh(bottomwin);
|
||||
@@ -1407,9 +1404,6 @@ void regenerate_screen(void)
|
||||
/* Restore the terminal to its previous state. */
|
||||
terminal_init();
|
||||
|
||||
/* Turn the cursor back on for sure. */
|
||||
curs_set(1);
|
||||
|
||||
/* Do the equivalent of what both mutt and Minimum Profit do:
|
||||
* Reinitialize all the windows based on the new screen
|
||||
* dimensions. */
|
||||
@@ -2008,7 +2002,6 @@ int main(int argc, char **argv)
|
||||
{"constantshow", 0, NULL, 'c'},
|
||||
{"rebinddelete", 0, NULL, 'd'},
|
||||
{"help", 0, NULL, 'h'},
|
||||
{"nofollow", 0, NULL, 'l'},
|
||||
#ifndef DISABLE_MOUSE
|
||||
{"mouse", 0, NULL, 'm'},
|
||||
#endif
|
||||
@@ -2212,9 +2205,6 @@ int main(int argc, char **argv)
|
||||
SET(CUT_TO_END);
|
||||
break;
|
||||
#endif
|
||||
case 'l':
|
||||
SET(NOFOLLOW_SYMLINKS);
|
||||
break;
|
||||
#ifndef DISABLE_MOUSE
|
||||
case 'm':
|
||||
SET(USE_MOUSE);
|
||||
@@ -2538,9 +2528,6 @@ int main(int argc, char **argv)
|
||||
/* Set up the terminal state. */
|
||||
terminal_init();
|
||||
|
||||
/* Turn the cursor on for sure. */
|
||||
curs_set(1);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "Main: set up windows\n");
|
||||
#endif
|
||||
@@ -2626,7 +2613,7 @@ int main(int argc, char **argv)
|
||||
icol = 0;
|
||||
}
|
||||
#ifndef DISABLE_HISTORIES
|
||||
else {
|
||||
else if (ISSET(POS_HISTORY)) {
|
||||
ssize_t savedposline, savedposcol;
|
||||
/* If edited before, restore the last cursor position. */
|
||||
if (check_poshistory(argv[i], &savedposline, &savedposcol))
|
||||
@@ -2664,7 +2651,7 @@ int main(int argc, char **argv)
|
||||
if (startline > 0 || startcol > 0)
|
||||
do_gotolinecolumn(startline, startcol, FALSE, FALSE);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
else {
|
||||
else if (ISSET(POS_HISTORY)) {
|
||||
ssize_t savedposline, savedposcol;
|
||||
/* If the file was edited before, restore the last cursor position. */
|
||||
if (check_poshistory(argv[optind], &savedposline, &savedposcol))
|
||||
@@ -2681,10 +2668,6 @@ int main(int argc, char **argv)
|
||||
reset_cursor();
|
||||
wnoutrefresh(edit);
|
||||
|
||||
/* Just in case we were at the statusbar prompt, make sure the
|
||||
* statusbar cursor position is reset. */
|
||||
do_prompt_abort();
|
||||
|
||||
/* If constant cursor position display is on, and there are no
|
||||
* keys waiting in the input buffer, display the current cursor
|
||||
* position on the statusbar. */
|
||||
|
||||
@@ -484,7 +484,6 @@ enum
|
||||
CASE_SENSITIVE,
|
||||
CONST_UPDATE,
|
||||
NO_HELP,
|
||||
NOFOLLOW_SYMLINKS,
|
||||
SUSPEND,
|
||||
NO_WRAP,
|
||||
AUTOINDENT,
|
||||
|
||||
468
src/prompt.c
468
src/prompt.c
@@ -37,9 +37,6 @@ static size_t old_statusbar_x = (size_t)-1;
|
||||
/* The old cursor position in answer, if any. */
|
||||
static size_t old_pww = (size_t)-1;
|
||||
/* The old place we want in answer, if any. */
|
||||
static bool reset_statusbar_x = FALSE;
|
||||
/* Should we reset the cursor position at the statusbar
|
||||
* prompt? */
|
||||
|
||||
/* Read in a character, interpret it as a shortcut or toggle if
|
||||
* necessary, and return it.
|
||||
@@ -147,14 +144,15 @@ int do_statusbar_input(bool *ran_func, bool *finished,
|
||||
if (have_shortcut) {
|
||||
if (s->scfunc == do_tab || s->scfunc == do_enter)
|
||||
;
|
||||
else if (s->scfunc == total_refresh)
|
||||
total_statusbar_refresh(refresh_func);
|
||||
else if (s->scfunc == do_cut_text_void) {
|
||||
else if (s->scfunc == total_refresh) {
|
||||
total_redraw();
|
||||
refresh_func();
|
||||
} else if (s->scfunc == do_cut_text_void) {
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable Cut. */
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||
'\0' || currmenu != MWRITEFILE)
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] == '\0' ||
|
||||
currmenu != MWRITEFILE)
|
||||
do_statusbar_cut_text();
|
||||
} else if (s->scfunc == do_left)
|
||||
do_statusbar_left();
|
||||
@@ -162,9 +160,9 @@ int do_statusbar_input(bool *ran_func, bool *finished,
|
||||
do_statusbar_right();
|
||||
#ifndef NANO_TINY
|
||||
else if (s->scfunc == do_prev_word_void)
|
||||
do_statusbar_prev_word(FALSE);
|
||||
do_statusbar_prev_word();
|
||||
else if (s->scfunc == do_next_word_void)
|
||||
do_statusbar_next_word(FALSE);
|
||||
do_statusbar_next_word();
|
||||
#endif
|
||||
else if (s->scfunc == do_home)
|
||||
do_statusbar_home();
|
||||
@@ -194,15 +192,15 @@ int do_statusbar_input(bool *ran_func, bool *finished,
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable Delete. */
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||
'\0' || currmenu != MWRITEFILE)
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] == '\0' ||
|
||||
currmenu != MWRITEFILE)
|
||||
do_statusbar_delete();
|
||||
} else if (s->scfunc == do_backspace) {
|
||||
/* If we're using restricted mode, the filename
|
||||
* isn't blank, and we're at the "Write File"
|
||||
* prompt, disable Backspace. */
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] ==
|
||||
'\0' || currmenu != MWRITEFILE)
|
||||
if (!ISSET(RESTRICTED) || openfile->filename[0] == '\0' ||
|
||||
currmenu != MWRITEFILE)
|
||||
do_statusbar_backspace();
|
||||
} else {
|
||||
/* Handle any other shortcut in the current menu, setting
|
||||
@@ -233,8 +231,7 @@ int do_statusbar_mouse(void)
|
||||
int retval = get_mouseinput(&mouse_x, &mouse_y, TRUE);
|
||||
|
||||
/* We can click on the statusbar window text to move the cursor. */
|
||||
if (retval == 0 && wmouse_trafo(bottomwin, &mouse_y, &mouse_x,
|
||||
FALSE)) {
|
||||
if (retval == 0 && wmouse_trafo(bottomwin, &mouse_y, &mouse_x, FALSE)) {
|
||||
size_t start_col;
|
||||
|
||||
assert(prompt != NULL);
|
||||
@@ -243,15 +240,10 @@ int do_statusbar_mouse(void)
|
||||
|
||||
/* Move to where the click occurred. */
|
||||
if (mouse_x >= start_col && mouse_y == 0) {
|
||||
size_t pww_save = statusbar_pww;
|
||||
|
||||
statusbar_x = actual_x(answer,
|
||||
get_statusbar_page_start(start_col, start_col +
|
||||
statusbar_xplustabs()) + mouse_x - start_col);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_bar_if_needed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -310,9 +302,8 @@ void do_statusbar_output(char *output, size_t output_len, bool
|
||||
|
||||
assert(statusbar_x <= answer_len);
|
||||
|
||||
charmove(answer + statusbar_x + char_buf_len,
|
||||
answer + statusbar_x, answer_len - statusbar_x +
|
||||
char_buf_len);
|
||||
charmove(answer + statusbar_x + char_buf_len, answer + statusbar_x,
|
||||
answer_len - statusbar_x + char_buf_len);
|
||||
strncpy(answer + statusbar_x, char_buf, char_buf_len);
|
||||
answer_len += char_buf_len;
|
||||
|
||||
@@ -323,62 +314,29 @@ void do_statusbar_output(char *output, size_t output_len, bool
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_the_statusbar();
|
||||
}
|
||||
|
||||
/* Move to the beginning of the prompt text. If the SMART_HOME flag is
|
||||
* set, move to the first non-whitespace character of the prompt text if
|
||||
* we're not already there, or to the beginning of the prompt text if we
|
||||
* are. */
|
||||
/* Move to the beginning of the prompt text. */
|
||||
void do_statusbar_home(void)
|
||||
{
|
||||
size_t pww_save = statusbar_pww;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(SMART_HOME)) {
|
||||
size_t statusbar_x_save = statusbar_x;
|
||||
|
||||
statusbar_x = indent_length(answer);
|
||||
|
||||
if (statusbar_x == statusbar_x_save ||
|
||||
statusbar_x == strlen(answer))
|
||||
statusbar_x = 0;
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
statusbar_x = 0;
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
}
|
||||
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
statusbar_x = 0;
|
||||
update_bar_if_needed();
|
||||
}
|
||||
|
||||
/* Move to the end of the prompt text. */
|
||||
void do_statusbar_end(void)
|
||||
{
|
||||
size_t pww_save = statusbar_pww;
|
||||
|
||||
statusbar_x = strlen(answer);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_bar_if_needed();
|
||||
}
|
||||
|
||||
/* Move left one character. */
|
||||
void do_statusbar_left(void)
|
||||
{
|
||||
if (statusbar_x > 0) {
|
||||
size_t pww_save = statusbar_pww;
|
||||
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_bar_if_needed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -386,13 +344,8 @@ void do_statusbar_left(void)
|
||||
void do_statusbar_right(void)
|
||||
{
|
||||
if (statusbar_x < strlen(answer)) {
|
||||
size_t pww_save = statusbar_pww;
|
||||
|
||||
statusbar_x = move_mbright(answer, statusbar_x);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_bar_if_needed();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -400,7 +353,7 @@ void do_statusbar_right(void)
|
||||
void do_statusbar_backspace(void)
|
||||
{
|
||||
if (statusbar_x > 0) {
|
||||
do_statusbar_left();
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
do_statusbar_delete();
|
||||
}
|
||||
}
|
||||
@@ -411,19 +364,17 @@ void do_statusbar_delete(void)
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (answer[statusbar_x] != '\0') {
|
||||
int char_buf_len = parse_mbchar(answer + statusbar_x, NULL,
|
||||
NULL);
|
||||
int char_buf_len = parse_mbchar(answer + statusbar_x, NULL, NULL);
|
||||
size_t line_len = strlen(answer + statusbar_x);
|
||||
|
||||
assert(statusbar_x < strlen(answer));
|
||||
|
||||
charmove(answer + statusbar_x, answer + statusbar_x +
|
||||
char_buf_len, strlen(answer) - statusbar_x -
|
||||
char_buf_len + 1);
|
||||
charmove(answer + statusbar_x, answer + statusbar_x + char_buf_len,
|
||||
strlen(answer) - statusbar_x - char_buf_len + 1);
|
||||
|
||||
null_at(&answer, statusbar_x + line_len - char_buf_len);
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_the_statusbar();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,168 +394,57 @@ void do_statusbar_cut_text(void)
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
}
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_the_statusbar();
|
||||
}
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Move to the next word in the prompt text. If allow_punct is TRUE,
|
||||
* treat punctuation as part of a word. Return TRUE if we started on a
|
||||
* word, and FALSE otherwise. */
|
||||
bool do_statusbar_next_word(bool allow_punct)
|
||||
/* Move to the next word in the prompt text. */
|
||||
void do_statusbar_next_word(void)
|
||||
{
|
||||
size_t pww_save = statusbar_pww;
|
||||
char *char_mb;
|
||||
int char_mb_len;
|
||||
bool end_line = FALSE, started_on_word = FALSE;
|
||||
bool seen_space = !is_word_mbchar(answer + statusbar_x, FALSE);
|
||||
|
||||
assert(answer != NULL);
|
||||
|
||||
char_mb = charalloc(mb_cur_max());
|
||||
/* Move forward until we reach the start of a word. */
|
||||
while (answer[statusbar_x] != '\0') {
|
||||
statusbar_x = move_mbright(answer, statusbar_x);
|
||||
|
||||
/* Move forward until we find the character after the last letter of
|
||||
* the current word. */
|
||||
while (!end_line) {
|
||||
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving forward through the current
|
||||
* line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
/* If this is not a word character, then it's a separator; else
|
||||
* if we've already seen a separator, then it's a word start. */
|
||||
if (!is_word_mbchar(answer + statusbar_x, FALSE))
|
||||
seen_space = TRUE;
|
||||
else if (seen_space)
|
||||
break;
|
||||
|
||||
/* If we haven't found it, then we've started on a word, so set
|
||||
* started_on_word to TRUE. */
|
||||
started_on_word = TRUE;
|
||||
|
||||
if (answer[statusbar_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
statusbar_x += char_mb_len;
|
||||
}
|
||||
|
||||
/* Move forward until we find the first letter of the next word. */
|
||||
if (answer[statusbar_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
statusbar_x += char_mb_len;
|
||||
|
||||
while (!end_line) {
|
||||
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving forward through the current
|
||||
* line. */
|
||||
if (is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
if (answer[statusbar_x] == '\0')
|
||||
end_line = TRUE;
|
||||
else
|
||||
statusbar_x += char_mb_len;
|
||||
}
|
||||
|
||||
free(char_mb);
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
return started_on_word;
|
||||
update_bar_if_needed();
|
||||
}
|
||||
|
||||
/* Move to the previous word in the prompt text. If allow_punct is
|
||||
* TRUE, treat punctuation as part of a word. Return TRUE if we started
|
||||
* on a word, and FALSE otherwise. */
|
||||
bool do_statusbar_prev_word(bool allow_punct)
|
||||
/* Move to the previous word in the prompt text. */
|
||||
void do_statusbar_prev_word(void)
|
||||
{
|
||||
size_t pww_save = statusbar_pww;
|
||||
char *char_mb;
|
||||
int char_mb_len;
|
||||
bool begin_line = FALSE, started_on_word = FALSE;
|
||||
bool seen_a_word = FALSE, step_forward = FALSE;
|
||||
|
||||
assert(answer != NULL);
|
||||
|
||||
char_mb = charalloc(mb_cur_max());
|
||||
|
||||
/* Move backward until we find the character before the first letter
|
||||
* of the current word. */
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the current
|
||||
* line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
/* If we haven't found it, then we've started on a word, so set
|
||||
* started_on_word to TRUE. */
|
||||
started_on_word = TRUE;
|
||||
|
||||
if (statusbar_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
}
|
||||
|
||||
/* Move backward until we find the last letter of the previous
|
||||
* word. */
|
||||
if (statusbar_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
/* Move backward until we pass over the start of a word. */
|
||||
while (statusbar_x != 0) {
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb, NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the current
|
||||
* line. */
|
||||
if (is_word_mbchar(char_mb, allow_punct))
|
||||
if (is_word_mbchar(answer + statusbar_x, FALSE))
|
||||
seen_a_word = TRUE;
|
||||
else if (seen_a_word) {
|
||||
/* This is space now: we've overshot the start of the word. */
|
||||
step_forward = TRUE;
|
||||
break;
|
||||
|
||||
if (statusbar_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
}
|
||||
|
||||
/* If we've found it, move backward until we find the character
|
||||
* before the first letter of the previous word. */
|
||||
if (!begin_line) {
|
||||
if (statusbar_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
|
||||
while (!begin_line) {
|
||||
char_mb_len = parse_mbchar(answer + statusbar_x, char_mb,
|
||||
NULL);
|
||||
|
||||
/* If we've found it, stop moving backward through the
|
||||
* current line. */
|
||||
if (!is_word_mbchar(char_mb, allow_punct))
|
||||
break;
|
||||
|
||||
if (statusbar_x == 0)
|
||||
begin_line = TRUE;
|
||||
else
|
||||
statusbar_x = move_mbleft(answer, statusbar_x);
|
||||
}
|
||||
|
||||
/* If we've found it, move forward to the first letter of the
|
||||
* previous word. */
|
||||
if (!begin_line)
|
||||
statusbar_x += char_mb_len;
|
||||
}
|
||||
|
||||
free(char_mb);
|
||||
if (step_forward)
|
||||
/* Move one character forward again to sit on the start of the word. */
|
||||
statusbar_x = move_mbright(answer, statusbar_x);
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (need_statusbar_update(pww_save))
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
|
||||
/* Return whether we started on a word. */
|
||||
return started_on_word;
|
||||
update_bar_if_needed();
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
@@ -634,7 +474,6 @@ void do_statusbar_verbatim_input(bool *got_enter)
|
||||
free(output);
|
||||
}
|
||||
|
||||
|
||||
/* Return the placewewant associated with statusbar_x, i.e. the
|
||||
* zero-based column position of the cursor. The value will be no
|
||||
* smaller than statusbar_x. */
|
||||
@@ -667,18 +506,16 @@ void reset_statusbar_cursor(void)
|
||||
get_statusbar_page_start(start_col, start_col + xpt));
|
||||
}
|
||||
|
||||
/* Repaint the statusbar when getting a character in
|
||||
* get_prompt_string(). The statusbar text line will be displayed
|
||||
* starting with curranswer[index]. */
|
||||
void update_statusbar_line(const char *curranswer, size_t index)
|
||||
/* Repaint the statusbar. */
|
||||
void update_the_statusbar(void)
|
||||
{
|
||||
size_t start_col, page_start;
|
||||
size_t start_col, index, page_start;
|
||||
char *expanded;
|
||||
|
||||
assert(prompt != NULL && index <= strlen(curranswer));
|
||||
assert(prompt != NULL && statusbar_x <= strlen(answer));
|
||||
|
||||
start_col = strlenpt(prompt) + 2;
|
||||
index = strnlenpt(curranswer, index);
|
||||
index = strnlenpt(answer, statusbar_x);
|
||||
page_start = get_statusbar_page_start(start_col, start_col + index);
|
||||
|
||||
if (interface_color_pair[TITLE_BAR].bright)
|
||||
@@ -691,39 +528,32 @@ void update_statusbar_line(const char *curranswer, size_t index)
|
||||
waddch(bottomwin, ':');
|
||||
waddch(bottomwin, (page_start == 0) ? ' ' : '$');
|
||||
|
||||
expanded = display_string(curranswer, page_start, COLS - start_col -
|
||||
1, FALSE);
|
||||
expanded = display_string(answer, page_start, COLS - start_col - 1, FALSE);
|
||||
waddstr(bottomwin, expanded);
|
||||
free(expanded);
|
||||
|
||||
wattroff(bottomwin, A_BOLD);
|
||||
wattroff(bottomwin, interface_color_pair[TITLE_BAR].pairnum);
|
||||
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
reset_statusbar_cursor();
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
|
||||
/* Return TRUE if we need an update after moving the cursor, and FALSE
|
||||
* otherwise. We need an update if pww_save and statusbar_pww are on
|
||||
* different pages. */
|
||||
bool need_statusbar_update(size_t pww_save)
|
||||
/* Update the statusbar line /if/ the placewewant changes page. */
|
||||
void update_bar_if_needed(void)
|
||||
{
|
||||
size_t start_col = strlenpt(prompt) + 2;
|
||||
size_t was_pww = statusbar_pww;
|
||||
|
||||
return get_statusbar_page_start(start_col, start_col + pww_save) !=
|
||||
get_statusbar_page_start(start_col, start_col + statusbar_pww);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
|
||||
if (get_statusbar_page_start(start_col, start_col + statusbar_pww) !=
|
||||
get_statusbar_page_start(start_col, start_col + was_pww))
|
||||
update_the_statusbar();
|
||||
}
|
||||
|
||||
/* Unconditionally redraw the entire screen, and then refresh it using
|
||||
* refresh_func(). */
|
||||
void total_statusbar_refresh(void (*refresh_func)(void))
|
||||
{
|
||||
total_redraw();
|
||||
refresh_func();
|
||||
}
|
||||
|
||||
/* Get a string of input at the statusbar prompt. This should only be
|
||||
* called from do_prompt(). */
|
||||
/* Get a string of input at the statusbar prompt. */
|
||||
functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool allow_files,
|
||||
@@ -737,7 +567,6 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
{
|
||||
int kbinput = ERR;
|
||||
bool ran_func, finished;
|
||||
size_t curranswer_len;
|
||||
functionptrtype func;
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool tabbed = FALSE;
|
||||
@@ -759,23 +588,9 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
#endif /* !DISABLE_HISTORIES */
|
||||
|
||||
answer = mallocstrcpy(answer, curranswer);
|
||||
curranswer_len = strlen(answer);
|
||||
|
||||
/* If reset_statusbar_x is TRUE, restore statusbar_x and
|
||||
* statusbar_pww to what they were before this prompt. Then, if
|
||||
* statusbar_x is uninitialized or past the end of curranswer, put
|
||||
* statusbar_x at the end of the string and update statusbar_pww
|
||||
* based on it. We do these things so that the cursor position
|
||||
* stays at the right place if a prompt-changing toggle is pressed,
|
||||
* or if this prompt was started from another prompt and we cancel
|
||||
* out of it. */
|
||||
if (reset_statusbar_x) {
|
||||
statusbar_x = old_statusbar_x;
|
||||
statusbar_pww = old_pww;
|
||||
}
|
||||
|
||||
if (statusbar_x == (size_t)-1 || statusbar_x > curranswer_len) {
|
||||
statusbar_x = curranswer_len;
|
||||
if (statusbar_x > strlen(answer)) {
|
||||
statusbar_x = strlen(answer);
|
||||
statusbar_pww = statusbar_xplustabs();
|
||||
}
|
||||
|
||||
@@ -783,10 +598,9 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
fprintf(stderr, "get_prompt_string: answer = \"%s\", statusbar_x = %lu\n", answer, (unsigned long) statusbar_x);
|
||||
#endif
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_the_statusbar();
|
||||
|
||||
/* Refresh the edit window and the statusbar before getting
|
||||
* input. */
|
||||
/* Refresh edit window and statusbar before getting input. */
|
||||
wnoutrefresh(edit);
|
||||
wnoutrefresh(bottomwin);
|
||||
|
||||
@@ -800,13 +614,12 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
assert(statusbar_x <= strlen(answer));
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (kbinput == KEY_WINCH) {
|
||||
refresh_func();
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
continue;
|
||||
}
|
||||
if (kbinput == KEY_WINCH) {
|
||||
refresh_func();
|
||||
update_the_statusbar();
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
func = func_from_key(&kbinput);
|
||||
|
||||
if (func == do_cancel || func == do_enter)
|
||||
@@ -834,7 +647,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
answer = input_tab(answer, allow_files, &statusbar_x,
|
||||
&tabbed, refresh_func, list);
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_the_statusbar();
|
||||
} else
|
||||
#endif /* !DISABLE_TABCOMP */
|
||||
#ifndef DISABLE_HISTORIES
|
||||
@@ -852,7 +665,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
statusbar_x = strlen(answer);
|
||||
}
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_the_statusbar();
|
||||
|
||||
/* This key has a shortcut-list entry when it's used to
|
||||
* move to an older search, which means that finished has
|
||||
@@ -873,12 +686,12 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
* history list, answer is blank, and magichistory is set,
|
||||
* save magichistory in answer. */
|
||||
if ((*history_list)->next == NULL &&
|
||||
*answer == '\0' && magichistory != NULL) {
|
||||
answer = mallocstrcpy(answer, magichistory);
|
||||
statusbar_x = strlen(answer);
|
||||
}
|
||||
*answer == '\0' && magichistory != NULL) {
|
||||
answer = mallocstrcpy(answer, magichistory);
|
||||
statusbar_x = strlen(answer);
|
||||
}
|
||||
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_the_statusbar();
|
||||
|
||||
/* This key has a shortcut-list entry when it's used to
|
||||
* move to a newer search, which means that finished has
|
||||
@@ -889,7 +702,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
} else
|
||||
#endif /* !DISABLE_HISTORIES */
|
||||
if (func == do_help_void) {
|
||||
update_statusbar_line(answer, statusbar_x);
|
||||
update_the_statusbar();
|
||||
|
||||
/* This key has a shortcut-list entry when it's used to go to
|
||||
* the help browser or display a message indicating that help
|
||||
@@ -907,37 +720,23 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
#if !defined(DISABLE_HISTORIES) && !defined(DISABLE_TABCOMP)
|
||||
last_kbinput = kbinput;
|
||||
#endif
|
||||
|
||||
reset_statusbar_cursor();
|
||||
wnoutrefresh(bottomwin);
|
||||
}
|
||||
|
||||
#ifndef DISABLE_HISTORIES
|
||||
/* Set the current position in the history list to the bottom,
|
||||
* and free magichistory if we need to. */
|
||||
/* Set the current position in the history list to the bottom. */
|
||||
if (history_list != NULL) {
|
||||
history_reset(*history_list);
|
||||
|
||||
free(magichistory);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* We've finished putting in an answer or run a normal shortcut's
|
||||
* associated function, so reset statusbar_x and statusbar_pww. If
|
||||
* we've finished putting in an answer, reset the statusbar cursor
|
||||
* position too. */
|
||||
if (func) {
|
||||
if (func == do_cancel || func == do_enter || ran_func) {
|
||||
statusbar_x = old_statusbar_x;
|
||||
statusbar_pww = old_pww;
|
||||
|
||||
if (!ran_func)
|
||||
reset_statusbar_x = TRUE;
|
||||
/* Otherwise, we're still putting in an answer or a shortcut with
|
||||
* an associated function, so leave the statusbar cursor position
|
||||
* alone. */
|
||||
} else
|
||||
reset_statusbar_x = FALSE;
|
||||
/* If we're done with this prompt, restore the cursor position
|
||||
* to what it was at the /previous/ prompt, in case there was. */
|
||||
if (func == do_cancel || func == do_enter) {
|
||||
statusbar_x = old_statusbar_x;
|
||||
statusbar_pww = old_pww;
|
||||
}
|
||||
|
||||
*actual = kbinput;
|
||||
@@ -955,8 +754,7 @@ functionptrtype get_prompt_string(int *actual, bool allow_tabs,
|
||||
*
|
||||
* The allow_tabs parameter indicates whether we should allow tabs to be
|
||||
* interpreted. The allow_files parameter indicates whether we should
|
||||
* allow all files (as opposed to just directories) to be tab
|
||||
* completed. */
|
||||
* allow all files (as opposed to just directories) to be tab completed. */
|
||||
int do_prompt(bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool allow_files,
|
||||
@@ -974,10 +772,6 @@ int do_prompt(bool allow_tabs,
|
||||
bool list = FALSE;
|
||||
#endif
|
||||
|
||||
/* prompt has been freed and set to NULL unless the user resized
|
||||
* while at the statusbar prompt. */
|
||||
free(prompt);
|
||||
|
||||
prompt = charalloc(((COLS - 4) * mb_cur_max()) + 1);
|
||||
|
||||
bottombars(menu);
|
||||
@@ -1031,23 +825,12 @@ int do_prompt(bool allow_tabs,
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* This function forces a reset of the statusbar cursor position. It
|
||||
* should be called when we get out of all statusbar prompts. */
|
||||
void do_prompt_abort(void)
|
||||
{
|
||||
/* Uninitialize the old cursor position in answer. */
|
||||
old_statusbar_x = (size_t)-1;
|
||||
old_pww = (size_t)-1;
|
||||
|
||||
reset_statusbar_x = TRUE;
|
||||
}
|
||||
|
||||
/* Ask a simple Yes/No (and optionally All) question, specified in msg,
|
||||
* on the statusbar. Return 1 for Yes, 0 for No, 2 for All (if all is
|
||||
* TRUE when passed in), and -1 for Cancel. */
|
||||
int do_yesno_prompt(bool all, const char *msg)
|
||||
{
|
||||
int ok = -2, width = 16;
|
||||
int response = -2, width = 16;
|
||||
const char *yesstr; /* String of Yes characters accepted. */
|
||||
const char *nostr; /* Same for No. */
|
||||
const char *allstr; /* And All, surprise! */
|
||||
@@ -1127,52 +910,43 @@ int do_yesno_prompt(bool all, const char *msg)
|
||||
func = func_from_key(&kbinput);
|
||||
|
||||
if (func == do_cancel)
|
||||
ok = -1;
|
||||
response = -1;
|
||||
#ifndef DISABLE_MOUSE
|
||||
else if (kbinput == KEY_MOUSE) {
|
||||
/* We can click on the Yes/No/All shortcut list to
|
||||
* select an answer. */
|
||||
if (get_mouseinput(&mouse_x, &mouse_y, FALSE) == 0 &&
|
||||
wmouse_trafo(bottomwin, &mouse_y, &mouse_x,
|
||||
FALSE) && mouse_x < (width * 2) &&
|
||||
mouse_y > 0) {
|
||||
int x = mouse_x / width;
|
||||
/* Calculate the x-coordinate relative to the
|
||||
* two columns of the Yes/No/All shortcuts in
|
||||
* bottomwin. */
|
||||
int y = mouse_y - 1;
|
||||
/* Calculate the y-coordinate relative to the
|
||||
* beginning of the Yes/No/All shortcuts in
|
||||
* bottomwin, i.e. with the sizes of topwin,
|
||||
* edit, and the first line of bottomwin
|
||||
* subtracted out. */
|
||||
/* We can click on the Yes/No/All shortcuts to select an answer. */
|
||||
if (get_mouseinput(&mouse_x, &mouse_y, FALSE) == 0 &&
|
||||
wmouse_trafo(bottomwin, &mouse_y, &mouse_x, FALSE) &&
|
||||
mouse_x < (width * 2) && mouse_y > 0) {
|
||||
int x = mouse_x / width;
|
||||
/* The x-coordinate among the Yes/No/All shortcuts. */
|
||||
int y = mouse_y - 1;
|
||||
/* The y-coordinate among the Yes/No/All shortcuts. */
|
||||
|
||||
assert(0 <= x && x <= 1 && 0 <= y && y <= 1);
|
||||
assert(0 <= x && x <= 1 && 0 <= y && y <= 1);
|
||||
|
||||
/* x == 0 means they clicked Yes or No. y == 0
|
||||
* means Yes or All. */
|
||||
ok = -2 * x * y + x - y + 1;
|
||||
/* x == 0 means they clicked Yes or No.
|
||||
* y == 0 means Yes or All. */
|
||||
response = -2 * x * y + x - y + 1;
|
||||
|
||||
if (ok == 2 && !all)
|
||||
ok = -2;
|
||||
}
|
||||
if (response == 2 && !all)
|
||||
response = -2;
|
||||
}
|
||||
}
|
||||
#endif /* !DISABLE_MOUSE */
|
||||
else if (func == total_refresh) {
|
||||
total_redraw();
|
||||
continue;
|
||||
} else {
|
||||
/* Look for the kbinput in the Yes, No and (optionally)
|
||||
* All strings. */
|
||||
if (strchr(yesstr, kbinput) != NULL)
|
||||
ok = 1;
|
||||
else if (strchr(nostr, kbinput) != NULL)
|
||||
ok = 0;
|
||||
else if (all && strchr(allstr, kbinput) != NULL)
|
||||
ok = 2;
|
||||
/* Look for the kbinput in the Yes, No (and All) strings. */
|
||||
if (strchr(yesstr, kbinput) != NULL)
|
||||
response = 1;
|
||||
else if (strchr(nostr, kbinput) != NULL)
|
||||
response = 0;
|
||||
else if (all && strchr(allstr, kbinput) != NULL)
|
||||
response = 2;
|
||||
}
|
||||
} while (ok == -2);
|
||||
} while (response == -2);
|
||||
|
||||
currmenu = oldmenu;
|
||||
return ok;
|
||||
return response;
|
||||
}
|
||||
|
||||
16
src/proto.h
16
src/proto.h
@@ -128,7 +128,7 @@ extern filestruct *searchbot;
|
||||
extern filestruct *replace_history;
|
||||
extern filestruct *replaceage;
|
||||
extern filestruct *replacebot;
|
||||
extern poshiststruct *poshistory;
|
||||
extern poshiststruct *position_history;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
@@ -280,7 +280,7 @@ void do_cut_till_eof(void);
|
||||
#endif
|
||||
void do_uncut_text(void);
|
||||
|
||||
/* All functions in files.c. */
|
||||
/* Most functions in files.c. */
|
||||
void make_new_buffer(void);
|
||||
void initialize_buffer_text(void);
|
||||
bool open_buffer(const char *filename, bool undoable);
|
||||
@@ -527,15 +527,15 @@ void do_statusbar_backspace(void);
|
||||
void do_statusbar_delete(void);
|
||||
void do_statusbar_cut_text(void);
|
||||
#ifndef NANO_TINY
|
||||
bool do_statusbar_next_word(bool allow_punct);
|
||||
bool do_statusbar_prev_word(bool allow_punct);
|
||||
void do_statusbar_next_word(void);
|
||||
void do_statusbar_prev_word(void);
|
||||
#endif
|
||||
void do_statusbar_verbatim_input(bool *got_enter);
|
||||
size_t statusbar_xplustabs(void);
|
||||
size_t get_statusbar_page_start(size_t start_col, size_t column);
|
||||
void reset_statusbar_cursor(void);
|
||||
void update_statusbar_line(const char *curranswer, size_t index);
|
||||
bool need_statusbar_update(size_t pww_save);
|
||||
void update_the_statusbar(void);
|
||||
void update_bar_if_needed(void);
|
||||
void total_statusbar_refresh(void (*refresh_func)(void));
|
||||
functionptrtype get_prompt_string(int *value, bool allow_tabs,
|
||||
#ifndef DISABLE_TABCOMP
|
||||
@@ -748,7 +748,7 @@ void new_magicline(void);
|
||||
void remove_magicline(void);
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
void discard_until(undo *thisone);
|
||||
void discard_until(const undo *thisitem, openfilestruct *thefile);
|
||||
void add_undo(undo_type action);
|
||||
void update_undo(undo_type action);
|
||||
#endif
|
||||
@@ -822,8 +822,6 @@ void do_credits(void);
|
||||
|
||||
/* May as well throw these here, since they are just placeholders. */
|
||||
void do_cancel(void);
|
||||
void do_page_up(void);
|
||||
void do_page_down(void);
|
||||
void case_sens_void(void);
|
||||
void regexp_void(void);
|
||||
void gototext_void(void);
|
||||
|
||||
29
src/rcfile.c
29
src/rcfile.c
@@ -53,7 +53,6 @@ static const rcoption rcopts[] = {
|
||||
#ifndef DISABLE_MULTIBUFFER
|
||||
{"multibuffer", MULTIBUFFER},
|
||||
#endif
|
||||
{"nofollow", NOFOLLOW_SYMLINKS},
|
||||
{"nohelp", NO_HELP},
|
||||
{"nonewlines", NO_NEWLINES},
|
||||
#ifndef DISABLE_WRAPPING
|
||||
@@ -389,20 +388,6 @@ void parse_syntax(char *ptr)
|
||||
}
|
||||
#endif /* !DISABLE_COLOR */
|
||||
|
||||
int check_bad_binding(sc *s)
|
||||
{
|
||||
#define BADLISTLEN 1
|
||||
key_type badtypes[BADLISTLEN] = {META};
|
||||
int badseqs[BADLISTLEN] = { 91 };
|
||||
int i;
|
||||
|
||||
for (i = 0; i < BADLISTLEN; i++)
|
||||
if (s->type == badtypes[i] && s->seq == badseqs[i])
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Check whether the given executable function is "universal" (meaning
|
||||
* any horizontal movement or deletion) and thus is present in almost
|
||||
* all menus. */
|
||||
@@ -467,6 +452,9 @@ void parse_binding(char *ptr, bool dobind)
|
||||
else if (keycopy[0] != '^' && keycopy[0] != 'M' && keycopy[0] != 'F') {
|
||||
rcfile_error(N_("Key name must begin with \"^\", \"M\", or \"F\""));
|
||||
goto free_copy;
|
||||
} else if (keycopy[0] == '^' && (keycopy[1] < 64 || keycopy[1] > 127)) {
|
||||
rcfile_error(N_("Key name %s is invalid"), keycopy);
|
||||
goto free_copy;
|
||||
}
|
||||
|
||||
if (dobind) {
|
||||
@@ -539,16 +527,17 @@ void parse_binding(char *ptr, bool dobind)
|
||||
newsc->menus = menu;
|
||||
newsc->type = strtokeytype(newsc->keystr);
|
||||
assign_keyinfo(newsc);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "s->keystr = \"%s\"\n", newsc->keystr);
|
||||
fprintf(stderr, "s->seq = \"%d\"\n", newsc->seq);
|
||||
#endif
|
||||
|
||||
if (check_bad_binding(newsc)) {
|
||||
/* Do not allow rebinding the equivalent of the Escape key. */
|
||||
if (newsc->type == META && newsc->seq == 91) {
|
||||
rcfile_error(N_("Sorry, keystroke \"%s\" may not be rebound"), newsc->keystr);
|
||||
free(newsc);
|
||||
goto free_copy;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "s->keystr = \"%s\"\n", newsc->keystr);
|
||||
fprintf(stderr, "s->seq = \"%d\"\n", newsc->seq);
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Now find and delete any existing same shortcut in the menu(s). */
|
||||
|
||||
28
src/search.c
28
src/search.c
@@ -463,10 +463,9 @@ void do_search(void)
|
||||
|
||||
/* If we found something, and we're back at the exact same spot where
|
||||
* we started searching, then this is the only occurrence. */
|
||||
if (fileptr == openfile->current && fileptr_x ==
|
||||
openfile->current_x && didfind) {
|
||||
statusbar(_("This is the only occurrence"));
|
||||
}
|
||||
if (didfind && fileptr == openfile->current &&
|
||||
fileptr_x == openfile->current_x)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
edit_redraw(fileptr, pww_save);
|
||||
@@ -516,7 +515,9 @@ void do_research(void)
|
||||
last_search = mallocstrcpy(last_search, searchbot->prev->data);
|
||||
#endif
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
if (last_search[0] == '\0')
|
||||
statusbar(_("No current search pattern"));
|
||||
else {
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Since answer is "", use last_search! */
|
||||
if (ISSET(USE_REGEXP) && !regexp_init(last_search))
|
||||
@@ -532,12 +533,10 @@ void do_research(void)
|
||||
|
||||
/* If we found something, and we're back at the exact same spot
|
||||
* where we started searching, then this is the only occurrence. */
|
||||
if (fileptr == openfile->current && fileptr_x ==
|
||||
openfile->current_x && didfind) {
|
||||
statusbar(_("This is the only occurrence"));
|
||||
}
|
||||
} else
|
||||
statusbar(_("No current search pattern"));
|
||||
if (didfind && fileptr == openfile->current &&
|
||||
fileptr_x == openfile->current_x && didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
}
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
edit_redraw(fileptr, pww_save);
|
||||
@@ -805,8 +804,7 @@ ssize_t do_replace_loop(
|
||||
#ifndef DISABLE_COLOR
|
||||
/* If color syntaxes are available and turned on, we
|
||||
* need to call edit_refresh(). */
|
||||
if (openfile->colorstrings != NULL &&
|
||||
!ISSET(NO_COLOR_SYNTAX))
|
||||
if (openfile->colorstrings != NULL && !ISSET(NO_COLOR_SYNTAX))
|
||||
edit_refresh();
|
||||
else
|
||||
#endif
|
||||
@@ -1004,8 +1002,8 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
column = openfile->placewewant + 1;
|
||||
}
|
||||
|
||||
for (openfile->current = openfile->fileage;
|
||||
openfile->current != openfile->filebot && line > 1; line--)
|
||||
for (openfile->current = openfile->fileage; line > 1 &&
|
||||
openfile->current != openfile->filebot; line--)
|
||||
openfile->current = openfile->current->next;
|
||||
|
||||
openfile->current_x = actual_x(openfile->current->data, column - 1);
|
||||
|
||||
102
src/text.c
102
src/text.c
@@ -391,7 +391,7 @@ void do_indent(ssize_t cols)
|
||||
if (indent_changed) {
|
||||
/* Throw away the undo stack, to prevent making mistakes when
|
||||
* the user tries to undo something in the reindented text. */
|
||||
discard_until(NULL);
|
||||
discard_until(NULL, openfile);
|
||||
openfile->current_undo = NULL;
|
||||
|
||||
/* Mark the file as modified. */
|
||||
@@ -491,6 +491,8 @@ void do_undo(void)
|
||||
openfile->current_x = u->begin;
|
||||
switch (u->type) {
|
||||
case ADD:
|
||||
/* TRANSLATORS: Eight of the next nine strings describe actions
|
||||
* that are undone or redone. It are all nouns, not verbs. */
|
||||
undidmsg = _("text add");
|
||||
data = charalloc(strlen(f->data) - strlen(u->strdata) + 1);
|
||||
strncpy(data, f->data, u->begin);
|
||||
@@ -893,19 +895,22 @@ bool execute_command(const char *command)
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Discard undo items that are newer than thisone, or all if NULL. */
|
||||
void discard_until(undo *thisone)
|
||||
/* Discard undo items that are newer than the given one, or all if NULL. */
|
||||
void discard_until(const undo *thisitem, openfilestruct *thefile)
|
||||
{
|
||||
undo *dropit = openfile->undotop;
|
||||
undo *dropit = thefile->undotop;
|
||||
|
||||
while (dropit != NULL && dropit != thisone) {
|
||||
openfile->undotop = dropit->next;
|
||||
while (dropit != NULL && dropit != thisitem) {
|
||||
thefile->undotop = dropit->next;
|
||||
free(dropit->strdata);
|
||||
if (dropit->cutbuffer != NULL)
|
||||
free_filestruct(dropit->cutbuffer);
|
||||
free(dropit);
|
||||
dropit = openfile->undotop;
|
||||
dropit = thefile->undotop;
|
||||
}
|
||||
|
||||
/* Prevent a chain of editing actions from continuing. */
|
||||
thefile->last_action = OTHER;
|
||||
}
|
||||
|
||||
/* Add a new undo struct to the top of the current pile. */
|
||||
@@ -922,7 +927,7 @@ void add_undo(undo_type action)
|
||||
return;
|
||||
|
||||
/* Blow away newer undo items if we add somewhere in the middle. */
|
||||
discard_until(u);
|
||||
discard_until(u, openfile);
|
||||
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, " >> Adding an undo...\n");
|
||||
@@ -2298,7 +2303,7 @@ void do_justify(bool full_justify)
|
||||
#ifndef NANO_TINY
|
||||
/* Throw away the entire undo stack, to prevent a crash when
|
||||
* the user tries to undo something in the justified text. */
|
||||
discard_until(NULL);
|
||||
discard_until(NULL, openfile);
|
||||
openfile->current_undo = NULL;
|
||||
#endif
|
||||
/* Blow away the text in the justify buffer. */
|
||||
@@ -2753,9 +2758,6 @@ const char *do_alt_speller(char *tempfile_name)
|
||||
/* Restore the terminal to its previous state. */
|
||||
terminal_init();
|
||||
|
||||
/* Turn the cursor back on for sure. */
|
||||
curs_set(1);
|
||||
|
||||
if (!WIFEXITED(alt_spell_status) || WEXITSTATUS(alt_spell_status) != 0) {
|
||||
#ifndef NANO_TINY
|
||||
/* Turn the mark back on if it was on before. */
|
||||
@@ -2872,7 +2874,6 @@ void do_spell(void)
|
||||
|
||||
blank_bottombars();
|
||||
statusbar(_("Invoking spell checker, please wait"));
|
||||
doupdate();
|
||||
|
||||
spell_msg = (alt_speller != NULL) ? do_alt_speller(temp) :
|
||||
do_int_speller(temp);
|
||||
@@ -2905,13 +2906,11 @@ void do_linter(void)
|
||||
char *read_buff, *read_buff_ptr, *read_buff_word, *ptr;
|
||||
size_t pipe_buff_size, read_buff_size, read_buff_read, bytesread;
|
||||
size_t parsesuccess = 0;
|
||||
int lint_fd[2];
|
||||
int lint_status, lint_fd[2];
|
||||
pid_t pid_lint;
|
||||
int lint_status;
|
||||
static int arglen = 3;
|
||||
static char **lintargs = NULL;
|
||||
char *lintcopy;
|
||||
char *convendptr = NULL;
|
||||
char *lintcopy, *convendptr = NULL;
|
||||
lintstruct *lints = NULL, *tmplint = NULL, *curlint = NULL;
|
||||
|
||||
if (ISSET(RESTRICTED)) {
|
||||
@@ -2926,17 +2925,16 @@ void do_linter(void)
|
||||
|
||||
if (openfile->modified) {
|
||||
int i = do_yesno_prompt(FALSE, _("Save modified buffer before linting?"));
|
||||
|
||||
if (i == -1) {
|
||||
statusbar(_("Cancelled"));
|
||||
goto exit_from_lint;
|
||||
} else if (i == 1) {
|
||||
if (do_writeout(FALSE) != TRUE)
|
||||
goto exit_from_lint;
|
||||
}
|
||||
} else if (i == 1 && (do_writeout(FALSE) != TRUE))
|
||||
goto exit_from_lint;
|
||||
}
|
||||
|
||||
lintcopy = mallocstrcpy(NULL, openfile->syntax->linter);
|
||||
/* Create pipe up front. */
|
||||
/* Create a pipe up front. */
|
||||
if (pipe(lint_fd) == -1) {
|
||||
statusbar(_("Could not create pipe"));
|
||||
goto exit_from_lint;
|
||||
@@ -2944,7 +2942,6 @@ void do_linter(void)
|
||||
|
||||
blank_bottombars();
|
||||
statusbar(_("Invoking linter, please wait"));
|
||||
doupdate();
|
||||
|
||||
/* Set up an argument list to pass to execvp(). */
|
||||
if (lintargs == NULL) {
|
||||
@@ -2953,18 +2950,17 @@ void do_linter(void)
|
||||
lintargs[0] = strtok(lintcopy, " ");
|
||||
while ((ptr = strtok(NULL, " ")) != NULL) {
|
||||
arglen++;
|
||||
lintargs = (char **)nrealloc(lintargs, arglen *
|
||||
sizeof(char *));
|
||||
lintargs = (char **)nrealloc(lintargs, arglen * sizeof(char *));
|
||||
lintargs[arglen - 3] = ptr;
|
||||
}
|
||||
lintargs[arglen - 1] = NULL;
|
||||
}
|
||||
lintargs[arglen - 2] = openfile->filename;
|
||||
|
||||
/* A new process to run the linter in. */
|
||||
/* Start a new process to run the linter in. */
|
||||
if ((pid_lint = fork()) == 0) {
|
||||
|
||||
/* Child continues (i.e. future linting process). */
|
||||
/* Child continues here (i.e. the future linting process). */
|
||||
close(lint_fd[0]);
|
||||
|
||||
/* Send the linter's standard output + err to the pipe. */
|
||||
@@ -2985,7 +2981,7 @@ void do_linter(void)
|
||||
/* Parent continues here. */
|
||||
close(lint_fd[1]);
|
||||
|
||||
/* The child process was not forked successfully. */
|
||||
/* If the child process was not forked successfully... */
|
||||
if (pid_lint < 0) {
|
||||
close(lint_fd[0]);
|
||||
statusbar(_("Could not fork"));
|
||||
@@ -3011,8 +3007,7 @@ void do_linter(void)
|
||||
#endif
|
||||
read_buff_read += bytesread;
|
||||
read_buff_size += pipe_buff_size;
|
||||
read_buff = read_buff_ptr = charealloc(read_buff,
|
||||
read_buff_size);
|
||||
read_buff = read_buff_ptr = charealloc(read_buff, read_buff_size);
|
||||
read_buff_ptr += read_buff_read;
|
||||
}
|
||||
|
||||
@@ -3023,7 +3018,7 @@ void do_linter(void)
|
||||
fprintf(stderr, "text.c:do_lint:Raw output: %s\n", read_buff);
|
||||
#endif
|
||||
|
||||
/* Process the output. */
|
||||
/* Process the linter output. */
|
||||
read_buff_word = read_buff_ptr = read_buff;
|
||||
|
||||
while (*read_buff_ptr != '\0') {
|
||||
@@ -3109,6 +3104,7 @@ void do_linter(void)
|
||||
bottombars(MLINTER);
|
||||
tmplint = NULL;
|
||||
curlint = lints;
|
||||
|
||||
while (TRUE) {
|
||||
ssize_t tmpcol = 1;
|
||||
int kbinput;
|
||||
@@ -3121,7 +3117,7 @@ void do_linter(void)
|
||||
#ifndef NANO_TINY
|
||||
struct stat lintfileinfo;
|
||||
|
||||
new_lint_loop:
|
||||
new_lint_loop:
|
||||
if (stat(curlint->filename, &lintfileinfo) != -1) {
|
||||
if (openfile->current_stat->st_ino != lintfileinfo.st_ino) {
|
||||
openfilestruct *tmpof = openfile;
|
||||
@@ -3173,7 +3169,6 @@ void do_linter(void)
|
||||
if (kbinput == KEY_WINCH)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
func = func_from_key(&kbinput);
|
||||
tmplint = curlint;
|
||||
|
||||
@@ -3194,15 +3189,20 @@ void do_linter(void)
|
||||
statusbar(_("At first message"));
|
||||
}
|
||||
}
|
||||
|
||||
blank_statusbar();
|
||||
|
||||
#ifndef NANO_TINY
|
||||
free_lints_and_return:
|
||||
#endif
|
||||
for (tmplint = lints; tmplint != NULL; tmplint = tmplint->next) {
|
||||
for (curlint = lints; curlint != NULL;) {
|
||||
tmplint = curlint;
|
||||
curlint = curlint->next;
|
||||
free(tmplint->msg);
|
||||
free(tmplint->filename);
|
||||
free(tmplint);
|
||||
}
|
||||
|
||||
exit_from_lint:
|
||||
display_main_list();
|
||||
}
|
||||
@@ -3215,17 +3215,15 @@ void do_formatter(void)
|
||||
{
|
||||
bool status;
|
||||
FILE *temp_file;
|
||||
char *temp;
|
||||
int format_status;
|
||||
ssize_t lineno_save = openfile->current->lineno;
|
||||
ssize_t current_y_save = openfile->current_y;
|
||||
size_t current_x_save = openfile->current_x;
|
||||
size_t pww_save = openfile->placewewant;
|
||||
ssize_t current_y_save = openfile->current_y;
|
||||
ssize_t lineno_save = openfile->current->lineno;
|
||||
pid_t pid_format;
|
||||
char *ptr;
|
||||
static int arglen = 3;
|
||||
static char **formatargs = NULL;
|
||||
char *finalstatus = NULL;
|
||||
char *temp, *ptr, *finalstatus = NULL;
|
||||
|
||||
if (openfile->totsize == 0) {
|
||||
statusbar(_("Finished"));
|
||||
@@ -3251,9 +3249,6 @@ void do_formatter(void)
|
||||
|
||||
blank_bottombars();
|
||||
statusbar(_("Invoking formatter, please wait"));
|
||||
doupdate();
|
||||
|
||||
endwin();
|
||||
|
||||
/* Set up an argument list to pass to execvp(). */
|
||||
if (formatargs == NULL) {
|
||||
@@ -3262,8 +3257,7 @@ void do_formatter(void)
|
||||
formatargs[0] = strtok(openfile->syntax->formatter, " ");
|
||||
while ((ptr = strtok(NULL, " ")) != NULL) {
|
||||
arglen++;
|
||||
formatargs = (char **)nrealloc(formatargs, arglen *
|
||||
sizeof(char *));
|
||||
formatargs = (char **)nrealloc(formatargs, arglen * sizeof(char *));
|
||||
formatargs[arglen - 3] = ptr;
|
||||
}
|
||||
formatargs[arglen - 1] = NULL;
|
||||
@@ -3295,15 +3289,6 @@ void do_formatter(void)
|
||||
/* Wait for the formatter to finish. */
|
||||
wait(&format_status);
|
||||
|
||||
/* Reenter curses mode. */
|
||||
doupdate();
|
||||
|
||||
/* Restore the terminal to its previous state. */
|
||||
terminal_init();
|
||||
|
||||
/* Turn the cursor back on for sure. */
|
||||
curs_set(1);
|
||||
|
||||
if (!WIFEXITED(format_status) || WEXITSTATUS(format_status) != 0)
|
||||
finalstatus = invocation_error(openfile->syntax->formatter);
|
||||
else {
|
||||
@@ -3329,11 +3314,14 @@ void do_formatter(void)
|
||||
allow_sigwinch(TRUE);
|
||||
#endif
|
||||
|
||||
/* If the formatter printed any error messages onscreen, make
|
||||
* sure that they're cleared off. */
|
||||
total_refresh();
|
||||
|
||||
statusbar(finalstatus);
|
||||
|
||||
/* If there were error messages, allow the user some time to read them. */
|
||||
if (WIFEXITED(format_status) && WEXITSTATUS(format_status) == 2)
|
||||
sleep(4);
|
||||
|
||||
/* If there were any messages, clear them off. */
|
||||
total_refresh();
|
||||
}
|
||||
#endif /* !DISABLE_SPELLER */
|
||||
#endif /* !DISABLE_COLOR */
|
||||
|
||||
@@ -37,7 +37,9 @@ void get_homedir(void)
|
||||
if (homedir == NULL) {
|
||||
const char *homenv = getenv("HOME");
|
||||
|
||||
if (homenv == NULL) {
|
||||
/* When HOME isn't set, or when we're root, get the home directory
|
||||
* from the password file instead. */
|
||||
if (homenv == NULL || geteuid() == 0) {
|
||||
const struct passwd *userage = getpwuid(geteuid());
|
||||
|
||||
if (userage != NULL)
|
||||
|
||||
130
src/winio.c
130
src/winio.c
@@ -311,6 +311,9 @@ int get_kbinput(WINDOW *win)
|
||||
{
|
||||
int kbinput;
|
||||
|
||||
/* Turn the cursor on when waiting for input. */
|
||||
curs_set(1);
|
||||
|
||||
/* Read in a character and interpret it. Continue doing this until
|
||||
* we get a recognized value or sequence. */
|
||||
while ((kbinput = parse_kbinput(win)) == ERR)
|
||||
@@ -2093,29 +2096,6 @@ void titlebar(const char *path)
|
||||
wnoutrefresh(edit);
|
||||
}
|
||||
|
||||
/* Mark the current file as modified if it isn't already, and then
|
||||
* update the titlebar to display the file's new status. */
|
||||
void set_modified(void)
|
||||
{
|
||||
if (!openfile->modified) {
|
||||
openfile->modified = TRUE;
|
||||
titlebar(NULL);
|
||||
#ifndef NANO_TINY
|
||||
if (ISSET(LOCKING)) {
|
||||
if (openfile->filename[0] == '\0')
|
||||
return;
|
||||
else if (openfile->lock_filename == NULL) {
|
||||
/* TRANSLATORS: Try to keep this at most 76 characters. */
|
||||
statusbar(_("Warning: Modifying a file which is not locked, check directory permission?"));
|
||||
} else {
|
||||
write_lockfile(openfile->lock_filename,
|
||||
get_full_path(openfile->filename), TRUE);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/* Display a message on the statusbar, and set disable_cursorpos to
|
||||
* TRUE, so that the message won't be immediately overwritten if
|
||||
* constant cursor position display is on. */
|
||||
@@ -2140,6 +2120,9 @@ void statusbar(const char *msg, ...)
|
||||
return;
|
||||
}
|
||||
|
||||
/* Turn the cursor off while fiddling in the statusbar. */
|
||||
curs_set(0);
|
||||
|
||||
blank_statusbar();
|
||||
|
||||
bar = charalloc(mb_cur_max() * (COLS - 3));
|
||||
@@ -2172,6 +2155,9 @@ void statusbar(const char *msg, ...)
|
||||
|
||||
disable_cursorpos = TRUE;
|
||||
|
||||
/* Push the message to the screen straightaway. */
|
||||
doupdate();
|
||||
|
||||
/* If we're doing quick statusbar blanking, and constant cursor
|
||||
* position display is off, blank the statusbar after only one
|
||||
* keystroke. Otherwise, blank it after twenty-six keystrokes, as
|
||||
@@ -2823,8 +2809,7 @@ bool need_screen_update(size_t pww_save)
|
||||
#ifndef NANO_TINY
|
||||
openfile->mark_set ||
|
||||
#endif
|
||||
get_page_start(pww_save) !=
|
||||
get_page_start(openfile->placewewant);
|
||||
get_page_start(pww_save) != get_page_start(openfile->placewewant);
|
||||
}
|
||||
|
||||
/* When edittop changes, try and figure out how many lines
|
||||
@@ -2971,95 +2956,30 @@ void edit_scroll(scroll_dir direction, ssize_t nlines)
|
||||
* updated. Use this if we've moved without changing any text. */
|
||||
void edit_redraw(filestruct *old_current, size_t pww_save)
|
||||
{
|
||||
filestruct *foo = NULL;
|
||||
bool do_redraw = need_screen_update(0) || need_screen_update(pww_save);
|
||||
|
||||
/* If either old_current or current is offscreen, scroll the edit
|
||||
* window until it's onscreen and get out. */
|
||||
if (old_current->lineno < openfile->edittop->lineno ||
|
||||
old_current->lineno >= openfile->edittop->lineno +
|
||||
maxrows || openfile->current->lineno <
|
||||
openfile->edittop->lineno || openfile->current->lineno >=
|
||||
openfile->edittop->lineno + maxrows) {
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "edit_redraw(): line %ld was offscreen, oldcurrent = %ld edittop = %ld",
|
||||
(long)openfile->current->lineno, (long)old_current->lineno, (long)openfile->edittop->lineno);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If the mark is on, update all the lines between old_current
|
||||
* and either the old first line or old last line (depending on
|
||||
* whether we've scrolled up or down) of the edit window. */
|
||||
if (openfile->mark_set) {
|
||||
ssize_t old_lineno;
|
||||
filestruct *old_edittop = openfile->edittop;
|
||||
|
||||
if (old_edittop->lineno < openfile->edittop->lineno)
|
||||
old_lineno = old_edittop->lineno;
|
||||
else
|
||||
old_lineno = (old_edittop->lineno + maxrows <=
|
||||
openfile->filebot->lineno) ?
|
||||
old_edittop->lineno + editwinrows :
|
||||
openfile->filebot->lineno;
|
||||
|
||||
foo = old_current;
|
||||
|
||||
while (foo->lineno != old_lineno) {
|
||||
update_line(foo, 0);
|
||||
|
||||
foo = (foo->lineno > old_lineno) ? foo->prev :
|
||||
foo->next;
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
/* Make sure the current line is on the screen. */
|
||||
/* If the current line is offscreen, scroll until it's onscreen. */
|
||||
if (openfile->current->lineno >= openfile->edittop->lineno + maxrows ||
|
||||
openfile->current->lineno < openfile->edittop->lineno)
|
||||
edit_update((ISSET(SMOOTH_SCROLL) && !focusing) ? NONE : CENTER);
|
||||
|
||||
/* Update old_current if we're not on the same page as
|
||||
* before. */
|
||||
if (do_redraw)
|
||||
update_line(old_current, 0);
|
||||
|
||||
#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
|
||||
* whether we've scrolled up or down) and current. */
|
||||
if (openfile->mark_set) {
|
||||
while (foo->lineno != openfile->current->lineno) {
|
||||
update_line(foo, 0);
|
||||
/* If the mark is on, update all lines between old_current and current. */
|
||||
if (openfile->mark_set) {
|
||||
filestruct *foo = old_current;
|
||||
|
||||
foo = (foo->lineno > openfile->current->lineno) ?
|
||||
foo->prev : foo->next;
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Update old_current and current if we're not on the same page as
|
||||
* before. If the mark is on, update all the lines between
|
||||
* old_current and current too. */
|
||||
foo = old_current;
|
||||
|
||||
while (foo != openfile->current) {
|
||||
if (do_redraw)
|
||||
while (foo != openfile->current) {
|
||||
update_line(foo, 0);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
if (!openfile->mark_set)
|
||||
#endif
|
||||
break;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
foo = (foo->lineno > openfile->current->lineno) ? foo->prev :
|
||||
foo->next;
|
||||
#endif
|
||||
foo = (foo->lineno > openfile->current->lineno) ?
|
||||
foo->prev : foo->next;
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
if (do_redraw)
|
||||
/* Update old_current and current if we've changed page. */
|
||||
if (need_screen_update(0) || need_screen_update(pww_save)) {
|
||||
update_line(old_current, 0);
|
||||
update_line(openfile->current, openfile->current_x);
|
||||
}
|
||||
}
|
||||
|
||||
/* Refresh the screen without changing the position of lines. Use this
|
||||
|
||||
Reference in New Issue
Block a user