Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b7166d5c06 | ||
|
|
1e8f6fd7a9 | ||
|
|
0b93fff802 | ||
|
|
1c74517629 | ||
|
|
9f696ef9af | ||
|
|
5aa12a2b3d | ||
|
|
2439e1e451 | ||
|
|
dab70d06ed | ||
|
|
8993c36366 | ||
|
|
5c51d4ea46 | ||
|
|
02376103eb | ||
|
|
999d99c6e4 | ||
|
|
6e73805a0d | ||
|
|
754c62c5cc | ||
|
|
9f2c80db24 | ||
|
|
4c987bc3e0 | ||
|
|
e75c933cb0 | ||
|
|
28767d8fec | ||
|
|
bf00e3f606 | ||
|
|
23ae7bfbbf | ||
|
|
cb0806b2a0 | ||
|
|
005ee8eda6 | ||
|
|
f3e2ad945d | ||
|
|
6ec65d5500 | ||
|
|
de0adb8e3e | ||
|
|
cc91ee603c | ||
|
|
c84324bc7a | ||
|
|
8fc72eb32b | ||
|
|
6b5aff4878 | ||
|
|
fb534bada6 | ||
|
|
b5bc1b5094 | ||
|
|
aedc3ddd49 | ||
|
|
754aa8ba79 | ||
|
|
53cea142e0 | ||
|
|
7e18100197 | ||
|
|
0abf225129 | ||
|
|
70bcf752dc | ||
|
|
8f2b5bbf3d | ||
|
|
f9a8d6ff4e | ||
|
|
c3830517cc | ||
|
|
6d70ab11d6 | ||
|
|
5f359179b2 |
53
ChangeLog
53
ChangeLog
@@ -1,3 +1,56 @@
|
||||
Changes between v2.8.0 and v2.8.1:
|
||||
----------------------------------
|
||||
|
||||
Benno Schulenberg (33):
|
||||
bindings: make ^Home and ^End go to top and tail of buffer
|
||||
bindings: make ^Up/^Down go to first/last row in the file browser
|
||||
bindings: use arrows instead of words to designate the cursor keys
|
||||
bump version numbers and add a news item for the 2.8.1 release
|
||||
copyright: update the year in --version, and use the standard hyphen
|
||||
copyright: update the years, use ranges, and explain this usage
|
||||
display: check the correct character for being double-width
|
||||
display: with softwrap, show the cursor where the eye expects it
|
||||
docs: correct an answer to a question in the FAQ
|
||||
docs: mention another difference with Pico in the Info document
|
||||
docs: remove the self-referencing stuff and the changelog from the FAQ
|
||||
docs: trim the TODO file a bit, and put the more important items first
|
||||
editing: avoid creating blank lines when using autoindent
|
||||
files: check also for write errors when prepending, not just read errors
|
||||
gnulib: update to current state
|
||||
linting: treat a tab as one "column", not eight
|
||||
linting: when no is said to a file, remove all corresponding entries
|
||||
moving: when determining where we are on the screen, use placewewant
|
||||
tweaks: adjust a couple of comments
|
||||
tweaks: again use memory on the stack instead of malloc() and free()
|
||||
tweaks: close the backup file also when we skip making a backup
|
||||
tweaks: delete a function that hasn't been used since 2005
|
||||
tweaks: delete unnecessary function prototypes
|
||||
tweaks: elide a variable and a pair of braces
|
||||
tweaks: fix some inconsistencies in an old Changelog
|
||||
tweaks: fix two typos in the NEWS file
|
||||
tweaks: group ^D and ^H together in the help lines
|
||||
tweaks: keep the help text aligned, also with the narrow arrows
|
||||
tweaks: put M-A before ^6, to look better above M-6 in the help lines
|
||||
tweaks: put unshifted shortcuts ^6 and M-6 first, instead of ^^ and M-^
|
||||
tweaks: reduce the number of additions that actual_x() performs
|
||||
tweaks: replace a function call or a macro with a hard number
|
||||
tweaks: use memory on the stack instead of calling malloc() and free()
|
||||
|
||||
David Lawrence Ramsey (5):
|
||||
bindings: use arrows instead of words for search history too
|
||||
display: show '<' and '>' placeholders for characters that get split
|
||||
input: support escape sequences for ^Home and ^End
|
||||
scrolling: properly compensate for the onscreen chunks
|
||||
tweaks: avoid a compilation warning
|
||||
|
||||
Kamil Dudka (1):
|
||||
backup: prevent a symlink attack by operating on the file descriptor
|
||||
|
||||
Mike Frysinger (2):
|
||||
configure: fix up word boundary regex logic now that we have gnulib
|
||||
configure: ignore the REG_ENHANCED test when we use gnulib
|
||||
|
||||
|
||||
Changes between v2.7.5 and v2.8.0:
|
||||
----------------------------------
|
||||
|
||||
|
||||
@@ -5975,7 +5975,7 @@ GNU nano 1.1.8 - 2002.03.30
|
||||
do_insertfile()
|
||||
- Handle cancel from ExtCmd properly. (David Benbennick)
|
||||
read_file()
|
||||
- Abort if we read a file of 0 lines (num_lines == 0), fixes BUG #70.
|
||||
- Abort if we read a file of 0 lines (num_lines == 0). Fixes bug #70.
|
||||
- Reverse tests to stop segfault on editing a new file of 0 lines.
|
||||
(David Benbennick)
|
||||
- Change input var to one char instead of array. (David Benbennick)
|
||||
@@ -6108,8 +6108,8 @@ GNU nano 1.1.7 - 2002.03.05
|
||||
- Added Noconvert option to man page. (DLR)
|
||||
- nano.c:
|
||||
justify_format(), do_justify()
|
||||
- Various fixes for starting blank spaces, spaces after
|
||||
punctuation, & segfault with quoting strings. (David Benbennick)
|
||||
- Various fixes for starting blank spaces, spaces after
|
||||
punctuation, & segfault with quoting strings. (David Benbennick)
|
||||
do_justify()
|
||||
- Don't continue to justify string if it's indented more
|
||||
(quoting wise) than the beginning of the justification.
|
||||
@@ -6139,8 +6139,8 @@ GNU nano 1.1.7 - 2002.03.05
|
||||
- NANO_SMALL test was backwards. (Ken Tyler)
|
||||
- winio.c:
|
||||
strlenpt()
|
||||
- Changed main function to strnlenpt() for new justify changes,
|
||||
original function now just a stub.
|
||||
- Changed main function to strnlenpt() for new justify changes,
|
||||
original function now just a stub.
|
||||
- nanorc.sample
|
||||
- Mention unset in the sample nanorc.
|
||||
- po/ca.po, po/es.po:
|
||||
@@ -6208,7 +6208,7 @@ nano-1.1.6 - 2002.01.25
|
||||
- Temporarily unset REVERSE_SEARCH if it's set. (Rocco Corsi)
|
||||
do_suspend()
|
||||
- Call tcsetattr() to restore the old terminal settings, so
|
||||
tcsh can use ^C after suspend for example (fixes BUG #68).
|
||||
tcsh can use ^C after suspend for example. Fixes bug #68.
|
||||
do_wrap()
|
||||
- Move "right" increment to part where new line is created,
|
||||
should change (fix?) some wrapping problems with autoindent.
|
||||
@@ -6368,10 +6368,10 @@ nano-1.1.4 - 2001.12.11
|
||||
- nano.c:
|
||||
main()
|
||||
- Add Esc-[-[IGL] keys for FreeBSD Console (PgUp,PgDn,Insert).
|
||||
- Added better Hurd support for function keys (Alt-V,U,9,@,F).
|
||||
- Added better Hurd support for function keys (Alt-V,U,9,@,F).
|
||||
signal_init()
|
||||
- do SIG_IGN for the SIGTSTP sigaction regardless of whether
|
||||
we have _POSIX_VDISABLE or not (more Hurd fixes)
|
||||
- do SIG_IGN for the SIGTSTP sigaction regardless of whether
|
||||
we have _POSIX_VDISABLE or not (more Hurd fixes)
|
||||
help_init()
|
||||
- Typo fixes and additions to the new help texts.
|
||||
do_curpos()
|
||||
@@ -6487,10 +6487,10 @@ nano-1.1.2 - 2001.10.03
|
||||
- Take control-space out of -tiny build, unneeded.
|
||||
- cut.c:
|
||||
cut_marked_segment()
|
||||
- Add magic line when cutting a selection including filebot
|
||||
(discovered by DLR, fixed by DLR & Chris, fixes BUG #66).
|
||||
- Add magic line when cutting a selection including filebot.
|
||||
Fixes bug #66. (discovered by DLR, fixed by DLR & Chris)
|
||||
do_cut_text()
|
||||
- Don't recenter the line when cutting one line (DLR) (Bug #65).
|
||||
- Don't recenter the line when cutting one line. Fixes bug #65. (DLR)
|
||||
- faq.html:
|
||||
- Notes about the Free Translation Project.
|
||||
- Debian additions.
|
||||
@@ -6681,14 +6681,14 @@ nano-1.1.0 - 2001.07.15
|
||||
add_to_cutbuffer()
|
||||
- Remove useless statements. (Rocco)
|
||||
cut_marked_segment()
|
||||
- Add bizarre copy of bot node, else *BSD goes ballistic (fixes
|
||||
BUG #60).
|
||||
- Add bizarre copy of bot node, else *BSD goes ballistic. Fixes
|
||||
bug #60.
|
||||
- Added 'destructive' argument. Allows the selected text to be
|
||||
added to the cutbuffer without changing the contents of the
|
||||
file. This allows writing selection to separate files.
|
||||
do_cut_text()
|
||||
- If the line is empty when using -k and wasn't already added,
|
||||
create a dummy line and add it to the cutbuffer (fixes bug #61)
|
||||
create a dummy line and add it to the cutbuffer. Fixes bug #61.
|
||||
- Reset marked_cut if we blow away the cutbuffer.
|
||||
- Moved the case of current == mark_beginbuf into cut_marked
|
||||
segment, so do_writeout could call it when writing selection to
|
||||
@@ -6719,7 +6719,7 @@ nano-1.1.0 - 2001.07.15
|
||||
- move.c:
|
||||
page_up()
|
||||
- Rewritten with a loop to make screen updates work when
|
||||
mark is set (fixes bug #59).
|
||||
mark is set. Fixes bug #59.
|
||||
do_home(), do_end()
|
||||
- Don't keep cutbuffer.
|
||||
- nano.1:
|
||||
@@ -6756,7 +6756,7 @@ nano-1.1.0 - 2001.07.15
|
||||
- Optimizations, remove "$" goes-to-last-line, less messages. (Rocco)
|
||||
do_replace()
|
||||
- If we manage to make it in somehow with VIEW_MODE on, abort
|
||||
nicely (fixes BUG #59).
|
||||
nicely. Fixes bug #59.
|
||||
- utils.c
|
||||
strcasestr()
|
||||
- Replaced by mutt's mutt_stristr function, because the thought
|
||||
@@ -6844,13 +6844,13 @@ nano-1.0.0 - 2001.03.22
|
||||
- move.c:
|
||||
page_down()
|
||||
- Check for totlines < editwinrows in check for superfluous
|
||||
edit update (fixed BUG #57).
|
||||
edit update. Fixes bug #57.
|
||||
- search.c:
|
||||
print_replaced()
|
||||
- s/occurence/occurrence typos. (Jordi)
|
||||
search_init()
|
||||
- If using Pico mode and regex and same answer is entered, use
|
||||
last_search string instead of answer (fixes BUG #56).
|
||||
last_search string instead of answer. Fixes bug #56.
|
||||
- nano.texi:
|
||||
- Meta-Z correction and grammar in --enable-tiny desc. (Neil Parks)
|
||||
|
||||
@@ -6868,7 +6868,7 @@ nano-0.9.99pre3 - 2001.02.19
|
||||
- ALL_LINGUAS: added hu and ca.
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- marked text cut fixes (Rocco) (Fixes bug #54).
|
||||
- Marked text cut fixes. Fixes bug #54. (Rocco)
|
||||
- nano.c:
|
||||
do_delete()
|
||||
- Added check for current->next == fileptr, as we have a magic
|
||||
@@ -7016,7 +7016,7 @@ General -
|
||||
for now.
|
||||
- Moved keypad() calls for PDCurses from main() to window_init()
|
||||
so the keypad continues to work after a Meta-X, for example.
|
||||
Fixed bug #51.
|
||||
Fixes bug #51.
|
||||
- faq.html:
|
||||
- Fix typos and small mistakes. (Jordi)
|
||||
- files.c:
|
||||
@@ -7038,7 +7038,7 @@ General -
|
||||
- move.c:
|
||||
page_down()
|
||||
- Don't do an edit_update when there is only one page of text
|
||||
(fileage == edittop && filebot == editbot). Fixes Bug #50.
|
||||
(fileage == edittop && filebot == editbot). Fixes bug #50.
|
||||
- nano.c:
|
||||
main()
|
||||
- Reorder the getopt options to be more or less alphabetical
|
||||
@@ -7080,7 +7080,7 @@ General
|
||||
uncutting marked text at filebot. (Ryan Krebs)
|
||||
- files.c:
|
||||
read_file()
|
||||
- If we encounter an error and insert is not set, run new_file().
|
||||
- If we encounter an error and insert is not set, run new_file()
|
||||
(bug discovered by Ben Roberts).
|
||||
write_file()
|
||||
- Change open call flags, basically copy joe's way of doing it so
|
||||
@@ -7097,8 +7097,8 @@ General
|
||||
modify_control_key. Removed #ifdef _POSIX_VDISABLE check
|
||||
around Control-S,Q,Z handlers because we need it now for
|
||||
the Alt-Alt-x code.
|
||||
- Added --view option to getopt_long() call. Bug discovered
|
||||
by Rocco Corsi.
|
||||
- Added --view option to getopt_long() call (bug discovered by
|
||||
Rocco Corsi).
|
||||
help_init()
|
||||
- Fix off by one error that was making ^G help in normal mode and
|
||||
^_ in Pico mode not be displayed in the help (bug discovered by
|
||||
@@ -7292,7 +7292,7 @@ nano 0.9.20 - 2000.11.18
|
||||
- nano.c:
|
||||
keypad_on()
|
||||
- New function, toggles turning the keypad on and off in edit and
|
||||
bottomwin(). Added call to this in finish(), fixes bug #45.
|
||||
bottomwin(). Added call to this in finish(). Fixes bug #45.
|
||||
- search.c
|
||||
findnextstr()
|
||||
- New arg for begin_x variable, basically a rewrite that
|
||||
@@ -7359,7 +7359,7 @@ nano 0.9.18 - 2000.09.18
|
||||
- cut.c:
|
||||
do_cut_text()
|
||||
- Don't immediately abort if we're on filebot and the marker is
|
||||
set (fixes bug #42).
|
||||
set. Fixes bug #42.
|
||||
- files.c:
|
||||
open_file()
|
||||
- Fix for bug #44. (Rocco Corsi)
|
||||
@@ -7372,9 +7372,9 @@ nano 0.9.18 - 2000.09.18
|
||||
available, allows nano to work with cygwin.
|
||||
- Added gettext calls to enable/disable strings. (Jordi)
|
||||
- Revamped a great deal of the F-key and keypad key handling,
|
||||
because we not longer use keypad() (see below).
|
||||
because we no longer use keypad() (see below).
|
||||
- Removed keypad() call because nano was not working with the
|
||||
keypad in many terms, which is very bad.
|
||||
keypad on many terminals, which is very bad.
|
||||
- Made insert key call do_insertfile().
|
||||
do_toggle()
|
||||
- Rewrote function to allow NOHELP toggle to work on systems
|
||||
@@ -7450,7 +7450,7 @@ nano-0.9.17 - 2000.09.04
|
||||
findnextstr():
|
||||
- Added reset for placewewant. (Ben Roberts)
|
||||
- Fixed check for string that only occurs on the same line failing
|
||||
(discovered by Ken Tyler).
|
||||
(bug discovered by Ken Tyler).
|
||||
|
||||
nano-0.9.16 - 2000.08.09
|
||||
- cut.c:
|
||||
@@ -7481,7 +7481,7 @@ nano-0.9.15 - 2000.08.03
|
||||
with --with-slang or --without-slang
|
||||
- nano.c:
|
||||
splice_node()
|
||||
- New function, abstracts linking in nodes. Fixes bug #36.
|
||||
- New function, abstracts linking in nodes. Fixes bug #36.
|
||||
null_at()
|
||||
- New function, nulls a string at a given index and realigns it.
|
||||
delete_buffer()
|
||||
@@ -7555,7 +7555,7 @@ nano-0.9.13 - 2000.07.23
|
||||
- More intelligent emergency-save filename selection. (Rob)
|
||||
do_spell():
|
||||
- Changed exit semantics a bit so that aspell wouldn't get
|
||||
all screwy (bug discovered by Joshua Jensen.
|
||||
all screwy (bug discovered by Joshua Jensen).
|
||||
- files.c:
|
||||
read_file():
|
||||
- Added init of buf variable, hopefully this will stop the
|
||||
@@ -7606,8 +7606,8 @@ nano-0.9.12 - 2000.07.07
|
||||
- Magic Line code in read_file (Rob)
|
||||
- nano.c:
|
||||
- Removed dual alt_speller variables, oops! (Rocco Corsi)
|
||||
- Removed unnecessary do_oldspell function. (Rocco Corsi). Added
|
||||
SMALL_NANO #ifdef around actual spell function.
|
||||
- Removed unnecessary do_oldspell function. (Rocco Corsi)
|
||||
- Added SMALL_NANO #ifdef around actual spell function.
|
||||
- Moved page_up() to move.c where is belongs.
|
||||
- Corrected FIXME in do_enter with explanation. (Rob)
|
||||
- Fixed FIXME in do_justify, resulted in creation of
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
Improvements in GNU nano
|
||||
========================
|
||||
|
||||
Since 2.8.0:
|
||||
- Ctrl+Home and Ctrl+End jump to start and end of file.
|
||||
- In softwrap mode the cursor now moves per visual row instead of per
|
||||
logical line, and the screen will scroll per row.
|
||||
|
||||
Since 2.7.0:
|
||||
- The keystroke ^] to complete a fragment to an existing full word.
|
||||
- The ability to display line numbers in front of the text (M-#).
|
||||
|
||||
28
NEWS
28
NEWS
@@ -1,3 +1,17 @@
|
||||
2017.04.12 - GNU nano 2.8.1 "Ellert" fixes build failures on MacOS and
|
||||
on musl, fixes scrolling problems in softwrap mode when
|
||||
double-width characters on row boundaries are involved,
|
||||
shows double-width characters as ">" and "<" when split
|
||||
across two rows, moves the cursor more predictably (at
|
||||
the cost of sometimes putting it on the second "half"
|
||||
of a character), avoids creating lines that consist of
|
||||
only blanks when using autoindent, makes ^Home and ^End
|
||||
go to the start and end of the file (on terminals that
|
||||
support those keystrokes), places the cursor better when
|
||||
linting, lets the linter ask only once whether to open
|
||||
an included file, and adds bindings for ^Up and ^Down
|
||||
in the file browser. Don't sit on your hands.
|
||||
|
||||
2017.03.31 - GNU nano 2.8.0 "Axat" makes it easier to move around in
|
||||
softwrapped lines: the Up and Down keys now step from
|
||||
visual row to visual row instead of jumping between
|
||||
@@ -8,7 +22,7 @@
|
||||
of always per logical line. On an entirely different
|
||||
front: nano now makes use of gnulib, to make it build
|
||||
on more platforms. In short: there were many internal
|
||||
changes, not many user-visible ones (apart form the
|
||||
changes, not many user-visible ones (apart from the
|
||||
new softwrap navigation). The conversion to gnulib
|
||||
was done by Mike Frysinger, the softwrap overhaul by
|
||||
David Ramsey.
|
||||
@@ -51,8 +65,8 @@
|
||||
related to using line numbers in softwrap mode, allows to
|
||||
use the PageUp and PageDown keys together with Shift on
|
||||
VTE-based terminals, stops the help lines from flickering
|
||||
during interactive replacing, makes a "set fill" override
|
||||
an earlier "set nowrap", properly restores the selected
|
||||
during interactive replacing, makes a 'set fill' override
|
||||
an earlier 'set nowrap', properly restores the selected
|
||||
region after an external spell check, and improves a few
|
||||
other tidbits. If you should find any more bugs, please
|
||||
run 'man nano | grep bugs' and report them there.
|
||||
@@ -293,11 +307,11 @@
|
||||
has been added on top of the existing file extension
|
||||
and header support already available. Secondly, cursor
|
||||
position can be saved between editing sessions with
|
||||
the -P or --poslog command-line flag, or via "set poslog"
|
||||
the -P or --poslog command-line flag, or via 'set poslog'
|
||||
in your .nanorc. Also included are some fixes for
|
||||
compilation with g++, and better handling of issues
|
||||
writing the backup file, which should reduce the need
|
||||
for the "set allow_insecure_backup" nanorc option.
|
||||
for the 'set allow_insecure_backup' nanorc option.
|
||||
Don't stop, get it get it, don't stop, get it get it.
|
||||
|
||||
|
||||
@@ -317,7 +331,7 @@
|
||||
being used out of crontab). For very strange situations
|
||||
(such as where you cannot change the permissions on the
|
||||
file you're writing), there is a new rc file option
|
||||
"allow_insecure_backup" to be even more permissive and
|
||||
'allow_insecure_backup' to be even more permissive and
|
||||
allow the write to proceed. Also included are some
|
||||
syntax highlighting updates, and that is about it.
|
||||
Keep fighting the good fight children.
|
||||
@@ -1237,7 +1251,7 @@
|
||||
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
|
||||
Get Help" is now Listed and "^_ Goto Line" is not). The
|
||||
Get Help" is now listed and "^_ Goto Line" is not). The
|
||||
Yes/No/All keys have finally been internationalized
|
||||
also. All in all, quite a few changes, considering nano
|
||||
is supposed to be in a code freeze. But there are the
|
||||
|
||||
11
README
11
README
@@ -65,5 +65,12 @@ Bug Reports
|
||||
|
||||
Current Status
|
||||
|
||||
GNU nano has reached its seventh milestone, 2.6.x. Since 2.5.0, it
|
||||
is a "rolling" release: bug fixing and development go hand in hand.
|
||||
Since version 2.5.0, GNU nano has abandoned the distinction between
|
||||
a stable and a development branch: it is now on a "rolling" release
|
||||
-- fixing bugs and adding new features go hand in hand.
|
||||
|
||||
Copyright Years
|
||||
|
||||
When in any file of this package a copyright notice mentions a
|
||||
year range (such as 1999-2011), it is a shorthand for a list of
|
||||
all the years in that interval.
|
||||
|
||||
40
TODO
40
TODO
@@ -1,29 +1,14 @@
|
||||
A list of desired features
|
||||
--------------------------
|
||||
|
||||
Vague musings:
|
||||
- FriBidi support?
|
||||
- Make matching bracket searches sophisticated enough to skip over
|
||||
brackets inside comments?
|
||||
- Allow indentation of marked text by spaces as well as tabs?
|
||||
- Allow indentation to add just enough columns to reach the nearest
|
||||
multiple of tabsize, rather than always adding tabsize columns?
|
||||
- Allow conversion between different character sets.
|
||||
- Allow setting marks (saved positions, not to be confused with the mark
|
||||
set via Ctrl-^) at various lines and/or columns in the buffer, and
|
||||
allow movement between them with a single keystroke?
|
||||
- Allow searching for and replacing newlines?
|
||||
See also https://savannah.gnu.org/bugs/?47053.
|
||||
- New regression framework built on expect?
|
||||
- Add the ability to move to different lines of the screen with a single
|
||||
keystroke, e.g. M-` (M-~) to go to the top line, M-& (M-7) to go to
|
||||
the center line, and M-' (M-") to go to the last line?
|
||||
|
||||
Somewhat urgent:
|
||||
- Make undo/redo work also for justifying and indenting.
|
||||
- Allow text searches in the help viewer.
|
||||
See https://savannah.gnu.org/bugs/?28994.
|
||||
- Detect when text is being pasted, so that we can handle it faster.
|
||||
See https://savannah.gnu.org/bugs/?40060.
|
||||
- Allow to define and execute a macro: a stored sequence of keystrokes.
|
||||
See https://savannah.gnu.org/bugs/?50314.
|
||||
- Allow color syntaxes to apply to more than just color, so that we can
|
||||
e.g. specify a different alternate spell checker depending on which
|
||||
file type we have open.
|
||||
@@ -31,6 +16,17 @@ Somewhat urgent:
|
||||
the command's output -- that is: generalize the spell-check flow.
|
||||
See also https://savannah.gnu.org/bugs/?28993.
|
||||
|
||||
Vague musings:
|
||||
- FriBidi support?
|
||||
- Allow setting marks (saved positions, not to be confused with the
|
||||
mark set via Ctrl-^) at various lines and/or columns in the buffer,
|
||||
and allow movement between them with a single keystroke?
|
||||
- Make matching bracket searches sophisticated enough to skip over
|
||||
brackets inside comments?
|
||||
- Allow indentation of marked text by spaces as well as tabs?
|
||||
- Allow indentation to add just enough columns to reach the nearest
|
||||
multiple of tabsize, rather than always adding tabsize columns?
|
||||
|
||||
For version 2.4:
|
||||
- Handle window resizes better. After we've resized, we should stay
|
||||
wherever we were before we resized, as Pico does. [DONE]
|
||||
@@ -63,14 +59,13 @@ For version 2.0:
|
||||
|
||||
For version 1.2:
|
||||
- Single-line scroll up/down? [DONE]
|
||||
- Color syntax highlighting? (Certainly seems like there's a demand for
|
||||
it.) [DONE]
|
||||
- .nanorc [DONE]
|
||||
- Color syntax highlighting? (There seems to be a demand for it.) [DONE]
|
||||
- Support for a .nanorc file. [DONE]
|
||||
- Backup making (filename~)? [DONE]
|
||||
- Search/replace string history. [DONE]
|
||||
- Implement Pico's -j and -g flags, as they are pretty easy to do. [DONE]
|
||||
- Make mouse support work with clicking on the shortcuts (-m). [DONE]
|
||||
- Implement -o (chroot of sorts). [DONE]
|
||||
- Implement -o (--operatingdir, a chroot of sorts). [DONE]
|
||||
- Allow -r to take a negative argument, meaning right margin instead of
|
||||
left (allows resizing that way), formerly -W arg. [DONE]
|
||||
|
||||
@@ -81,7 +76,6 @@ For version 1.0:
|
||||
- Allow nano to be resized in X. [DONE]
|
||||
- On PageUp/Down, put the cursor on the first line (like Pico), not the
|
||||
center line. [DONE]
|
||||
- Rewrite edit_refresh, if at all possible. [DONE]
|
||||
- Implement justify function. [DONE]
|
||||
- Cut to end of line. [DONE]
|
||||
- Built-in speller command. [DONE]
|
||||
|
||||
@@ -2,9 +2,10 @@
|
||||
# Generate configure & friends for GIT users.
|
||||
|
||||
gnulib_url="git://git.sv.gnu.org/gnulib.git"
|
||||
gnulib_hash="4084b3a1094372b960ce4a97634e08f4538c8bdd"
|
||||
gnulib_hash="06d9e7302a736d7fa3db9cf1eb9850b60aee612f"
|
||||
|
||||
modules="
|
||||
futimens
|
||||
getdelim
|
||||
getline
|
||||
getopt-gnu
|
||||
|
||||
72
configure.ac
72
configure.ac
@@ -1,7 +1,7 @@
|
||||
# Configuration for GNU nano - a small and user-friendly text editor
|
||||
#
|
||||
# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
# 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc.
|
||||
# Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc.
|
||||
# Copyright (C) 2014, 2017 Mike Frysinger
|
||||
#
|
||||
# GNU nano is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published
|
||||
@@ -16,7 +16,7 @@
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see http://www.gnu.org/licenses/.
|
||||
|
||||
AC_INIT([GNU nano], [2.8.0], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [2.8.1], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_HOST
|
||||
AM_INIT_AUTOMAKE([1.14])
|
||||
@@ -587,36 +587,43 @@ else
|
||||
fi
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([for enhanced regular expression flag], nano_cv_flag_reg_extended,
|
||||
AC_CACHE_CHECK([for enhanced regular expression flag], nano_cv_flag_reg_enhanced,
|
||||
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <regex.h>]],
|
||||
[[
|
||||
#ifndef REG_ENHANCED
|
||||
error: No REG_ENHANCED support!
|
||||
#endif
|
||||
]])],
|
||||
[nano_cv_flag_reg_extended="REG_EXTENDED | REG_ENHANCED"],
|
||||
[nano_cv_flag_reg_extended="REG_EXTENDED"])])
|
||||
[nano_cv_flag_reg_enhanced=yes],
|
||||
[nano_cv_flag_reg_enhanced=no])])
|
||||
dnl The bundled gnulib regex module doesn't support REG_ENHANCED.
|
||||
if test "$ac_use_included_regex" = "yes"; then
|
||||
nano_cv_flag_reg_enhanced="no"
|
||||
fi
|
||||
if test "$nano_cv_flag_reg_enhanced" = "yes"; then
|
||||
nano_reg_extended="REG_EXTENDED | REG_ENHANCED"
|
||||
else
|
||||
nano_reg_extended="REG_EXTENDED"
|
||||
fi
|
||||
|
||||
AC_DEFINE_UNQUOTED(NANO_REG_EXTENDED, $nano_cv_flag_reg_extended,
|
||||
AC_DEFINE_UNQUOTED(NANO_REG_EXTENDED, $nano_reg_extended,
|
||||
[Flag(s) to use to get the full range of extended regular expressions])
|
||||
|
||||
# Check for word-boundary support (/< and />).
|
||||
AC_MSG_CHECKING([for GNU-style word boundary regex support])
|
||||
AC_ARG_WITH(wordbounds,
|
||||
AS_HELP_STRING([--with-wordbounds], [Use GNU-style word boundary delimiters]),
|
||||
[ case "$with_wordbounds" in
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
*)
|
||||
AC_MSG_RESULT(yes)
|
||||
# We explicitly don't check if the user forced the option, because
|
||||
# this is needed for cross compilers and we can't test the target.
|
||||
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define this if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
|
||||
;;
|
||||
esac
|
||||
], [
|
||||
AC_TRY_RUN([
|
||||
[with_wordbounds=$withval], [with_wordbounds=auto])
|
||||
if test "$with_wordbounds" != "no"; then
|
||||
dnl If we're using the bundled gnulib regex module, we know it's supported.
|
||||
if test "$ac_use_included_regex" = "yes"; then
|
||||
with_wordbounds="yes"
|
||||
fi
|
||||
|
||||
dnl We explicitly don't check if the user forced the option, because
|
||||
dnl this is needed for cross compilers and we can't test the target.
|
||||
if test "$with_wordbounds" != "yes"; then
|
||||
AC_TRY_RUN([
|
||||
#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
@@ -627,18 +634,29 @@ int main(void)
|
||||
size_t nmatch;
|
||||
regmatch_t pmatch;
|
||||
|
||||
if (regcomp(&r, "\\\\>", $nano_cv_flag_reg_extended|REG_NOSUB))
|
||||
if (regcomp(&r, "\\\\>", $nano_reg_extended|REG_NOSUB))
|
||||
return 1;
|
||||
if (regexec(&r, "word boundary", nmatch, &pmatch, 0))
|
||||
return 1;
|
||||
return 0;
|
||||
}],
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define this if the system supports GNU-style word boundaries in regexes.]) gnu_wordbounds=yes,
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
|
||||
)
|
||||
])
|
||||
with_wordbounds="yes",
|
||||
with_wordbounds="no",
|
||||
with_wordbounds="cross")
|
||||
fi
|
||||
fi
|
||||
case $with_wordbounds in
|
||||
yes)
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(GNU_WORDBOUNDS, 1, [Define this if the system supports GNU-style word boundaries in regexes.])
|
||||
;;
|
||||
no)
|
||||
AC_MSG_RESULT(no)
|
||||
;;
|
||||
cross)
|
||||
AC_MSG_WARN([*** Can't check for GNU-style word boundary support when cross-compiling])
|
||||
;;
|
||||
esac
|
||||
|
||||
if test x$color_support = xyes; then
|
||||
# if test x$CURSES_LIB_NAME = xcurses; then
|
||||
|
||||
133
doc/faq.html
133
doc/faq.html
@@ -9,20 +9,21 @@
|
||||
<h1>The GNU nano editor FAQ</h1>
|
||||
<h2>Table of Contents</h2>
|
||||
<h2><a href="#1">1. General</a></h2>
|
||||
<blockquote><p><a href="#1.1">1.1 About this FAQ</a><br>
|
||||
<a href="#1.2">1.2. How do I contribute to it?</a><br>
|
||||
<a href="#1.3">1.3. What is GNU nano?</a><br>
|
||||
<a href="#1.4">1.4. What is the history behind nano?</a><br>
|
||||
<a href="#1.5">1.5. Why the name change from TIP?</a><br>
|
||||
<a href="#1.6">1.6. What is the current version of nano?</a><br>
|
||||
<a href="#1.7">1.7. I want to read the manpage without having to download the program!</a></p></blockquote>
|
||||
<blockquote><p>
|
||||
<a href="#1.1">1.1. What is GNU nano?</a><br>
|
||||
<a href="#1.2">1.2. What is the history behind nano?</a><br>
|
||||
<a href="#1.3">1.3. Why the name change from TIP?</a><br>
|
||||
<a href="#1.4">1.4. What is the current version of nano?</a><br>
|
||||
<a href="#1.5">1.5. I want to read the manpage without having to download the program!</a></p></blockquote>
|
||||
<h2><a href="#2">2. Where to get GNU nano.</a></h2>
|
||||
<blockquote><p><a href="#2.1">2.1. FTP and WWW sites that carry nano.</a><br>
|
||||
<blockquote><p>
|
||||
<a href="#2.1">2.1. FTP and WWW sites that carry nano.</a><br>
|
||||
<a href="#2.2">2.2. RedHat and derivatives (.rpm) packages.</a><br>
|
||||
<a href="#2.3">2.3. Debian (.deb) packages.</a><br>
|
||||
<a href="#2.4">2.4. By GIT (for the brave).</a></p></blockquote>
|
||||
<h2><a href="#3">3. Installation and Configuration</a></h2>
|
||||
<blockquote><p><a href="#3.1">3.1. How do I install the RPM or DEB package?</a><br>
|
||||
<blockquote><p>
|
||||
<a href="#3.1">3.1. How do I install the RPM or DEB package?</a><br>
|
||||
<a href="#3.2">3.2. Compiling from source: WHAT THE HECK DO I DO NOW?</a><br>
|
||||
<a href="#3.3">3.3. Why does everything go into /usr/local?</a><br>
|
||||
<a href="#3.5">3.5. nano should automatically run strip on the binary when installing it!</a><br>
|
||||
@@ -32,7 +33,8 @@
|
||||
<a href="#3.9a">3.9a. How do I make a .nanorc file that nano will read when I start it?</a><br>
|
||||
<a href="#3.9b">3.9b. How about in Win32?</a></p></blockquote>
|
||||
<h2><a href="#4">4. Running</a></h2>
|
||||
<blockquote><p><a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
|
||||
<blockquote><p>
|
||||
<a href="#4.1">4.1. How do I open a file with a name beginning with '+' from the command line?</a><br>
|
||||
<a href="#4.2">4.2. Ack! My Backspace/Delete/Enter/Meta/double bucky key doesn't seem to work! What can I do?</a><br>
|
||||
<a href="#4.3">4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</a><br>
|
||||
<a href="#4.4">4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</a><br>
|
||||
@@ -45,31 +47,29 @@
|
||||
<a href="#4.11">4.11. How do I select text for or paste text from the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</a><br>
|
||||
<a href="#4.12">4.12. On startup I get a message that says "Detected a legacy nano history file". Now older nano versions can't find my search history!</a></p></blockquote>
|
||||
<h2><a href="#5">5. Internationalization</a></h2>
|
||||
<blockquote><p><a href="#5.1">5.1. There's no translation for my language!</a><br>
|
||||
<blockquote><p>
|
||||
<a href="#5.1">5.1. There's no translation for my language!</a><br>
|
||||
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a><br>
|
||||
<a href="#5.3">5.3. What is the status of Unicode support?</a></p></blockquote>
|
||||
<h2><a href="#6">6. Advocacy and Licensing</a></h2>
|
||||
<blockquote><p><a href="#6.1">6.1. Why should I use nano instead of Pico?</a><br>
|
||||
<blockquote><p>
|
||||
<a href="#6.1">6.1. Why should I use nano instead of Pico?</a><br>
|
||||
<a href="#6.2">6.2. Why should I use Pico instead of nano?</a><br>
|
||||
<a href="#6.3">6.3. What is so bad about the older Pine license?</a><br>
|
||||
<a href="#6.4">6.4. Okay, well, what mail program should I use then?</a></p></blockquote>
|
||||
<h2><a href="#7">7. Miscellaneous</a></h2>
|
||||
<blockquote><p><a href="#7.1">7.1. nano-related mailing lists.</a><br>
|
||||
<a href="#7.2">7.2. I want to send the development team a big load of cash (or just a thank you).</a><br>
|
||||
<a href="#7.3">7.3. How do I submit a bug report or patch?</a><br>
|
||||
<blockquote><p>
|
||||
<a href="#7.1">7.1. Where can I ask questions or send suggestions?</a><br>
|
||||
<a href="#7.2">7.2. How do I submit a bug report or patch?</a><br>
|
||||
<a href="#7.3">7.3. I want to send the development team a big load of cash (or just a thank you).</a><br>
|
||||
<a href="#7.4">7.4. How do I join the development team?</a><br>
|
||||
<a href="#7.5">7.5. Can I have write access to the GIT tree?</a></p></blockquote>
|
||||
<h2><a href="#8">8. ChangeLog</a></h2>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="1"></a>1. General</h1>
|
||||
<h2><a name="1.1"></a>1.1 About this FAQ</h2>
|
||||
<blockquote><p>This FAQ was originally written and maintained by Chris Allegretta <<a href="mailto:chrisa@asty.org">chrisa@asty.org</a>>, who also happens to be the creator of nano. It was then maintained by David Lawrence Ramsey <<a href="mailto:pooka109@gmail.com">pooka109@gmail.com</a>>. Maybe someone else will volunteer to maintain this FAQ someday, who knows...</p></blockquote>
|
||||
<h2><a name="1.2"></a>1.2. How do I contribute to it?</h2>
|
||||
<blockquote><p>Your best bet is to send it to the nano email address, <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a> and if it is useful enough it will be included in future versions.</p></blockquote>
|
||||
<h2><a name="1.3"></a>1.3. What is GNU nano?</h2>
|
||||
<h2><a name="1.1"></a>1.1. What is GNU nano?</h2>
|
||||
<blockquote><p>GNU nano is designed to be a free replacement for the Pico text editor, part of the Pine email suite from <a href="http://www.washington.edu/pine/">The University of Washington</a>. It aims to "emulate Pico as closely as possible and then include extra functionality".</p></blockquote>
|
||||
<h2><a name="1.4"></a>1.4. What is the history behind nano?</h2>
|
||||
<h2><a name="1.2"></a>1.2. What is the history behind nano?</h2>
|
||||
<blockquote><p>Funny you should ask!</p>
|
||||
<p><b>In the beginning...</b></p>
|
||||
<p>For years Pine was THE program used to read email on a Unix system. The Pico text editor is the portion of the program one would use to compose his or her mail messages. Many beginners to Unix flocked to Pico and Pine because of their well organized, easy to use interfaces. With the proliferation of GNU/Linux in the mid to late 90's, many University students became intimately familiar with the strengths (and weaknesses) of Pine and Pico.</p>
|
||||
@@ -79,11 +79,11 @@
|
||||
<p>It was in late 1999 when Chris Allegretta (our hero) was yet again complaining to himself about the less-than-perfect license Pico was distributed under, the 1000 makefiles that came with it and how just a few small improvements could make it the Best Editor in the World (TM). Having been a convert from Slackware to Debian, he missed having a simple binary package that included Pine and Pico, and had grown tired of downloading them himself.</p>
|
||||
<p>Finally something snapped inside and Chris coded and hacked like a madman for many hours straight one weekend to make a (barely usable) Pico clone, at the time called TIP (Tip Isn't Pico). The program could not be invoked without a filename, could not save files, had no help text display, spell checker, and so forth. But over time it improved, and with the help of a few great coders it matured to the (hopefully) stable state it is in today.</p>
|
||||
<p>In February 2001, nano was declared an official GNU program by Richard Stallman. nano also reached its first production release on March 22, 2001.</p></blockquote>
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<h2><a name="1.3"></a>1.3. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>2.8.0</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
|
||||
<h2><a name="1.4"></a>1.4. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano <i>should</i> be <b>2.8.1</b>. Of course, you should always check the <a href="https://nano-editor.org/">nano homepage</a> to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.5"></a>1.5. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="https://nano-editor.org/dist/latest/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
@@ -183,7 +183,7 @@
|
||||
<h2><a name="4.3"></a>4.3. Ack! My numeric keypad's keys don't work properly when NumLock is off! What can I do?</h2>
|
||||
<blockquote><p>You can use the <b>-K</b> or <b>--rebindkeypad</b> option on the command line, or add the line <b>set rebindkeypad</b> to your .nanorc. However, nano's mouse support won't work properly if you do any of these things.</p></blockquote>
|
||||
<h2><a name="4.4"></a>4.4. Ack! When I hold down a Meta key combination for a while, the character of the held key gets inserted now and then. What gives?</h2>
|
||||
<blockquote><p>This is a bug in the terminal, not in nano. When a key is repeating faster than nano can process it, the keyboard buffer becomes full and starts dropping incoming keystrokes. Unfortunately, it doesn't just drop whole keystrokes; it can also drop parts of multibyte key combinations, resulting in nano's receiving a wrong key.</p></blockquote>
|
||||
<blockquote><p>This was a bug in how nano handled consecutive escape sequences. It should be fixed since version 2.6.0.</p></blockquote>
|
||||
<h2><a name="4.5"></a>4.5. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</h2>
|
||||
<blockquote><p>It depends on the terminal type you're using. On some terminals, such as the FreeBSD console, xterm, konsole, and gnome-terminal, Shift-F1 to Shift-F4 will generate F13 to F16. On other terminals, such as the Linux console, rxvt, and Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
|
||||
<h2><a name="4.6"></a>4.6. nano crashes when I type <insert keystroke here>!</h2>
|
||||
@@ -240,93 +240,22 @@
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="7"></a>7. Miscellaneous</h1>
|
||||
<h2><a name="7.1"></a>7.1. nano-related mailing lists.</h2>
|
||||
<h2><a name="7.1"></a>7.1. Where can I ask questions or send suggestions?</h2>
|
||||
<blockquote><p>There are three mailing lists for nano hosted at <a href="http://savannah.gnu.org/">Savannah</a>: info-nano, help-nano and nano-devel. info-nano is a very low traffic list where new versions of nano are announced (surprise!). help-nano is for getting help with the editor without needing to hear all of the development issues surrounding it. nano-devel is a normally low, sometimes high traffic list for discussing the present and future development of nano. Here are links to where you can sign up for a given list:</p>
|
||||
<p>info-nano - <a href="http://mail.gnu.org/mailman/listinfo/info-nano/">http://mail.gnu.org/mailman/listinfo/info-nano/</a><br>
|
||||
help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
|
||||
nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
|
||||
<h2><a name="7.2"></a>7.2. I want to send the development team a big load of cash (or just a thank you).</h2>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="https://savannah.gnu.org/bugs/?group=nano">bug</a> in the program or implement a <a href="https://nano-editor.org/dist/latest/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<h2><a name="7.3"></a>7.3. How do I submit a bug report or patch?</h2>
|
||||
<h2><a name="7.2"></a>7.3. How do I submit a bug report or patch?</h2>
|
||||
<blockquote>
|
||||
<p>The best way to submit bugs is through the <a href="https://savannah.gnu.org/bugs/?group=nano">Savannah bug tracker</a>, as you can check whether the bug you are reporting has already been submitted, and it makes it easier for the maintainers to keep track of them.
|
||||
<p>You can submit patches for nano via <a href="https://savannah.gnu.org/patch/?group=nano">Savannah's patch manager</a>.</p></blockquote>
|
||||
<h2><a name="7.3"></a>7.3. I want to send the development team a big load of cash (or just a thank you).</h2>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="https://savannah.gnu.org/bugs/?group=nano">bug</a> in the program or implement a <a href="https://nano-editor.org/dist/latest/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<h2><a name="7.4"></a>7.4. How do I join the development team?</h2>
|
||||
<blockquote><p>The easiest way is to consistently send in good patches that add some needed functionality, fix a bug or two, and/or make the program more optimized/efficient. Then ask nicely and you will probably be added to the Savannah development list and be given write access after a while. There is a lot of responsibility that goes along with being a team member, so don't think it's just something to add to your resume.</p></blockquote>
|
||||
<h2><a name="7.5"></a>7.5. Can I have write access to the git tree?</h2>
|
||||
<blockquote><p>Re-read section <a href="#7.4">7.4</a> and you should know the answer.</p></blockquote>
|
||||
<hr width="100%">
|
||||
|
||||
<h1><a name="8"></a>8. ChangeLog</h1>
|
||||
<blockquote><p>
|
||||
2017.01.09 - Delete some obsolete items and update a few others. (Benno)<br>
|
||||
2016.04.17 - Update docs to refer to GIT instead of subversion. (Mike)<br>
|
||||
2015.07.18 - More small fixes and updates. (Benno)<br>
|
||||
2014.04.24 - A bunch of small fixes and updates. (Benno)<br>
|
||||
2009.11.30 - Update various bits for nano 2.2.x. (DLR)<br>
|
||||
2009.11.18 - Typo fix. (j.mader@gmail.com)<br>
|
||||
2008.03.16 - Update docs to refer to subversion instead of CVS, add more words about Alpine, and refer to Savannah for bugs and patches. (Chris)<br>
|
||||
2007.12.21 - Update maintainer information. (DLR)<br>
|
||||
2007.12.09 - Add minor punctuation and wording fixes, and update various sections to account for Alpine. (DLR)<br>
|
||||
2007.08.26 - Update links to the Free Translation Project. (DLR)<br>
|
||||
2007.07.29 - Update RPM links for nano 2.0.x. (DLR)<br>
|
||||
2007.04.18 - Add a new section 4.14 to explain how autoindent affects pasted text. (John M. Gabriele, minor tweaks by DLR)<br>
|
||||
2007.04.04 - Update email address. (DLR)<br>
|
||||
2007.01.01 - Update section 4.1 to describe how to open files with names beginning with '+' at specified columns as well as lines. (DLR)<br>
|
||||
2006.11.25 - Add miscellaneous wording and capitalization fixes. (DLR)<br>
|
||||
2006.10.28 - Update various links for the 2.0 branch of nano. (DLR)<br>
|
||||
2006.10.06 - Update the question in section 4.13 to match the version of it in the answer section. (DLR)<br>
|
||||
2006.07.25 - Update section 5.3 again to not state "the latest development version" before 1.3.12, as it's no longer accurate. Also add some minor spacing fixes. (DLR)<br>
|
||||
2006.06.12 - Update section 5.3, due to the display fix for two-column Unicode characters. (DLR)<br>
|
||||
2006.06.05 - Add a new section 4.8, and move all section 4 entries after it down one number, to explain how to deal with glibc 2.2.3's crashes involving extended regular expressions. (DLR)<br>
|
||||
2006.06.04 - Add minor punctuation, wording, and typo fixes. (DLR)<br>
|
||||
2006.05.27 - Update section 3.8 to mention the new "Unicode Input" prompt, and how Unicode input only works when Unicode support is enabled. (DLR)<br>
|
||||
2006.05.12 - Remove section 4.4, and move all section 4 entries after it up one number, since it no longer applies. Meta-] and Meta-[ are no longer used to indent and unindent marked text, since they require that the bracket matching key change to Ctrl-], which is used as the telnet escape key (found by Chris). Also, make the link to the nano CVS page a bit more readable. (DLR)<br>
|
||||
2006.05.08 - Add a new section 4.5, and move all section 4 entries after it down one number, to explain a problem that can occur when holding down keys to generate Meta sequences. Also add a few more capitalization and wording fixes. (Benno Schulenberg, minor tweaks by DLR)<br>
|
||||
2006.05.01 - Add a new section 4.4, and move all section 4 entries after it down one number, to explain how to deal with problems typing Meta-[. Also add a few capitalization and wording fixes. (DLR)<br>
|
||||
2006.04.14 - Clarify section 1.4: help menu -> help text display. (DLR, suggested by Benno Schulenberg)<br>
|
||||
2006.03.16 - Update the Free Translation Project's address, change the character set to UTF-8, and remove broken links to contributed RedHat nano packages. (DLR)<br>
|
||||
2005.11.21 - Clarify section 5.3 to better explain how to enable Unicode support, and remove the mention of quirks, since they turned out to not be a nano problem. (Mike Frysinger and DLR)<br>
|
||||
2005.11.19 - Add a new section 5.3 to explain the status of nano's Unicode support. (Mike Frysinger, minor tweaks by DLR)<br>
|
||||
2005.08.27 - Update email address. (DLR)<br>
|
||||
2005.08.10 - Add a new section 4.3, and move all section 4 entries after it down one number, to explain how to deal with numeric keypad problems. (DLR)<br>
|
||||
2005.08.08 - Update section 3.8 to mention that verbatim input mode now takes a six-digit hexadecimal number. (DLR)<br>
|
||||
2005.07.04 - Update section 4.10 to mention that pasting from the X clipboard via the middle mouse button also works when the Shift key is used. (DLR)<br>
|
||||
2005.06.15 - Update description of --enable-extra, and add missing line breaks. (DLR)<br>
|
||||
2005.06.13 - Minor capitalization and wording fixes. (DLR)<br>
|
||||
2005.06.08 - Updated section 1.1 to mention the current maintainer. (DLR)<br>
|
||||
2005.03.09 - Added question about opening files with names beginning with '+'s, and added a few more miscellaneous cosmetic fixes. (DLR)<br>
|
||||
2005.01.03 - Removed now-inaccurate note about verbatim input's not working at prompts, and update its description to mention that it handles hexadecimal values now. (DLR)<br>
|
||||
2004.11.21 - Listed sh as an example of a Bourne shell. (DLR)<br>
|
||||
2004.11.05 - Fixed inaccuracy: Pico compatibility mode was made the default in nano 1.1.99pre1, not 1.2.2. Also added question about how to type F13-F16 on terminals lacking keys past F12 (suggested by Chris), question about how to select text for the clipboard in X terminals with nano's mouse support turned on (answer found by Joseph Birthisel), and misc. fixes and link updates. (DLR)<br>
|
||||
2004.04.07 - Removed NumLock glitch question, as it's no longer needed. (DLR)<br>
|
||||
2004.01.30 - Fixed inaccuracy: multibuffer mode was first in nano 1.1.0, not 1.1.12. (DLR)<br>
|
||||
2003.12.31 - Added question about the new verbatim input function, and a few minor fixes. Removed reference to "set pico" (DLR).<br>
|
||||
2003.07.02 - Added question about nano's not showing color when it's compiled with color support (DLR; suggested by Jordi).<br>
|
||||
2003.02.23 - Updated RPM links for nano 1.2.x (DLR).<br>
|
||||
2003.01.16 - Split section 4.5 into 4.5a and 4.5b for search string behavior. Added --enable-all docs.<br>
|
||||
2002.12.28 - More misc. fixes (David Benbennick, DLR).<br>
|
||||
2002.10.25 - Misc. fixes and link updates (DLR).<br>
|
||||
2002.09.10 - Another typo fix (DLR).<br>
|
||||
2002.05.15 - Typo fix (DLR).<br>
|
||||
2001.12.26 - Misc. fixes (Aaron S. Hawley, DLR).<br>
|
||||
2001.10.02 - Update for Free Translation Project.<br>
|
||||
2001.10.02 - Assorted fixes, Debian additions.<br>
|
||||
2001.06.30 - Silly typo fix.<br>
|
||||
2001.05.05 - Spelling fixes by David Lawrence Ramsey.<br>
|
||||
2001.05.02 - Misc fixes.<br>
|
||||
2001.03.26 - Typo fix in an URL.<br>
|
||||
2001.02.17 - Advocacy updates.<br>
|
||||
2001.02.15 - Added GNU notes for 0.9.99pre3.<br>
|
||||
2001.02.06 - Typo fixes.<br>
|
||||
2001.01.14 - Added note about NumLock glitch.<br>
|
||||
2001.01.10 - Linux -> GNU/Linux.<br>
|
||||
2001.01.09 - Added "making exe smaller" section.<br>
|
||||
2000.12.19 - Typo and assorted error fixes.<br>
|
||||
2000.11.28 - Added blurb about make install-strip.<br>
|
||||
2000.11.19 - Changed Debian frozen to stable.<br>
|
||||
2000.11.18 - Previous string display (4.5).<br>
|
||||
2000.09.27 - Moved addresses to nano-editor.org.<br>
|
||||
2000.06.31 - Initial framework.</p></blockquote>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
.\" Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
.\" 2009, 2010, 2013, 2014 Free Software Foundation, Inc.
|
||||
.\" Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -17,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANO 1 "version 2.8.0" "March 2017"
|
||||
.TH NANO 1 "version 2.8.1" "April 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
@smallbook
|
||||
@set EDITION 0.4
|
||||
@set VERSION 2.8.0
|
||||
@set UPDATED March 2017
|
||||
@set VERSION 2.8.1
|
||||
@set UPDATED April 2017
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -20,8 +20,8 @@
|
||||
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 2.8.0
|
||||
@subtitle a small and friendly text editor
|
||||
@subtitle version 2.8.1
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -30,8 +30,7 @@ This manual documents GNU @code{nano}, a small and friendly text editor.
|
||||
|
||||
This manual is part of the GNU @code{nano} distribution.@*
|
||||
@sp 4
|
||||
Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
|
||||
2009, 2014, 2015 Free Software Foundation, Inc.
|
||||
Copyright (C) 1999-2009, 2014-2017 Free Software Foundation, Inc.
|
||||
|
||||
This document is dual-licensed. You may distribute and/or modify it
|
||||
under the terms of either of the following licenses:
|
||||
@@ -1428,6 +1427,13 @@ it can also be appended or prepended to an existing file.
|
||||
When using the Read-File key (^R), @code{nano} can not just read a file,
|
||||
it can also read the output of a command to be run (^X).
|
||||
|
||||
@item Reading from Working Directory
|
||||
By default, Pico will read files from the user's home directory (when
|
||||
using ^R), but it will write files to the current working directory
|
||||
(when using ^O). @code{nano} makes this symmetrical: always reading
|
||||
from and writing to the current working directory --- the directory
|
||||
that @code{nano} was started in.
|
||||
|
||||
@item File Browser
|
||||
In the file browser, @code{nano} does not implement the Add, Copy,
|
||||
Rename, and Delete commands that Pico provides. In @code{nano} the
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
.\" Copyright (C) 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011,
|
||||
.\" 2013, 2014, 2015 Free Software Foundation, Inc.
|
||||
.\" Copyright (C) 2003-2011, 2013-2017 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" This document is dual-licensed. You may distribute and/or modify it
|
||||
.\" under the terms of either of the following licenses:
|
||||
@@ -17,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH NANORC 5 "version 2.8.0" "March 2017"
|
||||
.TH NANORC 5 "version 2.8.1" "April 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.\" Documentation License along with this program. If not, see
|
||||
.\" <http://www.gnu.org/licenses/>.
|
||||
.\"
|
||||
.TH RNANO 1 "version 2.8.0" "March 2017"
|
||||
.TH RNANO 1 "version 2.8.1" "April 2017"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
|
||||
.SH NAME
|
||||
|
||||
1020
po/nano.pot
1020
po/nano.pot
File diff suppressed because it is too large
Load Diff
1016
po/pt_BR.po
1016
po/pt_BR.po
File diff suppressed because it is too large
Load Diff
1016
po/zh_CN.po
1016
po/zh_CN.po
File diff suppressed because it is too large
Load Diff
1016
po/zh_TW.po
1016
po/zh_TW.po
File diff suppressed because it is too large
Load Diff
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* browser.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
|
||||
* 2010, 2011, 2013, 2014, 2015 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -198,6 +197,17 @@ char *do_browser(char *path)
|
||||
} else if (func == do_down_void) {
|
||||
if (selected + width <= filelist_len - 1)
|
||||
selected += width;
|
||||
} else if (func == do_prev_block) {
|
||||
selected = ((selected / (editwinrows * width)) *
|
||||
editwinrows * width) + selected % width;
|
||||
} else if (func == do_next_block) {
|
||||
selected = ((selected / (editwinrows * width)) *
|
||||
editwinrows * width) + selected % width +
|
||||
editwinrows * width - width;
|
||||
if (selected >= filelist_len)
|
||||
selected = (filelist_len / width) * width + selected % width;
|
||||
if (selected >= filelist_len)
|
||||
selected -= width;
|
||||
} else if (func == do_page_up) {
|
||||
if (selected < width)
|
||||
selected = 0;
|
||||
|
||||
46
src/chars.c
46
src/chars.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* chars.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
|
||||
* 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -77,7 +76,7 @@ bool is_alpha_mbchar(const char *c)
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
return 0;
|
||||
}
|
||||
@@ -97,7 +96,7 @@ bool is_alnum_mbchar(const char *c)
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
return 0;
|
||||
}
|
||||
@@ -117,7 +116,7 @@ bool is_blank_mbchar(const char *c)
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
return 0;
|
||||
}
|
||||
@@ -165,7 +164,7 @@ bool is_punct_mbchar(const char *c)
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
return 0;
|
||||
}
|
||||
@@ -188,7 +187,7 @@ bool is_word_mbchar(const char *c, bool allow_punct)
|
||||
return TRUE;
|
||||
|
||||
if (word_chars != NULL && *word_chars != '\0') {
|
||||
char symbol[mb_cur_max() + 1];
|
||||
char symbol[MAXCHARLEN + 1];
|
||||
int symlen = parse_mbchar(c, symbol, NULL);
|
||||
|
||||
symbol[symlen] = '\0';
|
||||
@@ -240,7 +239,7 @@ int length_of_char(const char *c, int *width)
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
wchar_t wc;
|
||||
int charlen = mbtowc(&wc, c, MB_CUR_MAX);
|
||||
int charlen = mbtowc(&wc, c, MAXCHARLEN);
|
||||
|
||||
/* If the sequence is invalid... */
|
||||
if (charlen < 0) {
|
||||
@@ -273,7 +272,7 @@ int mbwidth(const char *c)
|
||||
wchar_t wc;
|
||||
int width;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
return 1;
|
||||
}
|
||||
@@ -289,17 +288,6 @@ int mbwidth(const char *c)
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Return the maximum length (in bytes) of a character. */
|
||||
int mb_cur_max(void)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8)
|
||||
return MB_CUR_MAX;
|
||||
else
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Convert the Unicode value in chr to a multibyte character, if possible.
|
||||
* If the conversion succeeds, return the (dynamically allocated) multibyte
|
||||
* character and its length. Otherwise, return an undefined (dynamically
|
||||
@@ -310,7 +298,7 @@ char *make_mbchar(long chr, int *chr_mb_len)
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
chr_mb = charalloc(MB_CUR_MAX);
|
||||
chr_mb = charalloc(MAXCHARLEN);
|
||||
*chr_mb_len = wctomb(chr_mb, (wchar_t)chr);
|
||||
|
||||
/* Reject invalid Unicode characters. */
|
||||
@@ -340,7 +328,7 @@ int parse_mbchar(const char *buf, char *chr, size_t *col)
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
/* Get the number of bytes in the multibyte character. */
|
||||
length = mblen(buf, MB_CUR_MAX);
|
||||
length = mblen(buf, MAXCHARLEN);
|
||||
|
||||
/* When the multibyte sequence is invalid, only take the first byte. */
|
||||
if (length <= 0) {
|
||||
@@ -410,10 +398,10 @@ size_t move_mbleft(const char *buf, size_t pos)
|
||||
/* There is no library function to move backward one multibyte
|
||||
* character. So we just start groping for one at the farthest
|
||||
* possible point. */
|
||||
if (mb_cur_max() > pos)
|
||||
if (pos < MAXCHARLEN)
|
||||
before = 0;
|
||||
else
|
||||
before = pos - mb_cur_max();
|
||||
before = pos - MAXCHARLEN;
|
||||
|
||||
while (before < pos) {
|
||||
char_len = parse_mbchar(buf + before, NULL, NULL);
|
||||
@@ -446,12 +434,12 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n)
|
||||
while (*s1 != '\0' && *s2 != '\0' && n > 0) {
|
||||
bool bad1 = FALSE, bad2 = FALSE;
|
||||
|
||||
if (mbtowc(&wc1, s1, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc1, s1, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
bad1 = TRUE;
|
||||
}
|
||||
|
||||
if (mbtowc(&wc2, s2, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc2, s2, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
bad2 = TRUE;
|
||||
}
|
||||
@@ -625,11 +613,11 @@ char *mbstrchr(const char *s, const char *c)
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
bool bad_s_mb = FALSE, bad_c_mb = FALSE;
|
||||
char symbol[MB_CUR_MAX];
|
||||
char symbol[MAXCHARLEN];
|
||||
const char *q = s;
|
||||
wchar_t ws, wc;
|
||||
|
||||
if (mbtowc(&wc, c, MB_CUR_MAX) < 0) {
|
||||
if (mbtowc(&wc, c, MAXCHARLEN) < 0) {
|
||||
mbtowc_reset();
|
||||
wc = (unsigned char)*c;
|
||||
bad_c_mb = TRUE;
|
||||
@@ -749,7 +737,7 @@ bool has_blank_mbchars(const char *s)
|
||||
{
|
||||
#ifdef ENABLE_UTF8
|
||||
if (use_utf8) {
|
||||
char symbol[MB_CUR_MAX];
|
||||
char symbol[MAXCHARLEN];
|
||||
|
||||
for (; *s != '\0'; s += move_mbright(s, 0)) {
|
||||
parse_mbchar(s, symbol, NULL);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* color.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
|
||||
* 2010, 2011, 2013, 2014, 2015 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016, 2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* cut.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014 Mark Majeres *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* *
|
||||
|
||||
66
src/files.c
66
src/files.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* files.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -1541,12 +1540,14 @@ void init_backup_dir(void)
|
||||
|
||||
/* Read from inn, write to out. We assume inn is opened for reading,
|
||||
* and out for writing. We return 0 on success, -1 on read error, or -2
|
||||
* on write error. */
|
||||
int copy_file(FILE *inn, FILE *out)
|
||||
* on write error. inn is always closed by this function, out is closed
|
||||
* only if close_out is true. */
|
||||
int copy_file(FILE *inn, FILE *out, bool close_out)
|
||||
{
|
||||
int retval = 0;
|
||||
char buf[BUFSIZ];
|
||||
size_t charsread;
|
||||
int (*flush_out_fnc)(FILE *) = (close_out) ? fclose : fflush;
|
||||
|
||||
assert(inn != NULL && out != NULL && inn != out);
|
||||
|
||||
@@ -1564,7 +1565,7 @@ int copy_file(FILE *inn, FILE *out)
|
||||
|
||||
if (fclose(inn) == EOF)
|
||||
retval = -1;
|
||||
if (fclose(out) == EOF)
|
||||
if (flush_out_fnc(out) == EOF)
|
||||
retval = -2;
|
||||
|
||||
return retval;
|
||||
@@ -1655,13 +1656,12 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
int backup_fd;
|
||||
FILE *backup_file;
|
||||
char *backupname;
|
||||
struct utimbuf filetime;
|
||||
int copy_status;
|
||||
static struct timespec filetime[2];
|
||||
int backup_cflags;
|
||||
|
||||
/* Save the original file's access and modification times. */
|
||||
filetime.actime = openfile->current_stat->st_atime;
|
||||
filetime.modtime = openfile->current_stat->st_mtime;
|
||||
filetime[0].tv_sec = openfile->current_stat->st_atime;
|
||||
filetime[1].tv_sec = openfile->current_stat->st_mtime;
|
||||
|
||||
if (f_open == NULL) {
|
||||
/* Open the original file to copy to the backup. */
|
||||
@@ -1753,35 +1753,36 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
statusline(HUSH, _("Error writing backup file %s: %s"),
|
||||
backupname, strerror(errno));
|
||||
free(backupname);
|
||||
/* If we can't make a backup, DON'T go on, since whatever caused
|
||||
* the backup to fail (e.g. disk full) may well cause the real
|
||||
* file write to fail, in which case we could lose both the
|
||||
* backup and the original! */
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
/* We shouldn't worry about chown()ing something if we're not
|
||||
* root, since it's likely to fail! */
|
||||
if (geteuid() == NANO_ROOT_UID && fchown(backup_fd,
|
||||
openfile->current_stat->st_uid, openfile->current_stat->st_gid) == -1
|
||||
&& !ISSET(INSECURE_BACKUP)) {
|
||||
/* Only try chowning the backup when we're root. */
|
||||
if (geteuid() == NANO_ROOT_UID &&
|
||||
fchown(backup_fd, openfile->current_stat->st_uid,
|
||||
openfile->current_stat->st_gid) == -1 &&
|
||||
!ISSET(INSECURE_BACKUP)) {
|
||||
fclose(backup_file);
|
||||
if (prompt_failed_backupwrite(backupname))
|
||||
goto skip_backup;
|
||||
statusline(HUSH, _("Error writing backup file %s: %s"),
|
||||
backupname, strerror(errno));
|
||||
free(backupname);
|
||||
fclose(backup_file);
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
if (fchmod(backup_fd, openfile->current_stat->st_mode) == -1
|
||||
&& !ISSET(INSECURE_BACKUP)) {
|
||||
/* Set the backup's mode bits. */
|
||||
if (fchmod(backup_fd, openfile->current_stat->st_mode) == -1 &&
|
||||
!ISSET(INSECURE_BACKUP)) {
|
||||
fclose(backup_file);
|
||||
if (prompt_failed_backupwrite(backupname))
|
||||
goto skip_backup;
|
||||
statusline(HUSH, _("Error writing backup file %s: %s"),
|
||||
backupname, strerror(errno));
|
||||
free(backupname);
|
||||
fclose(backup_file);
|
||||
/* If we can't write to the backup, DONT go on, since
|
||||
* whatever caused the backup file to fail (e.g. disk
|
||||
* full) may well cause the real file write to fail, which
|
||||
* means we could lose both the backup and the original! */
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
@@ -1790,27 +1791,24 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
#endif
|
||||
|
||||
/* Copy the file. */
|
||||
copy_status = copy_file(f, backup_file);
|
||||
|
||||
if (copy_status != 0) {
|
||||
if (copy_file(f, backup_file, FALSE) != 0) {
|
||||
fclose(backup_file);
|
||||
statusline(ALERT, _("Error reading %s: %s"), realname,
|
||||
strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
/* And set its metadata. */
|
||||
if (utime(backupname, &filetime) == -1 && !ISSET(INSECURE_BACKUP)) {
|
||||
/* And set the backup's timestamps. */
|
||||
if (futimens(backup_fd, filetime) == -1 && !ISSET(INSECURE_BACKUP)) {
|
||||
fclose(backup_file);
|
||||
if (prompt_failed_backupwrite(backupname))
|
||||
goto skip_backup;
|
||||
statusline(HUSH, _("Error writing backup file %s: %s"),
|
||||
backupname, strerror(errno));
|
||||
/* If we can't write to the backup, DON'T go on, since
|
||||
* whatever caused the backup file to fail (e.g. disk full
|
||||
* may well cause the real file write to fail, which means
|
||||
* we could lose both the backup and the original! */
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
fclose(backup_file);
|
||||
free(backupname);
|
||||
}
|
||||
|
||||
@@ -1867,7 +1865,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
}
|
||||
}
|
||||
|
||||
if (f_source == NULL || copy_file(f_source, f) != 0) {
|
||||
if (f_source == NULL || copy_file(f_source, f, TRUE) != 0) {
|
||||
statusline(ALERT, _("Error writing temp file: %s"),
|
||||
strerror(errno));
|
||||
unlink(tempname);
|
||||
@@ -1975,7 +1973,7 @@ bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
goto cleanup_and_exit;
|
||||
}
|
||||
|
||||
if (copy_file(f_source, f) == -1) {
|
||||
if (copy_file(f_source, f, TRUE) != 0) {
|
||||
statusline(ALERT, _("Error writing %s: %s"), realname,
|
||||
strerror(errno));
|
||||
goto cleanup_and_exit;
|
||||
@@ -2634,7 +2632,7 @@ char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
char *mzero, *glued;
|
||||
const char *lastslash = revstrstr(buf, "/", buf + *place);
|
||||
size_t lastslash_len = (lastslash == NULL) ? 0 : lastslash - buf + 1;
|
||||
char char1[mb_cur_max()], char2[mb_cur_max()];
|
||||
char char1[MAXCHARLEN], char2[MAXCHARLEN];
|
||||
int len1, len2;
|
||||
|
||||
/* Get the number of characters that all matches have in common. */
|
||||
|
||||
61
src/global.c
61
src/global.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* global.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -59,9 +58,10 @@ message_type lastmessage = HUSH;
|
||||
filestruct *pletion_line = NULL;
|
||||
/* The line where the last completion was found, if any. */
|
||||
|
||||
int controlleft, controlright, controlup, controldown;
|
||||
int controlleft, controlright, controlup, controldown, controlhome, controlend;
|
||||
#ifndef NANO_TINY
|
||||
int shiftcontrolleft, shiftcontrolright, shiftcontrolup, shiftcontroldown;
|
||||
int shiftcontrolhome, shiftcontrolend;
|
||||
int shiftaltleft, shiftaltright, shiftaltup, shiftaltdown;
|
||||
#endif
|
||||
|
||||
@@ -502,6 +502,8 @@ void shortcut_init(void)
|
||||
#ifndef NANO_TINY
|
||||
const char *nano_browser_lefthand_msg = N_("Go to lefthand column");
|
||||
const char *nano_browser_righthand_msg = N_("Go to righthand column");
|
||||
const char *nano_browser_toprow_msg = N_("Go to first row in this column");
|
||||
const char *nano_browser_bottomrow_msg = N_("Go to last row in this column");
|
||||
#endif
|
||||
#endif
|
||||
const char *nano_prevpage_msg = N_("Go one screenful up");
|
||||
@@ -870,9 +872,6 @@ void shortcut_init(void)
|
||||
whereis_next_tag, IFSCHELP(nano_whereis_next_msg), TOGETHER, VIEW);
|
||||
#endif
|
||||
|
||||
add_to_funcs(do_verbatim_input, MMAIN,
|
||||
N_("Verbatim"), IFSCHELP(nano_verbatim_msg), TOGETHER, NOVIEW);
|
||||
|
||||
add_to_funcs(do_tab, MMAIN,
|
||||
N_("Tab"), IFSCHELP(nano_tab_msg), TOGETHER, NOVIEW);
|
||||
add_to_funcs(do_enter, MMAIN,
|
||||
@@ -909,6 +908,9 @@ void shortcut_init(void)
|
||||
N_("Word Count"), IFSCHELP(nano_wordcount_msg), TOGETHER, VIEW);
|
||||
#endif
|
||||
|
||||
add_to_funcs(do_verbatim_input, MMAIN,
|
||||
N_("Verbatim"), IFSCHELP(nano_verbatim_msg), BLANKAFTER, NOVIEW);
|
||||
|
||||
add_to_funcs(total_refresh, MMAIN,
|
||||
refresh_tag, IFSCHELP(nano_refresh_msg), TOGETHER, VIEW);
|
||||
|
||||
@@ -1015,7 +1017,11 @@ void shortcut_init(void)
|
||||
add_to_funcs(do_prev_word_void, MBROWSER,
|
||||
N_("Left Column"), IFSCHELP(nano_browser_lefthand_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_next_word_void, MBROWSER,
|
||||
N_("Right Column"), IFSCHELP(nano_browser_righthand_msg), BLANKAFTER, VIEW);
|
||||
N_("Right Column"), IFSCHELP(nano_browser_righthand_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_prev_block, MBROWSER,
|
||||
N_("Top Row"), IFSCHELP(nano_browser_toprow_msg), TOGETHER, VIEW);
|
||||
add_to_funcs(do_next_block, MBROWSER,
|
||||
N_("Bottom Row"), IFSCHELP(nano_browser_bottomrow_msg), BLANKAFTER, VIEW);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -1072,18 +1078,21 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "F8", 0, do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER|MLINTER, "PgDn", KEY_NPAGE, do_page_down, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-\\", 0, do_first_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "^Home", CONTROL_HOME, do_first_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-|", 0, do_first_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-/", 0, do_last_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "^End", CONTROL_END, do_last_line, 0);
|
||||
add_to_sclist(MMAIN|MHELP, "M-?", 0, do_last_line, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "M-W", 0, do_research, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "F16", 0, do_research, 0);
|
||||
#ifndef NANO_TINY
|
||||
add_to_sclist(MMAIN, "M-]", 0, do_find_bracket, 0);
|
||||
add_to_sclist(MMAIN, "^^", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "M-A", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "^6", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "^^", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "F15", 0, do_mark, 0);
|
||||
add_to_sclist(MMAIN, "M-^", 0, do_copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-6", 0, do_copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-^", 0, do_copy_text, 0);
|
||||
add_to_sclist(MMAIN, "M-}", 0, do_indent_void, 0);
|
||||
add_to_sclist(MMAIN, "M-{", 0, do_unindent, 0);
|
||||
add_to_sclist(MMAIN, "M-U", 0, do_undo, 0);
|
||||
@@ -1096,16 +1105,18 @@ void shortcut_init(void)
|
||||
add_to_sclist(MMAIN, "M-3", 0, do_comment, 0);
|
||||
#endif
|
||||
add_to_sclist(MMOST, "^B", 0, do_left, 0);
|
||||
add_to_sclist(MMOST, "Left", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "^F", 0, do_right, 0);
|
||||
add_to_sclist(MMOST, "Right", KEY_RIGHT, do_right, 0);
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
add_to_sclist(MMOST, "\xE2\x86\x90", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "\xE2\x86\x92", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MMOST, "^\xE2\x86\x90", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^\xE2\x86\x92", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
add_to_sclist(MMOST, "Left", KEY_LEFT, do_left, 0);
|
||||
add_to_sclist(MMOST, "Right", KEY_RIGHT, do_right, 0);
|
||||
add_to_sclist(MMOST, "^Left", CONTROL_LEFT, do_prev_word_void, 0);
|
||||
add_to_sclist(MMOST, "^Right", CONTROL_RIGHT, do_next_word_void, 0);
|
||||
}
|
||||
@@ -1116,18 +1127,20 @@ void shortcut_init(void)
|
||||
add_to_sclist((MMOST & ~MBROWSER), "^E", 0, do_end_void, 0);
|
||||
add_to_sclist((MMOST & ~MBROWSER), "End", KEY_END, do_end_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^P", 0, do_up_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", KEY_UP, do_up_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "^N", 0, do_down_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", KEY_DOWN, do_down_void, 0);
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
add_to_sclist(MMAIN, "^\xE2\x86\x91", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN, "^\xE2\x86\x93", CONTROL_DOWN, do_next_block, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x86\x91", KEY_UP, do_up_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "\xE2\x86\x93", KEY_DOWN, do_down_void, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^\xE2\x86\x91", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^\xE2\x86\x93", CONTROL_DOWN, do_next_block, 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
add_to_sclist(MMAIN, "^Up", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN, "^Down", CONTROL_DOWN, do_next_block, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "Up", KEY_UP, do_up_void, 0);
|
||||
add_to_sclist(MMAIN|MHELP|MBROWSER, "Down", KEY_DOWN, do_down_void, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^Up", CONTROL_UP, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN|MBROWSER, "^Down", CONTROL_DOWN, do_next_block, 0);
|
||||
}
|
||||
add_to_sclist(MMAIN, "M-7", 0, do_prev_block, 0);
|
||||
add_to_sclist(MMAIN, "M-8", 0, do_next_block, 0);
|
||||
@@ -1215,9 +1228,17 @@ void shortcut_init(void)
|
||||
add_to_sclist(MGOTOLINE, "^T", 0, gototext_void, 0);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "^P", 0, get_history_older_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Up", KEY_UP, get_history_older_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "^N", 0, get_history_newer_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Down", KEY_DOWN, get_history_newer_void, 0);
|
||||
#ifdef ENABLE_UTF8
|
||||
if (using_utf8()) {
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "\xE2\x86\x91", KEY_UP, get_history_older_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "\xE2\x86\x93", KEY_DOWN, get_history_newer_void, 0);
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Up", KEY_UP, get_history_older_void, 0);
|
||||
add_to_sclist(MWHEREIS|MREPLACE|MREPLACEWITH|MWHEREISFILE, "Down", KEY_DOWN, get_history_newer_void, 0);
|
||||
}
|
||||
#endif
|
||||
#ifndef DISABLE_BROWSER
|
||||
add_to_sclist(MWHEREISFILE, "^Y", 0, do_first_file, 0);
|
||||
@@ -1228,6 +1249,8 @@ void shortcut_init(void)
|
||||
add_to_sclist(MBROWSER|MWHEREISFILE, "M-?", 0, do_last_file, 0);
|
||||
add_to_sclist(MBROWSER, "Home", KEY_HOME, do_first_file, 0);
|
||||
add_to_sclist(MBROWSER, "End", KEY_END, do_last_file, 0);
|
||||
add_to_sclist(MBROWSER, "^Home", CONTROL_HOME, do_first_file, 0);
|
||||
add_to_sclist(MBROWSER, "^End", CONTROL_HOME, do_last_file, 0);
|
||||
add_to_sclist(MBROWSER, "^_", 0, goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER, "M-G", 0, goto_dir_void, 0);
|
||||
add_to_sclist(MBROWSER, "F13", 0, goto_dir_void, 0);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* help.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, *
|
||||
* 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2000-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -370,7 +369,7 @@ void help_init(void)
|
||||
* plus one or two \n's. */
|
||||
for (f = allfuncs; f != NULL; f = f->next)
|
||||
if (f->menus & currmenu)
|
||||
allocsize += (16 * mb_cur_max()) + strlen(f->help) + 2;
|
||||
allocsize += (16 * MAXCHARLEN) + strlen(f->help) + 2;
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* If we're on the main list, we also count the toggle help text.
|
||||
@@ -418,9 +417,9 @@ void help_init(void)
|
||||
/* Make the first column narrower (6) than the second (10),
|
||||
* but allow it to spill into the second, for "M-Space". */
|
||||
if (scsfound == 1) {
|
||||
sprintf(ptr, "%s ", s->keystr);
|
||||
sprintf(ptr, "%s ", s->keystr);
|
||||
/* Unicode arrows take three bytes instead of one. */
|
||||
if (s->keystr[1] == '\xE2')
|
||||
if (s->keystr[0] == '\xE2' || s->keystr[1] == '\xE2')
|
||||
ptr += 8;
|
||||
else
|
||||
ptr += 6;
|
||||
|
||||
26
src/move.c
26
src/move.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* move.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -96,7 +95,7 @@ void do_page_up(void)
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window up a page. */
|
||||
/* Move the viewport so that the cursor stays immobile, if possible. */
|
||||
adjust_viewport(STATIONARY);
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
@@ -128,7 +127,7 @@ void do_page_down(void)
|
||||
openfile->current_x = actual_x(openfile->current->data,
|
||||
openfile->placewewant);
|
||||
|
||||
/* Scroll the edit window down a page. */
|
||||
/* Move the viewport so that the cursor stays immobile, if possible. */
|
||||
adjust_viewport(STATIONARY);
|
||||
refresh_needed = TRUE;
|
||||
}
|
||||
@@ -153,8 +152,7 @@ void do_para_begin(bool allow_update)
|
||||
edit_redraw(was_current);
|
||||
}
|
||||
|
||||
/* Move up to the beginning of the last beginning-of-paragraph line
|
||||
* before the current line, and update the screen afterwards. */
|
||||
/* Move up to first start of a paragraph before the current line. */
|
||||
void do_para_begin_void(void)
|
||||
{
|
||||
do_para_begin(TRUE);
|
||||
@@ -190,9 +188,7 @@ void do_para_end(bool allow_update)
|
||||
edit_redraw(was_current);
|
||||
}
|
||||
|
||||
/* Move down to the beginning of the last line of the current paragraph.
|
||||
* Then move down one line farther if there is such a line, or to the
|
||||
* end of the current line if not, and update the screen afterwards. */
|
||||
/* Move down to just after the first end of a paragraph. */
|
||||
void do_para_end_void(void)
|
||||
{
|
||||
do_para_end(TRUE);
|
||||
@@ -348,12 +344,12 @@ void do_next_word_void(void)
|
||||
|
||||
/* Move to the beginning of the current line (or softwrapped chunk).
|
||||
* If be_clever is TRUE, do a smart home when wanted and possible,
|
||||
* and do a dynamic home when in softwrap mode and it'spossible.
|
||||
* and do a dynamic home when in softwrap mode and it's possible.
|
||||
* If be_clever is FALSE, just do a simple home. */
|
||||
void do_home(bool be_clever)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
size_t was_column = xplustabs();
|
||||
size_t was_column = openfile->placewewant;
|
||||
bool moved_off_chunk = TRUE;
|
||||
#ifndef NANO_TINY
|
||||
bool moved = FALSE;
|
||||
@@ -383,17 +379,19 @@ void do_home(bool be_clever)
|
||||
if (!moved && ISSET(SOFTWRAP)) {
|
||||
/* If already at the left edge of the screen, move fully home.
|
||||
* Otherwise, move to the left edge. */
|
||||
if (openfile->current_x == leftedge_x && be_clever)
|
||||
if (was_column % editwincols == 0 && be_clever)
|
||||
openfile->current_x = 0;
|
||||
else {
|
||||
openfile->current_x = leftedge_x;
|
||||
openfile->placewewant = (was_column / editwincols) * editwincols;
|
||||
moved_off_chunk = FALSE;
|
||||
}
|
||||
} else if (!moved)
|
||||
#endif
|
||||
openfile->current_x = 0;
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
if (moved_off_chunk)
|
||||
openfile->placewewant = 0;
|
||||
|
||||
/* If we changed chunk, we might be offscreen. Otherwise,
|
||||
* update current if the mark is on or we changed "page". */
|
||||
@@ -416,7 +414,7 @@ void do_home_void(void)
|
||||
void do_end(bool be_clever)
|
||||
{
|
||||
filestruct *was_current = openfile->current;
|
||||
size_t was_column = xplustabs();
|
||||
size_t was_column = openfile->placewewant;
|
||||
size_t line_len = strlen(openfile->current->data);
|
||||
bool moved_off_chunk = TRUE;
|
||||
|
||||
|
||||
44
src/nano.c
44
src/nano.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* nano.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -916,10 +915,9 @@ void version(void)
|
||||
#else
|
||||
printf(_(" GNU nano, version %s\n"), VERSION);
|
||||
#endif
|
||||
printf(" (C) 1999..2016 Free Software Foundation, Inc.\n");
|
||||
printf(_(" (C) 2014..%s the contributors to nano\n"), "2017");
|
||||
printf(
|
||||
_(" Email: nano@nano-editor.org Web: https://nano-editor.org/"));
|
||||
printf(" (C) 1999-2011, 2013-2017 Free Software Foundation, Inc.\n");
|
||||
printf(_(" (C) 2014-%s the contributors to nano\n"), "2017");
|
||||
printf(_(" Email: nano@nano-editor.org Web: https://nano-editor.org/"));
|
||||
printf(_("\n Compiled options:"));
|
||||
|
||||
#ifdef NANO_TINY
|
||||
@@ -1812,7 +1810,7 @@ int do_mouse(void)
|
||||
* TRUE. */
|
||||
void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
{
|
||||
char *char_buf = charalloc(mb_cur_max());
|
||||
char onechar[MAXCHARLEN];
|
||||
int char_len;
|
||||
size_t current_len = strlen(openfile->current->data);
|
||||
size_t i = 0;
|
||||
@@ -1832,7 +1830,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
output[i] = '\n';
|
||||
|
||||
/* Get the next multibyte character. */
|
||||
char_len = parse_mbchar(output + i, char_buf, NULL);
|
||||
char_len = parse_mbchar(output + i, onechar, NULL);
|
||||
|
||||
i += char_len;
|
||||
|
||||
@@ -1853,7 +1851,7 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
charmove(openfile->current->data + openfile->current_x + char_len,
|
||||
openfile->current->data + openfile->current_x,
|
||||
current_len - openfile->current_x + 1);
|
||||
strncpy(openfile->current->data + openfile->current_x, char_buf,
|
||||
strncpy(openfile->current->data + openfile->current_x, onechar,
|
||||
char_len);
|
||||
current_len += char_len;
|
||||
openfile->totsize++;
|
||||
@@ -1893,8 +1891,6 @@ void do_output(char *output, size_t output_len, bool allow_cntrls)
|
||||
refresh_needed = TRUE;
|
||||
#endif
|
||||
|
||||
free(char_buf);
|
||||
|
||||
openfile->placewewant = xplustabs();
|
||||
|
||||
#ifndef DISABLE_COLOR
|
||||
@@ -2000,18 +1996,14 @@ int main(int argc, char **argv)
|
||||
tcgetattr(0, &oldterm);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
{
|
||||
/* If the locale set exists and uses UTF-8, we should use
|
||||
* UTF-8. */
|
||||
char *locale = setlocale(LC_ALL, "");
|
||||
|
||||
if (locale != NULL && (strcmp(nl_langinfo(CODESET),
|
||||
"UTF-8") == 0)) {
|
||||
/* If setting the locale is successful and it uses UTF-8, we need
|
||||
* to use the multibyte functions for text processing. */
|
||||
if (setlocale(LC_ALL, "") != NULL &&
|
||||
strcmp(nl_langinfo(CODESET), "UTF-8") == 0) {
|
||||
#ifdef USE_SLANG
|
||||
SLutf8_enable(1);
|
||||
SLutf8_enable(1);
|
||||
#endif
|
||||
utf8_init();
|
||||
}
|
||||
utf8_init();
|
||||
}
|
||||
#else
|
||||
setlocale(LC_ALL, "");
|
||||
@@ -2022,6 +2014,10 @@ int main(int argc, char **argv)
|
||||
textdomain(PACKAGE);
|
||||
#endif
|
||||
|
||||
if (MB_CUR_MAX > MAXCHARLEN)
|
||||
fprintf(stderr, "Unexpected large character size: %i bytes"
|
||||
" -- please report a bug\n", (int)MB_CUR_MAX);
|
||||
|
||||
#if defined(DISABLE_NANORC) && defined(DISABLE_ROOTWRAPPING)
|
||||
/* If we don't have rcfile support, --disable-wrapping-as-root is
|
||||
* used, and we're root, turn wrapping off. */
|
||||
@@ -2516,12 +2512,18 @@ int main(int argc, char **argv)
|
||||
controlright = get_keycode("kRIT5", CONTROL_RIGHT);
|
||||
controlup = get_keycode("kUP5", CONTROL_UP);
|
||||
controldown = get_keycode("kDN5", CONTROL_DOWN);
|
||||
/* Ask for the codes for Control+Home/End. */
|
||||
controlhome = get_keycode("kHOM5", CONTROL_HOME);
|
||||
controlend = get_keycode("kEND5", CONTROL_END);
|
||||
#ifndef NANO_TINY
|
||||
/* Ask for the codes for Shift+Control+Left/Right/Up/Down. */
|
||||
shiftcontrolleft = get_keycode("kLFT6", SHIFT_CONTROL_LEFT);
|
||||
shiftcontrolright = get_keycode("kRIT6", SHIFT_CONTROL_RIGHT);
|
||||
shiftcontrolup = get_keycode("kUP6", SHIFT_CONTROL_UP);
|
||||
shiftcontroldown = get_keycode("kDN6", SHIFT_CONTROL_DOWN);
|
||||
/* Ask for the codes for Shift+Control+Home/End. */
|
||||
shiftcontrolhome = get_keycode("kHOM6", SHIFT_CONTROL_HOME);
|
||||
shiftcontrolend = get_keycode("kEND6", SHIFT_CONTROL_END);
|
||||
/* Ask for the codes for Shift+Alt+Left/Right/Up/Down. */
|
||||
shiftaltleft = get_keycode("kLFT4", SHIFT_ALT_LEFT);
|
||||
shiftaltright = get_keycode("kRIT4", SHIFT_ALT_RIGHT);
|
||||
|
||||
14
src/nano.h
14
src/nano.h
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* nano.h -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -68,6 +67,13 @@
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
#define charset(dest, src, n) memset(dest, src, (n) * sizeof(char))
|
||||
|
||||
/* In UTF-8 a character is at most six bytes long. */
|
||||
#ifdef ENABLE_UTF8
|
||||
#define MAXCHARLEN 6
|
||||
#else
|
||||
#define MAXCHARLEN 1
|
||||
#endif
|
||||
|
||||
/* Set a default value for PATH_MAX if there isn't one. */
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX 4096
|
||||
@@ -546,10 +552,14 @@ enum
|
||||
#define CONTROL_RIGHT 0x402
|
||||
#define CONTROL_UP 0x403
|
||||
#define CONTROL_DOWN 0x404
|
||||
#define CONTROL_HOME 0x411
|
||||
#define CONTROL_END 0x412
|
||||
#define SHIFT_CONTROL_LEFT 0x405
|
||||
#define SHIFT_CONTROL_RIGHT 0x406
|
||||
#define SHIFT_CONTROL_UP 0x407
|
||||
#define SHIFT_CONTROL_DOWN 0x408
|
||||
#define SHIFT_CONTROL_HOME 0x413
|
||||
#define SHIFT_CONTROL_END 0x414
|
||||
#define SHIFT_ALT_LEFT 0x409
|
||||
#define SHIFT_ALT_RIGHT 0x40a
|
||||
#define SHIFT_ALT_UP 0x40b
|
||||
|
||||
14
src/prompt.c
14
src/prompt.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* prompt.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -197,7 +196,7 @@ void do_statusbar_output(int *the_input, size_t input_len,
|
||||
bool filtering)
|
||||
{
|
||||
char *output = charalloc(input_len + 1);
|
||||
char *char_buf = charalloc(mb_cur_max());
|
||||
char onechar[MAXCHARLEN];
|
||||
int i, char_len;
|
||||
|
||||
/* Copy the typed stuff so it can be treated. */
|
||||
@@ -213,7 +212,7 @@ void do_statusbar_output(int *the_input, size_t input_len,
|
||||
output[i] = '\n';
|
||||
|
||||
/* Interpret the next multibyte character. */
|
||||
char_len = parse_mbchar(output + i, char_buf, NULL);
|
||||
char_len = parse_mbchar(output + i, onechar, NULL);
|
||||
|
||||
i += char_len;
|
||||
|
||||
@@ -225,12 +224,11 @@ void do_statusbar_output(int *the_input, size_t input_len,
|
||||
answer = charealloc(answer, strlen(answer) + char_len + 1);
|
||||
charmove(answer + statusbar_x + char_len, answer + statusbar_x,
|
||||
strlen(answer) - statusbar_x + 1);
|
||||
strncpy(answer + statusbar_x, char_buf, char_len);
|
||||
strncpy(answer + statusbar_x, onechar, char_len);
|
||||
|
||||
statusbar_x += char_len;
|
||||
}
|
||||
|
||||
free(char_buf);
|
||||
free(output);
|
||||
|
||||
update_the_statusbar();
|
||||
@@ -632,9 +630,9 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
#ifndef NANO_TINY
|
||||
redo_theprompt:
|
||||
#endif
|
||||
prompt = charalloc((COLS * mb_cur_max()) + 1);
|
||||
prompt = charalloc((COLS * MAXCHARLEN) + 1);
|
||||
va_start(ap, msg);
|
||||
vsnprintf(prompt, COLS * mb_cur_max(), msg, ap);
|
||||
vsnprintf(prompt, COLS * MAXCHARLEN, msg, ap);
|
||||
va_end(ap);
|
||||
/* Reserve five columns for colon plus angles plus answer, ":<aa>". */
|
||||
prompt[actual_x(prompt, (COLS < 5) ? 0 : COLS - 5)] = '\0';
|
||||
|
||||
87
src/proto.h
87
src/proto.h
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* proto.h -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU General Public License as published *
|
||||
@@ -51,11 +50,15 @@ extern int controlleft;
|
||||
extern int controlright;
|
||||
extern int controlup;
|
||||
extern int controldown;
|
||||
extern int controlhome;
|
||||
extern int controlend;
|
||||
#ifndef NANO_TINY
|
||||
extern int shiftcontrolleft;
|
||||
extern int shiftcontrolright;
|
||||
extern int shiftcontrolup;
|
||||
extern int shiftcontroldown;
|
||||
extern int shiftcontrolhome;
|
||||
extern int shiftcontrolend;
|
||||
extern int shiftaltleft;
|
||||
extern int shiftaltright;
|
||||
extern int shiftaltup;
|
||||
@@ -162,17 +165,13 @@ extern char *homedir;
|
||||
|
||||
typedef void (*functionptrtype)(void);
|
||||
|
||||
/* All functions in browser.c. */
|
||||
/* Most functions in browser.c. */
|
||||
#ifndef DISABLE_BROWSER
|
||||
char *do_browser(char *path);
|
||||
char *do_browse_from(const char *inpath);
|
||||
void read_the_list(const char *path, DIR *dir);
|
||||
functionptrtype parse_browser_input(int *kbinput);
|
||||
void browser_refresh(void);
|
||||
void browser_select_dirname(const char *needle);
|
||||
int filesearch_init(void);
|
||||
void findnextfile(const char *needle);
|
||||
void filesearch_abort(void);
|
||||
void do_filesearch(void);
|
||||
void do_fileresearch(void);
|
||||
void do_first_file(void);
|
||||
@@ -188,18 +187,13 @@ bool using_utf8(void);
|
||||
char *addstrings(char* str1, size_t len1, char* str2, size_t len2);
|
||||
bool is_byte(int c);
|
||||
bool is_alpha_mbchar(const char *c);
|
||||
bool is_alnum_mbchar(const char *c);
|
||||
bool is_blank_mbchar(const char *c);
|
||||
bool is_ascii_cntrl_char(int c);
|
||||
bool is_cntrl_char(int c);
|
||||
bool is_cntrl_mbchar(const char *c);
|
||||
bool is_punct_mbchar(const char *c);
|
||||
bool is_word_mbchar(const char *c, bool allow_punct);
|
||||
char control_rep(const signed char c);
|
||||
char control_mbrep(const char *c, bool isdata);
|
||||
int length_of_char(const char *c, int *width);
|
||||
int mbwidth(const char *c);
|
||||
int mb_cur_max(void);
|
||||
char *make_mbchar(long chr, int *chr_mb_len);
|
||||
int parse_mbchar(const char *buf, char *chr, size_t *col);
|
||||
size_t move_mbleft(const char *buf, size_t pos);
|
||||
@@ -209,8 +203,6 @@ int mbstrncasecmp(const char *s1, const char *s2, size_t n);
|
||||
char *mbstrcasestr(const char *haystack, const char *needle);
|
||||
char *revstrstr(const char *haystack, const char *needle,
|
||||
const char *pointer);
|
||||
char *revstrcasestr(const char *haystack, const char *needle, const char
|
||||
*rev_start);
|
||||
char *mbrevstrcasestr(const char *haystack, const char *needle, const
|
||||
char *rev_start);
|
||||
size_t mbstrlen(const char *s);
|
||||
@@ -226,7 +218,6 @@ char *mbrevstrpbrk(const char *s, const char *accept, const char
|
||||
*rev_start);
|
||||
#endif
|
||||
#if !defined(DISABLE_NANORC) && (!defined(NANO_TINY) || !defined(DISABLE_JUSTIFY))
|
||||
bool has_blank_chars(const char *s);
|
||||
bool has_blank_mbchars(const char *s);
|
||||
#endif
|
||||
#ifdef ENABLE_UTF8
|
||||
@@ -246,14 +237,11 @@ void alloc_multidata_if_needed(filestruct *fileptr);
|
||||
void precalc_multicolorinfo(void);
|
||||
#endif
|
||||
|
||||
/* All functions in cut.c. */
|
||||
/* Most functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
bool keeping_cutbuffer(void);
|
||||
void cut_line(void);
|
||||
#ifndef NANO_TINY
|
||||
void cut_marked(bool *right_side_up);
|
||||
void cut_to_eol(void);
|
||||
void cut_to_eof(void);
|
||||
#endif
|
||||
void do_cut_text(bool copy_text, bool cut_till_eof);
|
||||
void do_cut_text_void(void);
|
||||
@@ -264,7 +252,6 @@ void do_cut_till_eof(void);
|
||||
void do_uncut_text(void);
|
||||
|
||||
/* Most functions in files.c. */
|
||||
void make_new_buffer(void);
|
||||
void initialize_buffer_text(void);
|
||||
bool open_buffer(const char *filename, bool undoable);
|
||||
#ifndef DISABLE_SPELLER
|
||||
@@ -280,14 +267,12 @@ void switch_to_prev_buffer_void(void);
|
||||
void switch_to_next_buffer_void(void);
|
||||
bool close_buffer(void);
|
||||
#endif
|
||||
char *encode_data(char *buf, size_t buf_len);
|
||||
void read_file(FILE *f, int fd, const char *filename, bool undoable,
|
||||
bool checkwritable);
|
||||
int open_file(const char *filename, bool newfie, bool quiet, FILE **f);
|
||||
char *get_next_filename(const char *name, const char *suffix);
|
||||
void do_insertfile_void(void);
|
||||
char *get_full_path(const char *origpath);
|
||||
char *check_writable_directory(const char *path);
|
||||
char *safe_tempfile(FILE **f);
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
void init_operating_dir(void);
|
||||
@@ -298,7 +283,7 @@ void init_backup_dir(void);
|
||||
int delete_lockfile(const char *lockfilename);
|
||||
int write_lockfile(const char *lockfilename, const char *origfilename, bool modified);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out);
|
||||
int copy_file(FILE *inn, FILE *out, bool close_out);
|
||||
bool write_file(const char *name, FILE *f_open, bool tmp,
|
||||
kind_of_writing_type method, bool nonamechange);
|
||||
#ifndef NANO_TINY
|
||||
@@ -316,19 +301,12 @@ int diralphasort(const void *va, const void *vb);
|
||||
void free_chararray(char **array, size_t len);
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
bool is_dir(const char *buf);
|
||||
char **username_tab_completion(const char *buf, size_t *num_matches,
|
||||
size_t buf_len);
|
||||
char **cwd_tab_completion(const char *buf, bool allow_files, size_t
|
||||
*num_matches, size_t buf_len);
|
||||
char *input_tab(char *buf, bool allow_files, size_t *place,
|
||||
bool *lastwastab, void (*refresh_func)(void), bool *listed);
|
||||
#endif
|
||||
const char *tail(const char *path);
|
||||
#ifndef DISABLE_HISTORIES
|
||||
char *histfilename(void);
|
||||
void load_history(void);
|
||||
bool writehist(FILE *hist, const filestruct *head);
|
||||
void save_history(void);
|
||||
int check_dotnano(void);
|
||||
void load_poshistory(void);
|
||||
@@ -398,9 +376,8 @@ void do_scroll_down(void);
|
||||
void do_left(void);
|
||||
void do_right(void);
|
||||
|
||||
/* All functions in nano.c. */
|
||||
/* Most functions in nano.c. */
|
||||
filestruct *make_new_node(filestruct *prevnode);
|
||||
filestruct *copy_node(const filestruct *src);
|
||||
void splice_node(filestruct *afterthis, filestruct *newnode);
|
||||
void unlink_node(filestruct *fileptr);
|
||||
void delete_node(filestruct *fileptr);
|
||||
@@ -426,17 +403,8 @@ void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename, struct stat *die_stat);
|
||||
void window_init(void);
|
||||
#ifndef DISABLE_MOUSE
|
||||
void disable_mouse_support(void);
|
||||
void enable_mouse_support(void);
|
||||
void mouse_init(void);
|
||||
#endif
|
||||
void print_opt(const char *shortflag, const char *longflag, const char *desc);
|
||||
void usage(void);
|
||||
void version(void);
|
||||
void do_exit(void);
|
||||
void close_and_go(void);
|
||||
void signal_init(void);
|
||||
RETSIGTYPE handle_hupterm(int signal);
|
||||
RETSIGTYPE do_suspend(int signal);
|
||||
RETSIGTYPE do_continue(int signal);
|
||||
@@ -479,7 +447,6 @@ void do_statusbar_verbatim_input(void);
|
||||
size_t statusbar_xplustabs(void);
|
||||
size_t get_statusbar_page_start(size_t start_col, size_t column);
|
||||
void reinit_statusbar_x(void);
|
||||
void reset_statusbar_cursor(void);
|
||||
void update_the_statusbar(void);
|
||||
int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int menu, const char *curranswer,
|
||||
@@ -490,9 +457,6 @@ int do_prompt(bool allow_tabs, bool allow_files,
|
||||
int do_yesno_prompt(bool all, const char *msg);
|
||||
|
||||
/* Most functions in rcfile.c. */
|
||||
#if !defined(DISABLE_NANORC) || !defined(DISABLE_HISTORIES)
|
||||
char *parse_next_word(char *ptr);
|
||||
#endif
|
||||
#ifndef DISABLE_NANORC
|
||||
#ifndef DISABLE_COLOR
|
||||
bool parse_color_names(char *combostr, short *fg, short *bg, bool *bright);
|
||||
@@ -502,12 +466,9 @@ void parse_rcfile(FILE *rcstream, bool syntax_only);
|
||||
void do_rcfiles(void);
|
||||
#endif /* !DISABLE_NANORC */
|
||||
|
||||
/* All functions in search.c. */
|
||||
bool regexp_init(const char *regexp);
|
||||
void regexp_cleanup(void);
|
||||
/* Most functions in search.c. */
|
||||
void not_found_msg(const char *str);
|
||||
void search_replace_abort(void);
|
||||
int search_init(bool replacing, bool use_answer);
|
||||
int findnextstr(const char *needle, bool whole_word_only, bool have_region,
|
||||
size_t *match_len, bool skipone, const filestruct *begin, size_t begin_x);
|
||||
void do_search(void);
|
||||
@@ -517,8 +478,6 @@ void do_findnext(void);
|
||||
#endif
|
||||
void do_research(void);
|
||||
void go_looking(void);
|
||||
int replace_regexp(char *string, bool create);
|
||||
char *replace_line(const char *needle);
|
||||
ssize_t do_replace_loop(const char *needle, bool whole_word_only,
|
||||
const filestruct *real_current, size_t *real_current_x);
|
||||
void do_replace(void);
|
||||
@@ -527,7 +486,6 @@ void do_gotolinecolumn(ssize_t line, ssize_t column, bool use_answer,
|
||||
bool interactive);
|
||||
void do_gotolinecolumn_void(void);
|
||||
#ifndef NANO_TINY
|
||||
bool find_bracket_match(bool reverse, const char *bracket_set);
|
||||
void do_find_bracket(void);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
char *get_history_completion(filestruct **h, char *s, size_t len);
|
||||
@@ -537,8 +495,6 @@ char *get_history_completion(filestruct **h, char *s, size_t len);
|
||||
bool history_has_changed(void);
|
||||
void history_init(void);
|
||||
void history_reset(const filestruct *h);
|
||||
filestruct *find_history(const filestruct *h_start, const filestruct
|
||||
*h_end, const char *s, size_t len);
|
||||
void update_history(filestruct **h, const char *s);
|
||||
char *get_history_older(filestruct **h);
|
||||
char *get_history_newer(filestruct **h);
|
||||
@@ -546,7 +502,7 @@ void get_history_older_void(void);
|
||||
void get_history_newer_void(void);
|
||||
#endif
|
||||
|
||||
/* All functions in text.c. */
|
||||
/* Most functions in text.c. */
|
||||
#ifndef NANO_TINY
|
||||
void do_mark(void);
|
||||
#endif
|
||||
@@ -592,23 +548,13 @@ size_t indent_length(const char *line);
|
||||
#endif
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
void justify_format(filestruct *paragraph, size_t skip);
|
||||
size_t quote_length(const char *line);
|
||||
bool quotes_match(const char *a_line, size_t a_quote, const char
|
||||
*b_line);
|
||||
bool indents_match(const char *a_line, size_t a_indent, const char
|
||||
*b_line, size_t b_indent);
|
||||
bool begpar(const filestruct *const foo);
|
||||
bool inpar(const filestruct *const foo);
|
||||
void backup_lines(filestruct *first_line, size_t par_len);
|
||||
bool find_paragraph(size_t *const quote, size_t *const par);
|
||||
void do_justify(bool full_justify);
|
||||
void do_justify_void(void);
|
||||
void do_full_justify(void);
|
||||
#endif
|
||||
#ifndef DISABLE_SPELLER
|
||||
bool do_int_spell_fix(const char *word);
|
||||
const char *do_int_speller(const char *tempfile_name);
|
||||
const char *do_alt_speller(char *tempfile_name);
|
||||
void do_spell(void);
|
||||
#endif
|
||||
#ifndef DISABLE_COLOR
|
||||
@@ -667,20 +613,13 @@ void dump_filestruct_reverse(void);
|
||||
/* Most functions in winio.c. */
|
||||
void get_key_buffer(WINDOW *win);
|
||||
size_t get_key_buffer_len(void);
|
||||
void unget_input(int *input, size_t input_len);
|
||||
void unget_kbinput(int kbinput, bool metakey);
|
||||
int *get_input(WINDOW *win, size_t input_len);
|
||||
int get_kbinput(WINDOW *win);
|
||||
int parse_kbinput(WINDOW *win);
|
||||
int arrow_from_abcd(int kbinput);
|
||||
int parse_escape_sequence(WINDOW *win, int kbinput);
|
||||
int get_byte_kbinput(int kbinput);
|
||||
#ifdef ENABLE_UTF8
|
||||
long add_unicode_digit(int kbinput, long factor, long *uni);
|
||||
long get_unicode_kbinput(WINDOW *win, int kbinput);
|
||||
#endif
|
||||
int get_control_kbinput(int kbinput);
|
||||
void unparse_kbinput(char *output, size_t output_len);
|
||||
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len);
|
||||
int *parse_verbatim_kbinput(WINDOW *win, size_t *count);
|
||||
#ifndef DISABLE_MOUSE
|
||||
@@ -688,7 +627,6 @@ int get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
||||
#endif
|
||||
const sc *get_shortcut(int *kbinput);
|
||||
void blank_row(WINDOW *win, int y, int x, int n);
|
||||
void blank_titlebar(void);
|
||||
void blank_edit(void);
|
||||
void blank_statusbar(void);
|
||||
void blank_bottombars(void);
|
||||
@@ -715,9 +653,6 @@ int go_forward_chunks(int nrows, filestruct **line, size_t *leftedge);
|
||||
bool less_than_a_screenful(size_t was_lineno, size_t was_leftedge);
|
||||
void edit_scroll(scroll_dir direction, int nrows);
|
||||
void ensure_firstcolumn_is_aligned(void);
|
||||
bool current_is_above_screen(void);
|
||||
bool current_is_below_screen(void);
|
||||
bool current_is_offscreen(void);
|
||||
void edit_redraw(filestruct *old_current);
|
||||
void edit_refresh(void);
|
||||
void adjust_viewport(update_type location);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* rcfile.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, *
|
||||
* 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2001-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014 Mike Frysinger *
|
||||
* Copyright (C) 2014, 2015, 2016 Benno Schulenberg *
|
||||
* *
|
||||
|
||||
19
src/search.c
19
src/search.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* search.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2015, 2016, 2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -994,7 +993,7 @@ void do_find_bracket(void)
|
||||
* the bracket at the current cursor position. */
|
||||
int wanted_ch_len;
|
||||
/* The length of wanted_ch in bytes. */
|
||||
char *bracket_set;
|
||||
char bracket_set[MAXCHARLEN * 2 + 1];
|
||||
/* The pair of characters in ch and wanted_ch. */
|
||||
size_t i;
|
||||
/* Generic loop variable. */
|
||||
@@ -1008,8 +1007,6 @@ void do_find_bracket(void)
|
||||
/* The initial bracket count. */
|
||||
bool reverse;
|
||||
/* The direction we search. */
|
||||
char *found_ch;
|
||||
/* The character we find. */
|
||||
|
||||
assert(mbstrlen(matchbrackets) % 2 == 0);
|
||||
|
||||
@@ -1057,20 +1054,16 @@ void do_find_bracket(void)
|
||||
wanted_ch_len = parse_mbchar(wanted_ch, NULL, NULL);
|
||||
|
||||
/* Fill bracket_set in with the values of ch and wanted_ch. */
|
||||
bracket_set = charalloc((mb_cur_max() * 2) + 1);
|
||||
strncpy(bracket_set, ch, ch_len);
|
||||
strncpy(bracket_set + ch_len, wanted_ch, wanted_ch_len);
|
||||
bracket_set[ch_len + wanted_ch_len] = '\0';
|
||||
|
||||
found_ch = charalloc(mb_cur_max() + 1);
|
||||
|
||||
while (TRUE) {
|
||||
if (find_bracket_match(reverse, bracket_set)) {
|
||||
/* If we found an identical bracket, increment count. If we
|
||||
* found a complementary bracket, decrement it. */
|
||||
parse_mbchar(openfile->current->data + openfile->current_x,
|
||||
found_ch, NULL);
|
||||
count += (strncmp(found_ch, ch, ch_len) == 0) ? 1 : -1;
|
||||
count += (strncmp(openfile->current->data + openfile->current_x,
|
||||
ch, ch_len) == 0) ? 1 : -1;
|
||||
|
||||
/* If count is zero, we've found a matching bracket. Update
|
||||
* the screen and get out. */
|
||||
@@ -1088,10 +1081,6 @@ void do_find_bracket(void)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Clean up. */
|
||||
free(bracket_set);
|
||||
free(found_ch);
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
|
||||
|
||||
85
src/text.c
85
src/text.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* text.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015 Mark Majeres *
|
||||
* Copyright (C) 2016 Mike Scalora *
|
||||
* Copyright (C) 2015, 2016 Benno Schulenberg *
|
||||
@@ -768,11 +767,13 @@ void do_undo(void)
|
||||
break;
|
||||
}
|
||||
undidmsg = _("line break");
|
||||
size_t from_x = (u->begin == 0) ? 0 : u->mark_begin_x;
|
||||
size_t to_x = (u->begin == 0) ? u->mark_begin_x : u->begin;
|
||||
f->data = charealloc(f->data, strlen(f->data) +
|
||||
strlen(&f->next->data[u->mark_begin_x]) + 1);
|
||||
strcat(f->data, &f->next->data[u->mark_begin_x]);
|
||||
strlen(&u->strdata[from_x]) + 1);
|
||||
strcat(f->data, &u->strdata[from_x]);
|
||||
unlink_node(f->next);
|
||||
goto_line_posx(u->lineno, u->begin);
|
||||
goto_line_posx(u->lineno, to_x);
|
||||
break;
|
||||
#ifdef ENABLE_COMMENT
|
||||
case COMMENT:
|
||||
@@ -982,12 +983,11 @@ void do_enter(void)
|
||||
{
|
||||
filestruct *newnode = make_new_node(openfile->current);
|
||||
size_t extra = 0;
|
||||
bool allblanks = FALSE;
|
||||
|
||||
assert(openfile->current != NULL && openfile->current->data != NULL);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(ENTER);
|
||||
|
||||
if (ISSET(AUTOINDENT)) {
|
||||
extra = indent_length(openfile->current->data);
|
||||
|
||||
@@ -995,6 +995,8 @@ void do_enter(void)
|
||||
* indentation to the current x position. */
|
||||
if (extra > openfile->current_x)
|
||||
extra = openfile->current_x;
|
||||
else if (extra == openfile->current_x)
|
||||
allblanks = TRUE;
|
||||
}
|
||||
#endif
|
||||
newnode->data = charalloc(strlen(openfile->current->data +
|
||||
@@ -1005,13 +1007,19 @@ void do_enter(void)
|
||||
if (ISSET(AUTOINDENT)) {
|
||||
/* Copy the whitespace from the current line to the new one. */
|
||||
strncpy(newnode->data, openfile->current->data, extra);
|
||||
openfile->totsize += extra;
|
||||
/* If there were only blanks before the cursor, trim them. */
|
||||
if (allblanks)
|
||||
openfile->current_x = 0;
|
||||
else
|
||||
openfile->totsize += extra;
|
||||
}
|
||||
#endif
|
||||
|
||||
null_at(&openfile->current->data, openfile->current_x);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
add_undo(ENTER);
|
||||
|
||||
/* Adjust the mark if it was on the current line after the cursor. */
|
||||
if (openfile->mark_set && openfile->current == openfile->mark_begin &&
|
||||
openfile->current_x < openfile->mark_begin_x) {
|
||||
@@ -1221,7 +1229,7 @@ void add_undo(undo_type action)
|
||||
u->xflags = WAS_FINAL_BACKSPACE;
|
||||
case DEL:
|
||||
if (openfile->current->data[openfile->current_x] != '\0') {
|
||||
char *char_buf = charalloc(mb_cur_max() + 1);
|
||||
char *char_buf = charalloc(MAXCHARLEN + 1);
|
||||
int char_len = parse_mbchar(&openfile->current->data[u->begin],
|
||||
char_buf, NULL);
|
||||
char_buf[char_len] = '\0';
|
||||
@@ -1354,7 +1362,7 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
|
||||
fprintf(stderr, " >> openfile->current->data = \"%s\", current_x = %lu, u->begin = %lu\n",
|
||||
openfile->current->data, (unsigned long)openfile->current_x, (unsigned long)u->begin);
|
||||
#endif
|
||||
char *char_buf = charalloc(mb_cur_max());
|
||||
char *char_buf = charalloc(MAXCHARLEN);
|
||||
int char_len = parse_mbchar(&openfile->current->data[u->mark_begin_x], char_buf, NULL);
|
||||
u->strdata = addstrings(u->strdata, u->strdata ? strlen(u->strdata) : 0, char_buf, char_len);
|
||||
#ifdef DEBUG
|
||||
@@ -1366,7 +1374,7 @@ fprintf(stderr, " >> Updating... action = %d, openfile->last_action = %d, openf
|
||||
}
|
||||
case BACK:
|
||||
case DEL: {
|
||||
char *char_buf = charalloc(mb_cur_max());
|
||||
char *char_buf = charalloc(MAXCHARLEN);
|
||||
int char_len = parse_mbchar(&openfile->current->data[openfile->current_x], char_buf, NULL);
|
||||
if (openfile->current_x == u->begin) {
|
||||
/* They deleted more: add removed character after earlier stuff. */
|
||||
@@ -1682,25 +1690,19 @@ ssize_t break_line(const char *line, ssize_t goal, bool snap_at_nl)
|
||||
size_t indent_length(const char *line)
|
||||
{
|
||||
size_t len = 0;
|
||||
char *blank_mb;
|
||||
int blank_mb_len;
|
||||
|
||||
assert(line != NULL);
|
||||
|
||||
blank_mb = charalloc(mb_cur_max());
|
||||
char onechar[MAXCHARLEN];
|
||||
int charlen;
|
||||
|
||||
while (*line != '\0') {
|
||||
blank_mb_len = parse_mbchar(line, blank_mb, NULL);
|
||||
charlen = parse_mbchar(line, onechar, NULL);
|
||||
|
||||
if (!is_blank_mbchar(blank_mb))
|
||||
if (!is_blank_mbchar(onechar))
|
||||
break;
|
||||
|
||||
line += blank_mb_len;
|
||||
len += blank_mb_len;
|
||||
line += charlen;
|
||||
len += charlen;
|
||||
}
|
||||
|
||||
free(blank_mb);
|
||||
|
||||
return len;
|
||||
}
|
||||
#endif /* !NANO_TINY || !DISABLE_JUSTIFY */
|
||||
@@ -3265,23 +3267,48 @@ void do_linter(void)
|
||||
SET(MULTIBUFFER);
|
||||
open_buffer(curlint->filename, FALSE);
|
||||
} else {
|
||||
char *dontwantfile = curlint->filename;
|
||||
char *dontwantfile = mallocstrcpy(NULL, curlint->filename);
|
||||
lintstruct *restlint = NULL;
|
||||
|
||||
while (curlint != NULL && !strcmp(curlint->filename, dontwantfile))
|
||||
curlint = curlint->next;
|
||||
if (curlint == NULL) {
|
||||
while (curlint != NULL) {
|
||||
if (strcmp(curlint->filename, dontwantfile) == 0) {
|
||||
if (curlint == lints)
|
||||
lints = curlint->next;
|
||||
else
|
||||
curlint->prev->next = curlint->next;
|
||||
if (curlint->next != NULL)
|
||||
curlint->next->prev = curlint->prev;
|
||||
tmplint = curlint;
|
||||
curlint = curlint->next;
|
||||
free(tmplint->msg);
|
||||
free(tmplint->filename);
|
||||
free(tmplint);
|
||||
} else {
|
||||
if (restlint == NULL)
|
||||
restlint = curlint;
|
||||
curlint = curlint->next;
|
||||
}
|
||||
}
|
||||
|
||||
if (restlint == NULL) {
|
||||
statusbar(_("No more errors in unopened files, cancelling"));
|
||||
napms(2400);
|
||||
break;
|
||||
} else
|
||||
} else {
|
||||
curlint = restlint;
|
||||
goto new_lint_loop;
|
||||
}
|
||||
|
||||
free(dontwantfile);
|
||||
}
|
||||
} else
|
||||
openfile = tmpof;
|
||||
}
|
||||
}
|
||||
#endif /* !NANO_TINY */
|
||||
do_gotolinecolumn(curlint->lineno, curlint->colno, FALSE, FALSE);
|
||||
goto_line_posx(curlint->lineno, curlint->colno - 1);
|
||||
titlebar(NULL);
|
||||
adjust_viewport(CENTERING);
|
||||
edit_refresh();
|
||||
statusbar(curlint->msg);
|
||||
bottombars(MLINTER);
|
||||
|
||||
14
src/utils.c
14
src/utils.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* utils.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2016 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -215,7 +214,7 @@ const char *fixbounds(const char *r)
|
||||
* a separate word? That is: is it not part of a longer word?*/
|
||||
bool is_separate_word(size_t position, size_t length, const char *buf)
|
||||
{
|
||||
char before[mb_cur_max()], after[mb_cur_max()];
|
||||
char before[MAXCHARLEN], after[MAXCHARLEN];
|
||||
size_t word_end = position + length;
|
||||
|
||||
/* Get the characters before and after the word, if any. */
|
||||
@@ -393,10 +392,10 @@ size_t xplustabs(void)
|
||||
* not overshoot the given column. */
|
||||
size_t actual_x(const char *text, size_t column)
|
||||
{
|
||||
size_t index = 0;
|
||||
/* The index in text, returned. */
|
||||
const char *start = text;
|
||||
/* From where we start walking through the text. */
|
||||
size_t width = 0;
|
||||
/* The screen display width to text[index], in columns. */
|
||||
/* The current accumulated span, in columns. */
|
||||
|
||||
while (*text != '\0') {
|
||||
int charlen = parse_mbchar(text, NULL, &width);
|
||||
@@ -404,11 +403,10 @@ size_t actual_x(const char *text, size_t column)
|
||||
if (width > column)
|
||||
break;
|
||||
|
||||
index += charlen;
|
||||
text += charlen;
|
||||
}
|
||||
|
||||
return index;
|
||||
return (text - start);
|
||||
}
|
||||
|
||||
/* A strnlen() with tabs and multicolumn characters factored in:
|
||||
|
||||
107
src/winio.c
107
src/winio.c
@@ -1,8 +1,7 @@
|
||||
/**************************************************************************
|
||||
* winio.c -- This file is part of GNU nano. *
|
||||
* *
|
||||
* Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, *
|
||||
* 2008, 2009, 2010, 2011, 2013, 2014 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 1999-2011, 2013-2017 Free Software Foundation, Inc. *
|
||||
* Copyright (C) 2014, 2015, 2016, 2017 Benno Schulenberg *
|
||||
* *
|
||||
* GNU nano is free software: you can redistribute it and/or modify *
|
||||
@@ -505,6 +504,10 @@ int parse_kbinput(WINDOW *win)
|
||||
return CONTROL_UP;
|
||||
else if (retval == controldown)
|
||||
return CONTROL_DOWN;
|
||||
else if (retval == controlhome)
|
||||
return CONTROL_HOME;
|
||||
else if (retval == controlend)
|
||||
return CONTROL_END;
|
||||
#ifndef NANO_TINY
|
||||
else if (retval == shiftcontrolleft) {
|
||||
shift_held = TRUE;
|
||||
@@ -518,6 +521,12 @@ int parse_kbinput(WINDOW *win)
|
||||
} else if (retval == shiftcontroldown) {
|
||||
shift_held = TRUE;
|
||||
return CONTROL_DOWN;
|
||||
} else if (retval == shiftcontrolhome) {
|
||||
shift_held = TRUE;
|
||||
return CONTROL_HOME;
|
||||
} else if (retval == shiftcontrolend) {
|
||||
shift_held = TRUE;
|
||||
return CONTROL_END;
|
||||
} else if (retval == shiftaltleft) {
|
||||
shift_held = TRUE;
|
||||
return KEY_HOME;
|
||||
@@ -554,6 +563,10 @@ int parse_kbinput(WINDOW *win)
|
||||
return CONTROL_LEFT;
|
||||
else if (retval == KEY_RIGHT)
|
||||
return CONTROL_RIGHT;
|
||||
else if (retval == KEY_HOME)
|
||||
return CONTROL_HOME;
|
||||
else if (retval == KEY_END)
|
||||
return CONTROL_END;
|
||||
}
|
||||
#ifndef NANO_TINY
|
||||
/* Are both Shift and Alt being held? */
|
||||
@@ -953,6 +966,10 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
return CONTROL_RIGHT;
|
||||
case 'D': /* Esc [ 1 ; 5 D == Ctrl-Left on xterm. */
|
||||
return CONTROL_LEFT;
|
||||
case 'F': /* Esc [ 1 ; 5 F == Ctrl-End on xterm. */
|
||||
return CONTROL_END;
|
||||
case 'H': /* Esc [ 1 ; 5 H == Ctrl-Home on xterm. */
|
||||
return CONTROL_HOME;
|
||||
}
|
||||
break;
|
||||
#ifndef NANO_TINY
|
||||
@@ -966,6 +983,10 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
return shiftcontrolright;
|
||||
case 'D': /* Esc [ 1 ; 6 D == Shift-Ctrl-Left on xterm. */
|
||||
return shiftcontrolleft;
|
||||
case 'F': /* Esc [ 1 ; 6 F == Shift-Ctrl-End on xterm. */
|
||||
return shiftcontrolend;
|
||||
case 'H': /* Esc [ 1 ; 6 H == Shift-Ctrl-Home on xterm. */
|
||||
return shiftcontrolhome;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@@ -1030,19 +1051,35 @@ int convert_sequence(const int *seq, size_t seq_len)
|
||||
if (seq_len > 2 && (seq[2] == '~' || seq[2] == '^'))
|
||||
return KEY_NPAGE;
|
||||
break;
|
||||
case '7': /* Esc [ 7 ~ == Home on Eterm/rxvt,
|
||||
* Esc [ 7 $ == Shift-Home on Eterm/rxvt. */
|
||||
case '7': /* Esc [ 7 ~ == Home on Eterm/rxvt;
|
||||
* Esc [ 7 $ == Shift-Home on Eterm/rxvt;
|
||||
* Esc [ 7 ^ == Control-Home on Eterm/rxvt;
|
||||
* Esc [ 7 @ == Shift-Control-Home on same. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
return KEY_HOME;
|
||||
else if (seq_len > 2 && seq[2] == '$')
|
||||
return SHIFT_HOME;
|
||||
else if (seq_len > 2 && seq[2] == '^')
|
||||
return CONTROL_HOME;
|
||||
#ifndef NANO_TINY
|
||||
else if (seq_len > 2 && seq[2] == '@')
|
||||
return shiftcontrolhome;
|
||||
#endif
|
||||
break;
|
||||
case '8': /* Esc [ 8 ~ == End on Eterm/rxvt.
|
||||
* Esc [ 8 $ == Shift-End on Eterm/rxvt. */
|
||||
case '8': /* Esc [ 8 ~ == End on Eterm/rxvt;
|
||||
* Esc [ 8 $ == Shift-End on Eterm/rxvt;
|
||||
* Esc [ 8 ^ == Control-End on Eterm/rxvt;
|
||||
* Esc [ 8 @ == Shift-Control-End on same. */
|
||||
if (seq_len > 2 && seq[2] == '~')
|
||||
return KEY_END;
|
||||
else if (seq_len > 2 && seq[2] == '$')
|
||||
return SHIFT_END;
|
||||
else if (seq_len > 2 && seq[2] == '^')
|
||||
return CONTROL_END;
|
||||
#ifndef NANO_TINY
|
||||
else if (seq_len > 2 && seq[2] == '@')
|
||||
return shiftcontrolend;
|
||||
#endif
|
||||
break;
|
||||
case '9': /* Esc [ 9 == Delete on Mach console. */
|
||||
return KEY_DC;
|
||||
@@ -1408,26 +1445,6 @@ int get_control_kbinput(int kbinput)
|
||||
return retval;
|
||||
}
|
||||
|
||||
/* Put the output-formatted characters in output back into the keystroke
|
||||
* buffer, so that they can be parsed and displayed as output again. */
|
||||
void unparse_kbinput(char *output, size_t output_len)
|
||||
{
|
||||
int *input;
|
||||
size_t i;
|
||||
|
||||
if (output_len == 0)
|
||||
return;
|
||||
|
||||
input = (int *)nmalloc(output_len * sizeof(int));
|
||||
|
||||
for (i = 0; i < output_len; i++)
|
||||
input[i] = (int)output[i];
|
||||
|
||||
unget_input(input, output_len);
|
||||
|
||||
free(input);
|
||||
}
|
||||
|
||||
/* Read in a stream of characters verbatim, and return the length of the
|
||||
* string in kbinput_len. Assume nodelay(win) is FALSE. */
|
||||
int *get_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
|
||||
@@ -1822,10 +1839,10 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
buf += start_index;
|
||||
|
||||
/* Allocate enough space for converting the relevant part of the line. */
|
||||
converted = charalloc(strlen(buf) * (mb_cur_max() + tabsize) + 1);
|
||||
converted = charalloc(strlen(buf) * (MAXCHARLEN + tabsize) + 1);
|
||||
|
||||
/* If the first character starts before the left edge, or would be
|
||||
* overwritten by a "$" token, then show spaces instead. */
|
||||
* overwritten by a "$" token, then show placeholders instead. */
|
||||
if (*buf != '\0' && *buf != '\t' && (column < start_col ||
|
||||
(column > 0 && isdata && !ISSET(SOFTWRAP)))) {
|
||||
if (is_cntrl_mbchar(buf)) {
|
||||
@@ -1842,7 +1859,8 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
start_col++;
|
||||
}
|
||||
|
||||
converted[index++] = ' ';
|
||||
/* Display the right half of a two-column character as '<'. */
|
||||
converted[index++] = '<';
|
||||
start_col++;
|
||||
|
||||
buf += parse_mbchar(buf, NULL, NULL);
|
||||
@@ -1925,10 +1943,17 @@ char *display_string(const char *buf, size_t start_col, size_t span,
|
||||
buf += charlength + 7;
|
||||
}
|
||||
|
||||
/* If there is more text than can be shown, make room for the $. */
|
||||
if (*buf != '\0' && isdata && !ISSET(SOFTWRAP))
|
||||
/* If there is more text than can be shown, make room for the $ or >. */
|
||||
if (*buf != '\0' && (start_col > beyond || (isdata && !ISSET(SOFTWRAP)))) {
|
||||
index = move_mbleft(converted, index);
|
||||
|
||||
#ifdef ENABLE_UTF8
|
||||
/* Display the left half of a two-column character as '>'. */
|
||||
if (mbwidth(converted + index) == 2)
|
||||
converted[index++] = '>';
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Null-terminate the converted string. */
|
||||
converted[index] = '\0';
|
||||
|
||||
@@ -2128,8 +2153,8 @@ void statusline(message_type importance, const char *msg, ...)
|
||||
blank_statusbar();
|
||||
|
||||
/* Construct the message out of all the arguments. */
|
||||
compound = charalloc(mb_cur_max() * (COLS + 1));
|
||||
vsnprintf(compound, mb_cur_max() * (COLS + 1), msg, ap);
|
||||
compound = charalloc(MAXCHARLEN * (COLS + 1));
|
||||
vsnprintf(compound, MAXCHARLEN * (COLS + 1), msg, ap);
|
||||
va_end(ap);
|
||||
message = display_string(compound, 0, COLS, FALSE);
|
||||
free(compound);
|
||||
@@ -2279,6 +2304,12 @@ void reset_cursor(void)
|
||||
/* Add the number of wraps in the current line before the cursor. */
|
||||
row += xpt / editwincols;
|
||||
col = xpt % editwincols;
|
||||
|
||||
/* If the cursor ought to be in column zero, nudge it there. */
|
||||
if (openfile->placewewant % editwincols == 0 && col != 0) {
|
||||
row++;
|
||||
col = 0;
|
||||
}
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
@@ -2912,10 +2943,12 @@ void edit_scroll(scroll_dir direction, int nrows)
|
||||
go_forward_chunks(editwinrows - nrows, &line, &leftedge);
|
||||
|
||||
#ifndef NANO_TINY
|
||||
/* Compensate for the earlier onscreen chunks of a softwrapped line
|
||||
* when the first blank row happens to be in the middle of that line. */
|
||||
if (ISSET(SOFTWRAP) && line != openfile->edittop)
|
||||
nrows += leftedge / editwincols;
|
||||
/* Compensate for the earlier chunks of a softwrapped line. */
|
||||
nrows += leftedge / editwincols;
|
||||
|
||||
/* Don't compensate for the chunks that are offscreen. */
|
||||
if (line == openfile->edittop)
|
||||
nrows -= openfile->firstcolumn / editwincols;
|
||||
#endif
|
||||
|
||||
/* Draw new content on the blank rows inside the scrolled region
|
||||
|
||||
Reference in New Issue
Block a user