Compare commits
213 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2c86dc6dc9 | ||
|
|
3de81bc33d | ||
|
|
3f35864b10 | ||
|
|
74d87073f0 | ||
|
|
e56d936bd4 | ||
|
|
831c640e62 | ||
|
|
b908a36d60 | ||
|
|
b75763e07e | ||
|
|
188f169e1d | ||
|
|
c0d3b20bdc | ||
|
|
42ca620e11 | ||
|
|
69a90c6b3b | ||
|
|
d7b632560c | ||
|
|
55381aa614 | ||
|
|
f6159047bc | ||
|
|
4db3d0adf7 | ||
|
|
6b769e5f5b | ||
|
|
0317c86a8a | ||
|
|
a98fd75b32 | ||
|
|
8091d334a3 | ||
|
|
9df069cc5f | ||
|
|
97b9046239 | ||
|
|
036a3d4646 | ||
|
|
4a3879f1ed | ||
|
|
56cf034a12 | ||
|
|
649b431171 | ||
|
|
bfb98f8bd4 | ||
|
|
8001e27e67 | ||
|
|
907725fde8 | ||
|
|
8781fc62cb | ||
|
|
1f1ebb85b7 | ||
|
|
e3016d90aa | ||
|
|
6299b0d752 | ||
|
|
2c31540fa9 | ||
|
|
fd9da07e6c | ||
|
|
fdd3becc1e | ||
|
|
c136f75f62 | ||
|
|
a084ad94f7 | ||
|
|
c15802f8c3 | ||
|
|
7105cf4f8e | ||
|
|
02085d7b92 | ||
|
|
50af6ea21e | ||
|
|
8ae06a86b8 | ||
|
|
29f446ec40 | ||
|
|
eb5d8383c8 | ||
|
|
00cca05ebb | ||
|
|
8c16bacbbf | ||
|
|
bde3e0e294 | ||
|
|
cb09337993 | ||
|
|
46c604a14e | ||
|
|
90e59c1a18 | ||
|
|
93eb293fbb | ||
|
|
d5402232ac | ||
|
|
0432e70850 | ||
|
|
78d644a635 | ||
|
|
1c293d2e28 | ||
|
|
31f99361b6 | ||
|
|
3d67c11473 | ||
|
|
b73c0c0b09 | ||
|
|
1539837fe0 | ||
|
|
dcc201b5b2 | ||
|
|
f643fc2149 | ||
|
|
f978f040bd | ||
|
|
8cbd4cb67f | ||
|
|
07e2589f80 | ||
|
|
be246c008b | ||
|
|
3e0c8a614d | ||
|
|
84d0d59cbb | ||
|
|
164c79883b | ||
|
|
e1ee22fba2 | ||
|
|
40bdb686aa | ||
|
|
29f03dcff9 | ||
|
|
182b2c936f | ||
|
|
6d9aa085d1 | ||
|
|
99869f54b5 | ||
|
|
4a1fc558cf | ||
|
|
1e1f572c51 | ||
|
|
4b4b608806 | ||
|
|
8381fdd83a | ||
|
|
d402e71a2f | ||
|
|
2e83a50e95 | ||
|
|
3d002ed602 | ||
|
|
add65085d6 | ||
|
|
e5e88fd9f2 | ||
|
|
85f8f46c40 | ||
|
|
687776b1a8 | ||
|
|
7a97e18667 | ||
|
|
59f5e04fa8 | ||
|
|
ace1037faf | ||
|
|
77b284af68 | ||
|
|
233f336112 | ||
|
|
d4ca9f2acb | ||
|
|
9bf486fe5d | ||
|
|
410efe9a47 | ||
|
|
1758640682 | ||
|
|
0ff01a92bc | ||
|
|
cc823ab6d6 | ||
|
|
cfa4a9c4fe | ||
|
|
e93e03e1dc | ||
|
|
c151b475e7 | ||
|
|
da952f8ded | ||
|
|
2690bafa15 | ||
|
|
e7c4168ee1 | ||
|
|
9abd1d18e4 | ||
|
|
7975408f66 | ||
|
|
c59979f067 | ||
|
|
bf1346f342 | ||
|
|
6a715b69a7 | ||
|
|
ca92becf9d | ||
|
|
2c4e34cfce | ||
|
|
d9fb3e6bde | ||
|
|
1601c28976 | ||
|
|
fe65657f6f | ||
|
|
484352241e | ||
|
|
2eb745939e | ||
|
|
3288925efb | ||
|
|
9819ed031b | ||
|
|
27fbc69ec4 | ||
|
|
53752e8f9a | ||
|
|
b802e70208 | ||
|
|
db85ac7564 | ||
|
|
cbc13a2a62 | ||
|
|
c6899cb734 | ||
|
|
2cc2a57dea | ||
|
|
381d483986 | ||
|
|
6be5339265 | ||
|
|
439fbe3e93 | ||
|
|
9cf7b28248 | ||
|
|
4b7e3c3efa | ||
|
|
fc965a4869 | ||
|
|
1f204c0204 | ||
|
|
4e8e495301 | ||
|
|
a870ca2d72 | ||
|
|
5780b24759 | ||
|
|
e53181d423 | ||
|
|
646bf9111c | ||
|
|
49d5c1bf1c | ||
|
|
731e7f28e7 | ||
|
|
1929982ec3 | ||
|
|
b6377c9d14 | ||
|
|
b112fe627d | ||
|
|
d93ee682c0 | ||
|
|
3497666a21 | ||
|
|
491cad3e5d | ||
|
|
f3b10e8e05 | ||
|
|
6b1c2adc86 | ||
|
|
7cfea8bb8c | ||
|
|
28caf14863 | ||
|
|
211dc82738 | ||
|
|
b6d97c15ac | ||
|
|
487149e713 | ||
|
|
045883aa34 | ||
|
|
056c5ef4a6 | ||
|
|
b49daec3f2 | ||
|
|
4dd723a095 | ||
|
|
d532f197b0 | ||
|
|
e663dcd6aa | ||
|
|
4c9e8f4211 | ||
|
|
77e02a3e74 | ||
|
|
951d7148d1 | ||
|
|
f1c395da79 | ||
|
|
3e189a8b9c | ||
|
|
7c1f17ab6d | ||
|
|
360191c434 | ||
|
|
ca744153fd | ||
|
|
be908f6992 | ||
|
|
e5d8f32834 | ||
|
|
47e82b1752 | ||
|
|
04a8d1c040 | ||
|
|
03225330dc | ||
|
|
25884f3bdb | ||
|
|
9bab9ff5b4 | ||
|
|
670a56c241 | ||
|
|
9b6e476a46 | ||
|
|
1e7297116b | ||
|
|
b77ec62cde | ||
|
|
45f971d69b | ||
|
|
eb16f43cf9 | ||
|
|
72d8e54f6e | ||
|
|
09b34ed34e | ||
|
|
f3ca80e11d | ||
|
|
013344c4c5 | ||
|
|
d08348b99c | ||
|
|
e6ef8b9bb9 | ||
|
|
807657b0fe | ||
|
|
f887298c6e | ||
|
|
db6015c7d7 | ||
|
|
fd73c462f4 | ||
|
|
12d5b2f6bd | ||
|
|
c7ca28a6ba | ||
|
|
6ccf0e2386 | ||
|
|
1a5c4c691c | ||
|
|
02517e0a0f | ||
|
|
8bf08097ee | ||
|
|
1fabded68f | ||
|
|
30d82b787d | ||
|
|
cc79a9ae96 | ||
|
|
66e19ba5f3 | ||
|
|
2a60ea8fe3 | ||
|
|
4aece064db | ||
|
|
6da969e44b | ||
|
|
146bb6026a | ||
|
|
c510042bcd | ||
|
|
50c7f2de2f | ||
|
|
0c4c58e457 | ||
|
|
20b83508f4 | ||
|
|
d1322107a5 | ||
|
|
fe0d366ce2 | ||
|
|
a16b27f102 | ||
|
|
dfca1c4ea6 | ||
|
|
a0b5ba2f7f | ||
|
|
19420aac9d | ||
|
|
013e8d1eb1 |
@@ -11,6 +11,7 @@ config.h
|
||||
config.h.in
|
||||
config.log
|
||||
config.status
|
||||
config.rpath
|
||||
configure
|
||||
config.guess
|
||||
config.sub
|
||||
|
||||
437
ChangeLog
437
ChangeLog
@@ -1,3 +1,430 @@
|
||||
GNU nano 1.3.5 - 2004.11.22
|
||||
- General:
|
||||
- Convert more ints that hold only TRUE and FALSE values to
|
||||
bools. (DLR)
|
||||
- Consolidate the code for finding and running a shortcut in a
|
||||
shortcut list, the code for finding and toggling a toggle in a
|
||||
toggle list, and the code for doing both of those and
|
||||
interpreting mouse clicks in the edit window. Also move the
|
||||
code for do_mouse() to get_edit_mouse() and tweak it to
|
||||
properly handle cases where a shortcut isn't clicked. New
|
||||
functions get_shortcut(), get_toggle(), get_edit_input(), and
|
||||
get_edit_mouse(); changes to do_browser(), do_justify(),
|
||||
do_help(), and main(). (DLR)
|
||||
- Simplify a few more translated messages. (DLR)
|
||||
- Translation updates (see po/ChangeLog for details).
|
||||
- Remove reference to @includedir@ in src/Makefile.am, as it's
|
||||
unneeded and can break cross-compilation. (DLR, found by Mike
|
||||
Frysinger)
|
||||
- Overhaul the file opening, reading, and loading operations to
|
||||
increase efficiency, avoid problems on invalid filenames
|
||||
specified on the command line, and eliminate corner cases that
|
||||
erroneously leave edittop or current NULL when they shouldn't
|
||||
be. Also split out the code to execute a command into a
|
||||
separate function, eliminate a workaround for one of the
|
||||
aforementioned corner cases, handle files with a mix of DOS
|
||||
and Mac format lines, and remove the code to turn on the
|
||||
NO_CONVERT flag when opening a binary file, as it's not always
|
||||
reliable and will cause problems with UTF-8 text files. New
|
||||
functions open_file(), execute_command(), and mallocstrassn();
|
||||
changes to read_line(), load_file(), read_file(), open_file(),
|
||||
get_next_filename(), do_insertfile(), do_insertfile_void(),
|
||||
do_alt_speller(), and edit_refresh(). (David Benbennick) DLR:
|
||||
Add a few minor fixes to make sure that current is set
|
||||
properly in all cases, indicate on the statusbar when the file
|
||||
has a mix of DOS and Mac format lines, move the test for DOS
|
||||
line endings from read_line() to read_file() to avoid
|
||||
inaccurate statusbar messages and to reduce fileformat to a
|
||||
local variable in read_file(), eliminate another workaround in
|
||||
edit_update(), rename open_the_file() to open_file() since the
|
||||
latter has been removed, and rename load_a_file() to
|
||||
load_buffer().
|
||||
- Add alternative shortcuts to the main and search shortcut
|
||||
lists for moving to the beginning and end of a paragraph and
|
||||
justifying the entire file: Meta-( (Meta-9), Meta-) (Meta-0),
|
||||
and Meta-J, respectively. Do this because Pico's practice of
|
||||
putting these shortcuts only in the search shortcut list is
|
||||
rather odd. (DLR)
|
||||
- Turn off extended input processing (the IEXTEN termios flag)
|
||||
as nano 1.2.x does. New function disable_extended_input();
|
||||
changes to terminal_init(). (DLR)
|
||||
- Remove redundant include of limits.h from nano.c. nano.c
|
||||
includes nano.h and nano.h includes limits.h. (DLR)
|
||||
- Add a func_key flag to the low-level input functions and the
|
||||
currently existing high-level input functions, to indicate
|
||||
extended keypad values. This is needed for UTF-8 support.
|
||||
Changes to unget_kbinput(), get_kbinput(),
|
||||
get_translated_kbinput(), get_shortcut(), get_edit_input(),
|
||||
etc. (DLR)
|
||||
- Add a multibuffer mode toggle to the "Execute Command" prompt,
|
||||
for consistency with the "Read File" prompt. Changes to
|
||||
do_insertfile() and shortcut_init(). (DLR)
|
||||
- Add an ^X toggle to the "Execute Command" prompt to go back to
|
||||
the "Insert File" prompt, and add a ^T toggle to the "Go To
|
||||
Line" prompt to go back to the "Where Is" prompt. Changes to
|
||||
do_insertfile(), shortcut_init(), do_gotoline(), etc.
|
||||
- Make sure a few uninitialized static variables are initialized
|
||||
to sane values. (DLR)
|
||||
- After reading in a file and detecting the format it's in, set
|
||||
the file format flags (DOS_FILE and MAC_FILE) to match, and
|
||||
preserve them across multiple file buffers. Changes to
|
||||
read_file(), add_open_file(), and load_open_file(). (DLR,
|
||||
suggested by Bill Soudan)
|
||||
- Remove the -D/--dos and -M/--mac command line options, as they
|
||||
aren't much use with the new file format autodetection. Also
|
||||
remove the global versions of the toggles, so that they can
|
||||
only be used at the "Write File" prompt as similar options
|
||||
can. Finally, change the Mac format toggle to Meta-M, since
|
||||
that no longer conflicts with the global -m/--mouse toggle.
|
||||
(DLR)
|
||||
- Add support for reading in UTF-8 sequences to the low-level
|
||||
input routines. Changes to get_kbinput() and
|
||||
get_translated_kbinput(). (DLR)
|
||||
- Reduce search_last_line to a static variable in search.c, and
|
||||
allow it to be set to FALSE via a function. New function
|
||||
findnextstr_wrap_reset(); changes to do_int_spell_fix(),
|
||||
findnextstr(), do_search(), do_research(), do_replace_loop(),
|
||||
do_replace(), and do_find_bracket(). (DLR, problem with making
|
||||
search_last_line local to findnextstr() found by Rocco)
|
||||
- When saving or changing file positions, be sure not to ignore
|
||||
placewewant. Changes to do_int_spell_fix(), findnextstr(),
|
||||
do_replace_loop(), and do_replace(). (DLR)
|
||||
- Convert current_x and mark_beginx to size_t's, and convert
|
||||
some functions that use them as a parameter to use size_t as
|
||||
well. Also change some related assertions to handle them.
|
||||
(David Benbennick and DLR)
|
||||
- Add code to partition a filestruct between a set of arbitrary
|
||||
coordinates. Given the coordinates of the beginning and end
|
||||
of the mark, this allows proper and easier handling of saving
|
||||
marked selections, replacing text only in marked selections
|
||||
(suggested by Joseph Birthisel), and spell-checking marked
|
||||
selections using either the internal or alternate spell
|
||||
checker. Do all these using a global partition structure.
|
||||
New functions partition_filestruct(),
|
||||
unpartition_filestruct(), remove_magicline(), and
|
||||
get_totals(); changes to write_marked(), do_int_spell_fix(),
|
||||
do_alt_speller(), handle_sigwinch(), and do_replace_loop().
|
||||
(DLR)
|
||||
- Remove most redundant includes of sys/stat.h. It's included
|
||||
in nano.h, so it doesn't need to be included in files that
|
||||
include nano.h. (DLR)
|
||||
- Remove the DOS_FILE and MAC_FILE flags, as they're only used
|
||||
in files.c, and replace them with a static file_format enum.
|
||||
Change the openfilestruct structure accordingly in order to
|
||||
handle this. (DLR)
|
||||
- Convert some ints with predefined boundaries to enums. (DLR)
|
||||
- Include config.h only if HAVE_CONFIG_H. (Jordi)
|
||||
- cut.c:
|
||||
cut_marked_segment()
|
||||
- Respect concatenate_cut, as we need to use it if we do a
|
||||
marked cut and immediately follow it with a cut-to-end (which
|
||||
uses this function). (DLR)
|
||||
do_cut_text()
|
||||
- Set concatenate_cut to TRUE unconditionally when doing a
|
||||
marked cut. This fixes an incompatibility with Pico where an
|
||||
extra line is uncut if we do a marked cut that includes the
|
||||
magicline and immediately follow it with an unmarked cut.
|
||||
(DLR)
|
||||
do_uncut_text()
|
||||
- Maintain current_y's value when uncutting blocks so that
|
||||
smooth scrolling works correctly. (DLR)
|
||||
- files.c:
|
||||
read_file()
|
||||
- Rename variable fileformat to format, to avoid confusion with
|
||||
the file_format enum type. (DLR)
|
||||
load_buffer()
|
||||
- Don't change the file format when we insert another file into
|
||||
the current one. (DLR)
|
||||
do_insertfile()
|
||||
- Simplify by reusing variables whereever possible, and add a
|
||||
parameter execute to indicate whether or not to be in "Execute
|
||||
Command" mode. (DLR)
|
||||
- Rework so that goto is no longer needed, using do_writeout()
|
||||
as a model. (DLR)
|
||||
- If file browsing succeeds, call statusq_abort() so that the
|
||||
cursor position at the statusbar is reset. (DLR)
|
||||
- Add missing #ifdefs around the wrap_reset() call so that nano
|
||||
compiles with wrapping disabled again. (DLR)
|
||||
- If we're not inserting a file into a new buffer, partition the
|
||||
current buffer so that it's effectively a new buffer just
|
||||
before inserting the file, and only restore placewewant
|
||||
afterwards. This is the same behavior we would get if we
|
||||
opened the file, added all of it to the cutbuffer, closed the
|
||||
file, and uncut at the current cursor position. (DLR)
|
||||
- Maintain current_y's value when inserting so that smooth
|
||||
scrolling works correctly. (DLR)
|
||||
do_writeout()
|
||||
- Restructure if blocks for greater efficiency, using
|
||||
do_insertfile() as a model. (DLR)
|
||||
- Simplify where possible, and use an int retval to hold the
|
||||
return value instead of i. (DLR)
|
||||
- If file browsing succeeds, call statusq_abort() so that the
|
||||
cursor position at the statusbar is reset. (DLR)
|
||||
- Remove unneeded calls to display_main_list(). (DLR)
|
||||
do_writeout_void()
|
||||
- Call display_main_list(), for consistency with
|
||||
do_insertfile_void(). (DLR)
|
||||
write_file()
|
||||
- If we've tried to write to an unwritable file and we're not
|
||||
prepending, tempname is NULL when it's passed to unlink().
|
||||
This can cause problems if unlink() can't handle NULL, so
|
||||
don't call it in that case. (David Benbennick)
|
||||
write_marked()
|
||||
- Remove check for MARK_ISSET's not being set. (DLR)
|
||||
open_prevfile(), open_nextfile()
|
||||
- Translate the "New Buffer" string when displaying "Switched
|
||||
to" messages on the statusbar. (DLR)
|
||||
input_tab()
|
||||
- Fix snprintf() call so that we don't segfault when trying to
|
||||
complete a filename containing %'s. (Ulf Härnhammar)
|
||||
- global.c:
|
||||
shortcut_init()
|
||||
- Remove redundant NANO_SMALL #ifdef. (DLR)
|
||||
- Change an erroneous _() around the "New Buffer" string to
|
||||
N_(). (DLR)
|
||||
- Add new key aliases: F15 for "Mark Text" (DLR) and F16 for
|
||||
"Where Is Next" (Chris).
|
||||
- Leave "Mark Text" and "Where Is Next" out entirely when
|
||||
NANO_SMALL is defined. Since they aren't in the visible main
|
||||
list, there's no point in having them in but disabled. (DLR)
|
||||
- In the search prompt shortcut list, move "Full Justify" to
|
||||
after "History", so that the latter is visible onscreen
|
||||
again. (DLR)
|
||||
- nano.c:
|
||||
die_save_file()
|
||||
- Clarify the error message when there are too many backup files
|
||||
and the current one can't be written. (DLR)
|
||||
help_init()
|
||||
- Rework to be a bit more flexible. Only add tabs for shortcut
|
||||
key entries if those entries exist, and if there's only one
|
||||
entry left but there's room for more than one, add enough tabs
|
||||
to put that entry at the end. Also, make sure a function key
|
||||
is displayed in the middle if it's the first entry. These
|
||||
changes allow e.g. the miscellaneous meta key sequence to be
|
||||
displayed in a shortcut that has a control key, a primary meta
|
||||
key sequence, and a miscellaneous meta key sequence, but no
|
||||
function key. (DLR)
|
||||
- Update the help text to mention replacing and spell checking
|
||||
only selected text, and also add a few cosmetic fixes to it.
|
||||
(DLR)
|
||||
- Update the help text to mention how to get a blank buffer at
|
||||
the "Execute Command" prompt. (DLR)
|
||||
do_prev_word()
|
||||
- Tweak to avoid an infinite loop, since current_x is now a
|
||||
size_t and hence is unsigned. (DLR)
|
||||
do_int_spell_fix()
|
||||
- Move the REVERSE_SEARCH flag toggling into the NANO_SMALL
|
||||
#ifdef, since the tiny version of nano doesn't support reverse
|
||||
searching. Move the CASE_SENSITIVE flag toggling out in order
|
||||
to allow the internal spell checker to work properly when
|
||||
NANO_SMALL is defined and DISABLE_SPELLER isn't. Also, turn
|
||||
the USE_REGEXP flag off during spell checking in order to
|
||||
avoid a potential segfault. (DLR)
|
||||
- Fix a problem where if the cursor is in the middle of a file,
|
||||
the spell checker will sometimes only correct the misspelled
|
||||
word instances that appear before the cursor position and then
|
||||
stop. (Rocco)
|
||||
- Use do_replace_loop()'s canceled parameter in order to ensure
|
||||
that the spell checking stops if we canceled at the replace
|
||||
prompt. (DLR)
|
||||
do_alt_speller()
|
||||
- Call terminal_init() unconditionally after running the
|
||||
alternate spell checker, so that the terminal state is
|
||||
properly restored in all cases. (DLR)
|
||||
justify_format()
|
||||
- For more compatibility with Pico, remove extra space after a
|
||||
character in punct if that character is the same as the one
|
||||
before it. For example, with the default values of punct and
|
||||
brackets, only one space will be left after "...". (DLR)
|
||||
do_para_begin(), do_para_end()
|
||||
- Maintain current_y's value when moving up or down lines so
|
||||
that smooth scrolling works correctly. (DLR)
|
||||
breakable(), break_line()
|
||||
- Make goal a ssize_t instead of an int, since fill is now a
|
||||
ssize_t, and the position at which a line is broken can be
|
||||
greater than COLS. (DLR)
|
||||
main()
|
||||
- Tweak the command line parsing routine so that multiple +LINE
|
||||
flags are properly interpreted in multibuffer mode. (DLR)
|
||||
- nano.h:
|
||||
- Add WIDTH_OF_TAB #define, containing the default width of a
|
||||
tab. (DLR)
|
||||
- Move the PATH_MAX #define here from files.c.
|
||||
- Remove unused COPYFILEBLOCKSIZE #define. (DLR)
|
||||
- proto.h:
|
||||
- Add missing NANO_SMALL #ifdef around the cut_marked_segment()
|
||||
prototype. (DLR)
|
||||
- rcfile.c:
|
||||
parse_rcfile()
|
||||
- Add missing brackets around an if statement block so that
|
||||
parsing the numeric argument after "tabsize" works properly
|
||||
again. (DLR, found by Mike Frysinger)
|
||||
- Since flag values are longs, use "%ld" instead of "%d" in the
|
||||
debugging messages indicating when a flag is set or unset.
|
||||
(DLR)
|
||||
- search.c:
|
||||
regexp_init()
|
||||
- If NANO_SMALL is defined, don't bother checking the
|
||||
CASE_SENSITIVE flag or using its value when compiling a list
|
||||
of matching regular expressions. (DLR)
|
||||
search_init()
|
||||
- Add parameter use_answer. When it's TRUE, only set
|
||||
backupstring to answer. This is needed to preserve the text
|
||||
of the statusbar when switching to the search prompt from
|
||||
the "Go To Line" prompt. Also, set backupstring before doing
|
||||
anything else, add one minor efficiency tweak, and preserve
|
||||
the text of the statusbar no matter what when switching from
|
||||
the search prompt to the "Go To Line" prompt, since the
|
||||
toggling works both ways now and non-numeric text shouldn't be
|
||||
lost when going only one of those ways. (DLR)
|
||||
- When we're replacing and the mark is on, display a prompt
|
||||
indicating that we're replacing text only in the selection
|
||||
instead of the usual prompt. (DLR)
|
||||
findnextstr()
|
||||
- Take the no_sameline parameter after can_display_wrap and
|
||||
wholewords, not after all other parameters. (DLR)
|
||||
- Maintain current_y's value when moving up or down lines so
|
||||
that smooth scrolling works correctly. (DLR)
|
||||
- Fix handling of the wholewords flag so that it works with
|
||||
regular expressions and in conjunction with the no_sameline
|
||||
flag, and add new parameter needle_len (used to return the
|
||||
length of the match). (DLR)
|
||||
do_replace_loop()
|
||||
- Miscellaneous cleanups: treat real_current as current and
|
||||
real_current_x as current_x, only turn the mark off and call
|
||||
edit_refresh() if the mark was originally on, and make
|
||||
length_change a ssize_t. (DLR)
|
||||
- Return ssize_t instead of int. (DLR)
|
||||
- Add new parameter canceled, set to TRUE if we canceled at the
|
||||
prompt and FALSE otherwise. (DLR)
|
||||
- utils.c:
|
||||
regexp_bol_or_eol()
|
||||
- Don't assume any longer that string will be found if
|
||||
REG_NOTBOL and REG_NOTEOL are not set. (DLR)
|
||||
mallocstrncpy()
|
||||
- New function, used as a malloc()ing equivalent of strncpy().
|
||||
(DLR)
|
||||
mallocstrcpy()
|
||||
- Refactor to be a wrapper for mallocstrncpy(). (DLR)
|
||||
mark_order()
|
||||
- Add new parameter right_side_up. Set it to TRUE If the mark
|
||||
begins with (mark_beginbuf, mark_beginx) and ends with
|
||||
(current, current_x), or FALSE otherwise. (DLR)
|
||||
- winio.c:
|
||||
unget_kbinput()
|
||||
- New function used as a wrapper for ungetch(). (DLR)
|
||||
get_kbinput()
|
||||
- When reading an escape sequence, set get_verbatim_kbinput()'s
|
||||
new first parameter to the first character of the sequence
|
||||
instead of putting that character back and reading the entire
|
||||
sequence afterwards. (DLR)
|
||||
get_escape_seq_kbinput()
|
||||
- Make the escape_seq parameter a const int*, since it's never
|
||||
modified. (DLR)
|
||||
- Support the escape sequences for F15 and F16. (DLR)
|
||||
get_verbatim_kbinput()
|
||||
- Add new parameter first. If first isn't ERR, make it the
|
||||
first character in the returned sequence instead of reading
|
||||
the first character in via blocking input. (DLR)
|
||||
get_mouseinput()
|
||||
- Consolidate two if statements to increase efficiency. (DLR)
|
||||
- Check kbinput against metaval instead of (erroneously) ctrlval
|
||||
when putting back a meta sequence. (DLR)
|
||||
- If there are more than MAIN_VISIBLE shortcuts available, only
|
||||
register clicks on the first MAIN_VISIBLE shortcuts, since
|
||||
bottombars() only shows that many shortcuts. (DLR)
|
||||
check_statblank()
|
||||
- Rename to check_statusblank(), and rename its associated
|
||||
global int statusblank too. (DLR)
|
||||
nanogetstr()
|
||||
- Refresh the screen when Ctrl-L is pressed at the statusbar
|
||||
prompt, as Pico does. (DLR)
|
||||
- Always return the key pressed by the user. (DLR)
|
||||
statusq()
|
||||
- Rework slightly to reset the cursor position when the user
|
||||
hits Enter as well as Cancel. This means that resetstatuspos
|
||||
no longer needs to be global. (DLR)
|
||||
statusq_abort()
|
||||
- New function to set resetstatuspos to FALSE when we don't
|
||||
properly exit the statusbar prompt, e.g. when we get a file
|
||||
from the file browser). (DLR)
|
||||
bottombars()
|
||||
- For efficiency, no longer dynamically allocate space for each
|
||||
visible shortcut, as they're all of a constant short length.
|
||||
(David Benbennick)
|
||||
reset_cursor()
|
||||
- If this is called before any files have been opened, as it can
|
||||
be by statusbar(), put the cursor at the top left corner of
|
||||
the edit window before getting out. (DLR)
|
||||
edit_refresh()
|
||||
- Call edit_update() with NONE instead of CENTER when smooth
|
||||
scrolling is on, for consistency with the movement routines.
|
||||
(DLR)
|
||||
edit_update()
|
||||
- Simplify so as not to require the fileptr parameter anymore,
|
||||
since it's set to current in all calls. (DLR)
|
||||
- Add comments better explaining what the update actually does,
|
||||
and avoid an infinite loop when location is NONE and current_y
|
||||
is greater than (editwinrows - 1). (DLR)
|
||||
do_yesno()
|
||||
- Don't bother assigning the value of get_mouseinput() to
|
||||
anything. Since allow_shortcuts is FALSE, its return value
|
||||
will always be FALSE. (DLR)
|
||||
- configure.ac:
|
||||
- When calling AC_TRY_RUN() to test for a broken regexec()
|
||||
function, set the fourth parameter to default to "no" (since
|
||||
it apparently only occurs on glibc 2.2.3-based systems) so
|
||||
that cross-compiling will work. (DLR, found by Mike Frysinger)
|
||||
- Simplify the curses library tests by only checking for
|
||||
initscr(), which ncurses, curses, and pdcurses should all
|
||||
have, and not tgetent(), which is a termcap-specific function.
|
||||
(DLR)
|
||||
- Check only for glib 2.x, as it's much more common than
|
||||
glib 1.2.x now, and it has a better v?snprintf()
|
||||
implementation. (DLR, suggested by Jordi)
|
||||
- nanorc.sample:
|
||||
- Remove specific references to control key shortcuts other than
|
||||
XON and XOFF. (DLR)
|
||||
- Add continue and goto to the "c-file" regexes. (DLR)
|
||||
- Change the included speller value to "aspell -x -c". The -x
|
||||
option makes aspell not create backup files, and this is
|
||||
consistent with the internal spell checker's behavior. (DLR)
|
||||
- doc/man/fr/nano.1, doc/man/fr/nanorc.1:
|
||||
- Updated manpage translations by Jean-Philippe Guérard.
|
||||
- README.CVS:
|
||||
- Mention the requirement for glib 2.x on systems lacking
|
||||
v?snprintf(), and add minor formatting changes.
|
||||
- Mention the requirement for groff in order to create html
|
||||
versions of the manpages. (DLR)
|
||||
- Update the given cvs commands so that they work again, and
|
||||
mention the need for ssh to do cvs checkouts. (DLR)
|
||||
- List sh as an example of a Bourne shell. (DLR)
|
||||
- faq.html:
|
||||
- Fixed inaccuracy: Pico compatibility mode was made the default
|
||||
in nano 1.1.99pre1, not 1.2.2. (DLR)
|
||||
- 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
|
||||
miscellaneous fixes and link updates. (DLR)
|
||||
- nano.1:
|
||||
- Eliminate references to the now removed -D/--dos and -M/--mac
|
||||
command line options. (DLR)
|
||||
- nano.texi:
|
||||
- Eliminate references to the now removed -D/--dos and -M/--mac
|
||||
command line options, and their corresponding toggles. (DLR)
|
||||
- m4/Makefile.am:
|
||||
- Add glib-2.0.m4 to EXTRA_DIST, so that nano builds from CVS
|
||||
with automake 1.7.x again. For some reason, automake 1.9.x
|
||||
didn't have a problem with its (erroneously) being left out.
|
||||
(DLR, problem found by Chris)
|
||||
- m4/glib-2.0.m4:
|
||||
- New file imported from glib 2.4.7. This is needed to detect
|
||||
glib 2.x on systems that may not have it installed. (DLR,
|
||||
suggested by Jordi)
|
||||
- src/Makefile.am:
|
||||
- Don't use DEFS to define things. Use INCLUDES instead. (Jordi)
|
||||
|
||||
GNU nano 1.3.4 - 2004.08.17
|
||||
- General:
|
||||
- More minor comment cleanups. (DLR)
|
||||
@@ -80,7 +507,7 @@ GNU nano 1.3.4 - 2004.08.17
|
||||
- Consolidate some if blocks to remove some redundant code.
|
||||
(David Benbennick)
|
||||
- Fix warnings when compiling with ENABLE_NLS undefined and with
|
||||
-the fwritable-strings option. (David Benbennick)
|
||||
the fwritable-strings option. (David Benbennick)
|
||||
- Add various #ifdefs to fix warnings and compilation problems
|
||||
when compiling with every option manually turned on, including
|
||||
NANO_SMALL. (David Benbennick)
|
||||
@@ -110,7 +537,7 @@ GNU nano 1.3.4 - 2004.08.17
|
||||
write_file()
|
||||
- For consistency with nano 1.2.x and with other editors, make
|
||||
the mode of newly created files 666 instead of 600 before
|
||||
it's modified by the umask. (DLR)
|
||||
it's modified by the umask. (DLR, found by Toni Suokas)
|
||||
do_writeout()
|
||||
- If we're in restricted mode and the current filename isn't
|
||||
blank, we can't change it, so disable tab completion in that
|
||||
@@ -704,7 +1131,6 @@ GNU nano 1.3.3 - 2004.06.28
|
||||
- config.rpath:
|
||||
- Replace usage of egrep with grep -E, avoiding a XSI:ism (David
|
||||
Weinehall)
|
||||
|
||||
- faq.html:
|
||||
- Removed question about the NumLock glitch, as it's no longer
|
||||
needed. (DLR)
|
||||
@@ -1460,8 +1886,8 @@ GNU nano 1.2.1 - 2003.04.19
|
||||
- General:
|
||||
- Translation updates (see po/ChangeLog for details).
|
||||
- Work around broken regexec() on some systems that segfaults
|
||||
when passed an empty string. New function regexec_safe().
|
||||
(David Benbennick)
|
||||
when passed an empty string. This is known to be in glibc
|
||||
2.2.3. New function regexec_safe(). (David Benbennick)
|
||||
- Fix various bugs with search string history logging: don't
|
||||
print a broken error message and freeze if ~/.nano_history is
|
||||
unreadable, actually show an error message in save_history()
|
||||
@@ -2657,6 +3083,7 @@ GNU nano 1.1.9 - 05/12/2002
|
||||
- Indonesian translation updates (Tedi Heriyanto).
|
||||
- po/sv.po:
|
||||
- Swedish translation updates (Christian Rose).
|
||||
|
||||
GNU nano 1.1.8 - 03/30/2002
|
||||
- General
|
||||
- Type misalignments and mem leaks in renumber_all, do_justify
|
||||
|
||||
@@ -3,7 +3,6 @@ AUTOMAKE_OPTIONS = gnu no-dependencies
|
||||
|
||||
SUBDIRS = doc m4 po src
|
||||
|
||||
|
||||
EXTRA_DIST = ABOUT-NLS AUTHORS BUGS COPYING ChangeLog INSTALL NEWS \
|
||||
README THANKS TODO UPGRADE config.rpath install-sh missing \
|
||||
mkinstalldirs nano.spec
|
||||
|
||||
21
NEWS
21
NEWS
@@ -1,3 +1,24 @@
|
||||
2004.11.22 - GNU nano 1.3.5 hurls itself forward. New features in this
|
||||
release include the ability to replace only marked text
|
||||
when the mark is on, improvements to smooth scrolling so
|
||||
that it applies everywhere instead of just affecting the
|
||||
movement keys, improvements to how files are opened so
|
||||
that they are no longer displayed unnecessarily, support
|
||||
for multiple +LINE arguments in addition to multiple
|
||||
filenames on the command line, autodetection of the
|
||||
format to save a file in based on the format it was in
|
||||
when it was opened, the ability to toggle both ways
|
||||
between the "Read File" and "Execute Command" prompts
|
||||
and the "Search" and "Go to Line" prompts, and support
|
||||
for cross-compiling nano. As for bug fixes, the
|
||||
"tabsize" nanorc option works again, mouse clicks on the
|
||||
shortcut list trigger the right shortcuts again,
|
||||
tab-completing a filename with %'s in it no longer
|
||||
causes a segfault, the internal spell checker no longer
|
||||
skips words after the cursor position when the cursor is
|
||||
in the middle of the file, and spell checking of only
|
||||
marked text now works properly. Have fun with it.
|
||||
|
||||
2004.08.17 - GNU nano 1.3.4 marches forth after a false start. This
|
||||
release mainly features fixes for the bugs that crept
|
||||
into the last release. Among other things, nano now
|
||||
|
||||
40
README.CVS
40
README.CVS
@@ -1,38 +1,44 @@
|
||||
INSTRUCTIONS TO COMPILE AND INSTALL NANO CVS VERSIONS
|
||||
-----------------------------------------------------
|
||||
|
||||
GNU nano is available from CVS, but building this needs a bit
|
||||
more care than the official stable and unstable tarballs.
|
||||
GNU nano is available from CVS, but building this needs a bit more care
|
||||
than the official stable and unstable tarballs.
|
||||
|
||||
To successfully compile GNU nano from CVS, you'll need the
|
||||
following packages:
|
||||
To successfully compile GNU nano from CVS, you'll need the following
|
||||
packages:
|
||||
|
||||
- autoconf (version >= 2.54)
|
||||
- automake (version >= 1.7)
|
||||
- gettext (version >= 0.11.5)
|
||||
- groff
|
||||
- texinfo
|
||||
- cvs
|
||||
- glib (if your system doesn't have snprintf() and/or vsnprintf())
|
||||
- make, gcc and the normal development libraries (ncurses, etc)
|
||||
- ssh (with support for the SSH version 2 protocol)
|
||||
- glib 2.x (if your system doesn't have snprintf() and/or vsnprintf())
|
||||
- make, gcc and the normal development libraries (ncurses, etc.)
|
||||
|
||||
These should be available on your GNU mirror.
|
||||
|
||||
First, you need to set up cvs to download the CVS tree using ssh. If
|
||||
you're using a Bourne shell (e.g. bash or sh), do
|
||||
$ export CVS_RSH=ssh
|
||||
If you're using a C shell (e.g. tcsh or csh), do
|
||||
$ setenv CVS_RSH ssh
|
||||
|
||||
To download the CVS tree, execute the following command:
|
||||
$ cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/nano login
|
||||
and press enter at the password prompt.
|
||||
Then, do
|
||||
$ cvs -z3 -d:pserver:anoncvs@subversions.gnu.org:/cvsroot/nano checkout nano
|
||||
and the nano tree will download.
|
||||
If you want to checkout the stable CVS branch, append -r nano_1_0_branch:
|
||||
$ cvs -z3 -d:pserver:anonymous@subversions.gnu.org:/cvsroot/nano checkout -r nano_1_0_branch nano
|
||||
After it's set up, use the following command to download the CVS tree:
|
||||
$ cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/nano checkout nano
|
||||
|
||||
If you want to download the stable CVS branch, add "-r nano_1_0_branch":
|
||||
$ cvs -z3 -d:ext:anoncvs@savannah.gnu.org:/cvsroot/nano checkout -r nano_1_0_branch nano
|
||||
|
||||
Once you have the sources in the "nano" directory, cd into it, and
|
||||
execute the "autogen.sh" script in the top dir. This will setup a
|
||||
configure script and Makefile.in, and you will be ready to compile with
|
||||
execute the "autogen.sh" script in the top directory. This will set up
|
||||
a configure script and Makefile.in, and you will be ready to compile
|
||||
with
|
||||
$ ./configure [--add-options-here] && make
|
||||
|
||||
Once it's done compiling,
|
||||
$ make install
|
||||
(as root) should put the required files in their respective directories.
|
||||
|
||||
|
||||
Please submit any bugs in the CVS branch to nano-devel@gnu.org.
|
||||
|
||||
8
TODO
8
TODO
@@ -11,11 +11,11 @@ For version 1.4:
|
||||
- Keystroke to implement "Add next sequence as raw" like vi's ^V.
|
||||
[DONE for edit window, needs to be done for statusbar prompt]
|
||||
- Spell check selected text only. [DONE]
|
||||
- Make "To line" (^W^T) and "Read from Command" (^R^X) re-enter their
|
||||
- Make "To Line" (^W^T) and "Read from Command" (^R^X) reenter their
|
||||
parent menu when their keystroke is entered a second time (^W^T^T and
|
||||
(^R^X^X)(requires figuring out when to keep cursor pos and when not
|
||||
to).
|
||||
- Fix resetstatuspos global which we shouldn't have.
|
||||
(^R^X^X) (requires figuring out when to keep cursor position and when
|
||||
not to). [DONE]
|
||||
- Fix resetstatuspos global which we shouldn't have. [DONE]
|
||||
- Rewrite the nano FAQ in SGML.
|
||||
|
||||
Old requests:
|
||||
|
||||
513
config.rpath
513
config.rpath
@@ -1,513 +0,0 @@
|
||||
#! /bin/sh
|
||||
# Output a system dependent set of variables, describing how to set the
|
||||
# run time search path of shared libraries in an executable.
|
||||
#
|
||||
# Copyright 1996-2002 Free Software Foundation, Inc.
|
||||
# Taken from GNU libtool, 2001
|
||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
# General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||
#
|
||||
# As a special exception to the GNU General Public License, if you
|
||||
# distribute this file as part of a program that contains a
|
||||
# configuration script generated by Autoconf, you may include it under
|
||||
# the same distribution terms that you use for the rest of that program.
|
||||
#
|
||||
# The first argument passed to this file is the canonical host specification,
|
||||
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
||||
# or
|
||||
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
||||
# should be set by the caller.
|
||||
#
|
||||
# The set of defined variables is at the end of this script.
|
||||
|
||||
# All known linkers require a `.a' archive for static linking (except M$VC,
|
||||
# which needs '.lib').
|
||||
libext=a
|
||||
shlibext=
|
||||
|
||||
host="$1"
|
||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
||||
|
||||
wl=
|
||||
if test "$GCC" = yes; then
|
||||
wl='-Wl,'
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3* | aix4* | aix5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
linux*)
|
||||
echo '__INTEL_COMPILER' > conftest.$ac_ext
|
||||
if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null
|
||||
then
|
||||
:
|
||||
else
|
||||
# Intel icc
|
||||
wl='-Qoption,ld,'
|
||||
fi
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
solaris*)
|
||||
wl='-Wl,'
|
||||
;;
|
||||
sunos4*)
|
||||
wl='-Qoption ld '
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
if test "x$host_vendor" = xsni; then
|
||||
wl='-LD'
|
||||
else
|
||||
wl='-Wl,'
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
hardcode_libdir_flag_spec=
|
||||
hardcode_libdir_separator=
|
||||
hardcode_direct=no
|
||||
hardcode_minus_L=no
|
||||
|
||||
case "$host_os" in
|
||||
cygwin* | mingw* | pw32*)
|
||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
if test "$GCC" != yes; then
|
||||
with_gnu_ld=no
|
||||
fi
|
||||
;;
|
||||
openbsd*)
|
||||
with_gnu_ld=no
|
||||
;;
|
||||
esac
|
||||
|
||||
ld_shlibs=yes
|
||||
if test "$with_gnu_ld" = yes; then
|
||||
case "$host_os" in
|
||||
aix3* | aix4* | aix5*)
|
||||
# On AIX, the GNU linker is very broken
|
||||
ld_shlibs=no
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
|
||||
# that the semantics of dynamic libraries on AmigaOS, at least up
|
||||
# to version 4, is to share data among multiple programs linked
|
||||
# with the same dynamic library. Since this doesn't match the
|
||||
# behavior of shared libraries on other platforms, we can use
|
||||
# them.
|
||||
ld_shlibs=no
|
||||
;;
|
||||
beos*)
|
||||
if $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
solaris* | sysv5*)
|
||||
if $LD -v 2>&1 | grep -E 'BFD 2\.8' > /dev/null; then
|
||||
ld_shlibs=no
|
||||
elif $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
*)
|
||||
if $LD --help 2>&1 | grep -E ': supported targets:.* elf' > /dev/null; then
|
||||
:
|
||||
else
|
||||
ld_shlibs=no
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
if test "$ld_shlibs" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
fi
|
||||
else
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
# Note: this linker hardcodes the directories in LIBPATH if there
|
||||
# are no directories specified by -L.
|
||||
hardcode_minus_L=yes
|
||||
if test "$GCC" = yes; then
|
||||
# Neither direct hardcoding nor static linking is supported with a
|
||||
# broken collect2.
|
||||
hardcode_direct=unsupported
|
||||
fi
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
if test "$host_cpu" = ia64; then
|
||||
# On IA64, the linker does run time linking by default, so we don't
|
||||
# have to do anything special.
|
||||
aix_use_runtimelinking=no
|
||||
else
|
||||
aix_use_runtimelinking=no
|
||||
# Test if we are trying to use run time linking or normal
|
||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||
# need to do runtime linking.
|
||||
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
|
||||
for ld_flag in $LDFLAGS; do
|
||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||
aix_use_runtimelinking=yes
|
||||
break
|
||||
fi
|
||||
done
|
||||
esac
|
||||
fi
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_separator=':'
|
||||
if test "$GCC" = yes; then
|
||||
case $host_os in aix4.[012]|aix4.[012].*)
|
||||
collect2name=`${CC} -print-prog-name=collect2`
|
||||
if test -f "$collect2name" && \
|
||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||
then
|
||||
# We have reworked collect2
|
||||
hardcode_direct=yes
|
||||
else
|
||||
# We have old collect2
|
||||
hardcode_direct=unsupported
|
||||
hardcode_minus_L=yes
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_libdir_separator=
|
||||
fi
|
||||
esac
|
||||
fi
|
||||
if test "$aix_use_runtimelinking" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
else
|
||||
if test "$host_cpu" = ia64; then
|
||||
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
||||
else
|
||||
hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
amigaos*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
# see comment about different semantics on the GNU ld section
|
||||
ld_shlibs=no
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
# When not using gcc, we currently assume that we are using
|
||||
# Microsoft Visual C++.
|
||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||
# no search path for DLLs.
|
||||
hardcode_libdir_flag_spec=' '
|
||||
libext=lib
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd1*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
freebsd2.2*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
freebsd2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
freebsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes # Not in the search PATH, but as the default
|
||||
# location of the library.
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
netbsd*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
hardcode_direct=yes
|
||||
;;
|
||||
newsos6)
|
||||
hardcode_direct=yes
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
openbsd*)
|
||||
hardcode_direct=yes
|
||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
else
|
||||
case "$host_os" in
|
||||
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
;;
|
||||
os2*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
osf3*)
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
osf4* | osf5*)
|
||||
if test "$GCC" = yes; then
|
||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||
else
|
||||
# Both cc and cxx compiler support -rpath directly
|
||||
hardcode_libdir_flag_spec='-rpath $libdir'
|
||||
fi
|
||||
hardcode_libdir_separator=:
|
||||
;;
|
||||
sco3.2v5*)
|
||||
;;
|
||||
solaris*)
|
||||
hardcode_libdir_flag_spec='-R$libdir'
|
||||
;;
|
||||
sunos4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=yes
|
||||
;;
|
||||
sysv4)
|
||||
if test "x$host_vendor" = xsno; then
|
||||
hardcode_direct=yes # is this really true???
|
||||
else
|
||||
hardcode_direct=no # Motorola manual says yes, but my tests say they lie
|
||||
fi
|
||||
;;
|
||||
sysv4.3*)
|
||||
;;
|
||||
sysv5*)
|
||||
hardcode_libdir_flag_spec=
|
||||
;;
|
||||
uts4*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
dgux*)
|
||||
hardcode_libdir_flag_spec='-L$libdir'
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
ld_shlibs=yes
|
||||
fi
|
||||
;;
|
||||
sysv4.2uw2*)
|
||||
hardcode_direct=yes
|
||||
hardcode_minus_L=no
|
||||
;;
|
||||
sysv5uw7* | unixware7*)
|
||||
;;
|
||||
*)
|
||||
ld_shlibs=no
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Check dynamic linker characteristics
|
||||
libname_spec='lib$name'
|
||||
sys_lib_dlsearch_path_spec="/lib /usr/lib"
|
||||
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
|
||||
case "$host_os" in
|
||||
aix3*)
|
||||
shlibext=so
|
||||
;;
|
||||
aix4* | aix5*)
|
||||
shlibext=so
|
||||
;;
|
||||
amigaos*)
|
||||
shlibext=ixlibrary
|
||||
;;
|
||||
beos*)
|
||||
shlibext=so
|
||||
;;
|
||||
bsdi4*)
|
||||
shlibext=so
|
||||
sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
|
||||
sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
|
||||
;;
|
||||
cygwin* | mingw* | pw32*)
|
||||
case $GCC,$host_os in
|
||||
yes,cygwin*)
|
||||
shlibext=dll.a
|
||||
;;
|
||||
yes,mingw*)
|
||||
shlibext=dll
|
||||
sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
|
||||
;;
|
||||
yes,pw32*)
|
||||
shlibext=dll
|
||||
;;
|
||||
*)
|
||||
shlibext=dll
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
darwin* | rhapsody*)
|
||||
shlibext=dylib
|
||||
;;
|
||||
freebsd1*)
|
||||
;;
|
||||
freebsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
gnu*)
|
||||
shlibext=so
|
||||
;;
|
||||
hpux9* | hpux10* | hpux11*)
|
||||
shlibext=sl
|
||||
;;
|
||||
irix5* | irix6*)
|
||||
shlibext=so
|
||||
case "$host_os" in
|
||||
irix5*)
|
||||
libsuff= shlibsuff=
|
||||
;;
|
||||
*)
|
||||
case $LD in
|
||||
*-32|*"-32 ") libsuff= shlibsuff= ;;
|
||||
*-n32|*"-n32 ") libsuff=32 shlibsuff=N32 ;;
|
||||
*-64|*"-64 ") libsuff=64 shlibsuff=64 ;;
|
||||
*) libsuff= shlibsuff= ;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
|
||||
sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
|
||||
;;
|
||||
linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
|
||||
;;
|
||||
linux-gnu*)
|
||||
shlibext=so
|
||||
;;
|
||||
netbsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
newsos6)
|
||||
shlibext=so
|
||||
;;
|
||||
openbsd*)
|
||||
shlibext=so
|
||||
;;
|
||||
os2*)
|
||||
libname_spec='$name'
|
||||
shlibext=dll
|
||||
;;
|
||||
osf3* | osf4* | osf5*)
|
||||
shlibext=so
|
||||
sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
|
||||
sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
|
||||
;;
|
||||
sco3.2v5*)
|
||||
shlibext=so
|
||||
;;
|
||||
solaris*)
|
||||
shlibext=so
|
||||
;;
|
||||
sunos4*)
|
||||
shlibext=so
|
||||
;;
|
||||
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||
shlibext=so
|
||||
case "$host_vendor" in
|
||||
motorola)
|
||||
sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
uts4*)
|
||||
shlibext=so
|
||||
;;
|
||||
dgux*)
|
||||
shlibext=so
|
||||
;;
|
||||
sysv4*MP*)
|
||||
if test -d /usr/nec; then
|
||||
shlibext=so
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||
|
||||
sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||
|
||||
# How to pass a linker flag through the compiler.
|
||||
wl="$escaped_wl"
|
||||
|
||||
# Static library suffix (normally "a").
|
||||
libext="$libext"
|
||||
|
||||
# Shared library suffix (normally "so").
|
||||
shlibext="$shlibext"
|
||||
|
||||
# Flag to hardcode \$libdir into a binary during linking.
|
||||
# This must work even if \$libdir does not exist.
|
||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
||||
|
||||
# Whether we need a single -rpath flag with a separated argument.
|
||||
hardcode_libdir_separator="$hardcode_libdir_separator"
|
||||
|
||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_direct="$hardcode_direct"
|
||||
|
||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
||||
# resulting binary.
|
||||
hardcode_minus_L="$hardcode_minus_L"
|
||||
|
||||
# Compile-time system search path for libraries
|
||||
sys_lib_search_path_spec="$escaped_sys_lib_search_path_spec"
|
||||
|
||||
# Run-time system search path for libraries
|
||||
sys_lib_dlsearch_path_spec="$escaped_sys_lib_dlsearch_path_spec"
|
||||
|
||||
EOF
|
||||
35
configure.ac
35
configure.ac
@@ -19,10 +19,11 @@
|
||||
#
|
||||
# $Id$
|
||||
|
||||
AC_INIT([GNU nano], [1.3.4], [nano-devel@gnu.org], [nano])
|
||||
AC_INIT([GNU nano], [1.3.5], [nano-devel@gnu.org], [nano])
|
||||
AC_CONFIG_SRCDIR([src/nano.c])
|
||||
AC_CANONICAL_TARGET([])
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER([config.h:config.h.in])
|
||||
AC_CONFIG_HEADERS([config.h])
|
||||
|
||||
AC_PREREQ(2.54)
|
||||
|
||||
@@ -56,7 +57,9 @@ int main(void)
|
||||
return 0;
|
||||
}],
|
||||
AC_MSG_RESULT(no),
|
||||
AC_MSG_RESULT(yes); AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions.])
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE(BROKEN_REGEXEC, 1, [Define this if your regexec() function segfaults when passed an empty string under certain conditions.]),
|
||||
AC_MSG_RESULT([cross-compiling; assuming no])
|
||||
)
|
||||
)
|
||||
|
||||
@@ -224,8 +227,8 @@ int main(void)
|
||||
else
|
||||
CURSES_LIB="-lslang"
|
||||
fi
|
||||
CURSES_LIB_NAME=slang], [
|
||||
AC_MSG_RESULT(no)
|
||||
CURSES_LIB_NAME=slang],
|
||||
[AC_MSG_RESULT(no)
|
||||
# We might need the term library
|
||||
for termlib in ncurses curses termcap terminfo termlib; do
|
||||
AC_CHECK_LIB([${termlib}], tputs, [tcap="-l$termlib"])
|
||||
@@ -294,12 +297,11 @@ AC_CHECK_FUNCS(snprintf vsnprintf isblank strcasecmp strncasecmp strcasestr strn
|
||||
if test "x$ac_cv_func_snprintf" = "xno" -o "xac_cv_func_vsnprintf" = "xno"
|
||||
then
|
||||
AM_PATH_GLIB_2_0(2.0.0,,
|
||||
[AM_PATH_GLIB(1.2.4,,
|
||||
[AC_MSG_ERROR([
|
||||
*** snprintf() and/or vsnprintf() not found. GLIB not found either.
|
||||
AC_MSG_ERROR([
|
||||
*** snprintf() and/or vsnprintf() not found. GLIB 2.x not found either.
|
||||
*** You need both snprintf() and vsnprintf(). Alternatively you can
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.])],
|
||||
glib)])
|
||||
*** install the GLIB library which can be found at ftp://ftp.gtk.org/.]),
|
||||
glib)
|
||||
fi
|
||||
|
||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||
@@ -310,20 +312,12 @@ AC_FUNC_VPRINTF
|
||||
AC_CHECK_FUNCS(getopt_long)
|
||||
|
||||
dnl Checks for libraries.
|
||||
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_HEADERS(curses.h ncurses.h)
|
||||
AC_CHECK_LIB(ncurses, tgetent, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
|
||||
AC_CHECK_LIB(ncurses, initscr, [CURSES_LIB="-lncurses" CURSES_LIB_NAME=ncurses])
|
||||
fi
|
||||
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(curses, tgetent, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
|
||||
fi
|
||||
|
||||
# Fallback for PDCurses and less useful curses libs...
|
||||
if eval "test x$CURSES_LIB_NAME = x"
|
||||
then
|
||||
AC_CHECK_LIB(curses, initscr, [CURSES_LIB="-lcurses" CURSES_LIB_NAME=curses])
|
||||
@@ -344,10 +338,9 @@ else
|
||||
AC_MSG_RESULT([Using $CURSES_LIB_NAME as the termcap library])
|
||||
fi
|
||||
|
||||
|
||||
AC_CHECK_LIB([$CURSES_LIB_NAME], use_default_colors, AC_DEFINE(HAVE_USE_DEFAULT_COLORS, 1, [Define this if your curses library has the use_default_colors command.]))
|
||||
|
||||
dnl Parse any configure options
|
||||
dnl Parse any configure options.
|
||||
|
||||
LIBS="$LIBS $CURSES_LIB"
|
||||
|
||||
|
||||
68
doc/faq.html
68
doc/faq.html
@@ -3,7 +3,6 @@
|
||||
<head>
|
||||
<title>The GNU nano editor FAQ</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
|
||||
<meta name="GENERATOR" content="Mozilla/4.73 [en] (X11; U; Linux 2.2.16 i586) [Netscape]">
|
||||
</head>
|
||||
<body text="#330000" bgcolor="#ffffff" link="#0000ef" vlink="#51188e" alink="#ff0000">
|
||||
<h1>The nano FAQ</h1>
|
||||
@@ -33,13 +32,15 @@
|
||||
<a href="#3.9">3.9. How do I make a .nanorc file that nano will read when I start it?</a></p></blockquote>
|
||||
<h2><a href="#4">4. Running</a></h2>
|
||||
<blockquote><p><a href="#4.1">4.1. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</a><br>
|
||||
<a href="#4.2">4.2. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.3">4.3. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.4">4.4. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.5a">4.5a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
|
||||
<a href="#4.5b">4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.6">4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.7">4.7. I've compiled nano with color support, but I don't see any color when I run it!</a></p></blockquote>
|
||||
<a href="#4.2">4.2. How do I type the F13-F16 keys shown in the help browser? My keyboard only has F1-F12!</a><br>
|
||||
<a href="#4.3">4.3. Nano crashes when I type <insert keystroke here>!</a><br>
|
||||
<a href="#4.4">4.4. Nano crashes when I resize my window. How can I fix that?</a><br>
|
||||
<a href="#4.5">4.5. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</a><br>
|
||||
<a href="#4.6a">4.6a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</a><br>
|
||||
<a href="#4.6b">4.6b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</a><br>
|
||||
<a href="#4.7">4.7. How do I make nano my default editor (in Pine, mutt, etc.)?</a><br>
|
||||
<a href="#4.8">4.8. I've compiled nano with color support, but I don't see any color when I run it!</a><br>
|
||||
<a href="#4.9">4.9. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</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>
|
||||
<a href="#5.2">5.2. I don't like the translation for <x> in my language. How can I fix it?</a></p></blockquote>
|
||||
@@ -78,9 +79,9 @@
|
||||
<h2><a name="1.5"></a>1.5. Why the name change from TIP?</h2>
|
||||
<blockquote><p>On January 10, 2000, TIP was officially renamed to nano because of a namespace conflict with another program called 'tip'. The original 'tip' program "establishes a full duplex terminal connection to a remote host", and was included with many older Unix systems (and newer ones like Solaris). The conflict was not noticed at first because there is no 'tip' utility included with most GNU/Linux distributions (where nano was developed).</p></blockquote>
|
||||
<h2><a name="1.6"></a>1.6. What is the current version of nano?</h2>
|
||||
<blockquote><p>The current version of nano *should* be 1.3.4. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<blockquote><p>The current version of nano *should* be 1.3.5. Of course you should always check the nano homepage to see what the latest and greatest version is.</p></blockquote>
|
||||
<h2><a name="1.7"></a>1.7. I want to read the man page without having to download the program!</h2>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.2/nano.1.html">here</a>.</p></blockquote>
|
||||
<blockquote><p>Jeez, demanding, aren't we? Okay, look <a href="http://www.nano-editor.org/dist/v1.3/nano.1.html">here</a>.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="2"></a>2. Where to get GNU nano.</h1>
|
||||
<h2><a name="2.1"></a>2.1. FTP and WWW sites that carry nano.</h2>
|
||||
@@ -140,22 +141,26 @@
|
||||
<h2><a name="3.6"></a>3.6. How can I make the executable smaller? This is too bloated!</h2>
|
||||
<blockquote><p>Actually, there are several parts of the editor that can be disabled. You can pass arguments to the <b>configure</b> script that disable certain features. Here's a brief list:</p>
|
||||
<pre>
|
||||
<b>--disable-tabcomp</b> Disables tab completion code for a smaller binary
|
||||
<b>--disable-tabcomp</b> Disable tab completion code for a smaller
|
||||
binary
|
||||
<b>--disable-justify</b> Disable justify/unjustify function
|
||||
<b>--disable-speller</b> Disables spell checker function
|
||||
<b>--disable-help</b> Disables help function (^G)
|
||||
<b>--disable-browser</b> Disables mini file browser
|
||||
<b>--disable-wrapping</b> Disables all wrapping of text (and -w flag)
|
||||
<b>--disable-mouse</b> Disables mouse support (and -m flag)
|
||||
<b>--disable-speller</b> Disable spell checker function
|
||||
<b>--disable-help</b> Disable help function
|
||||
<b>--disable-browser</b> Disable mini file browser
|
||||
<b>--disable-wrapping</b> Disable all wrapping of text (and -w flag)
|
||||
<b>--disable-mouse</b> Disable mouse support (and -m flag)
|
||||
<b>--disable-operatingdir</b> Disable setting of operating directory</pre>
|
||||
<p>There's also the <b>--enable-tiny</b> option which disables everything above, as well as some larger chunks of the program (like the marker code that you use Control-^ to select with). Also, if you know you aren't going to be using other languages you can use <b>--disable-nls</b> to disable internationalization and save a few K to a few dozen K depending on if you have locale support on your system. And finally there's always good old <b>strip</b> to strip all debugging code and code that exists in libraries on your system.</p>
|
||||
<p>If, on the other hand, you can't live without bells and whistles, you could try:</p>
|
||||
<pre>
|
||||
<b>--enable-extra</b> Enable extra functions, including easter eggs
|
||||
<b>--enable-nanorc</b> Enable use of .nanorc file
|
||||
<b>--enable-color</b> Enables color and syntax highlighting
|
||||
<b>--enable-multibuffer</b> Enables having multiple file buffers open
|
||||
<b>--enable-all</b> Enables all of the above features</pre></blockquote>
|
||||
<b>--enable-color</b> Enable color and syntax highlighting
|
||||
<b>--enable-multibuffer</b> Enable having multiple file buffers open
|
||||
<b>--enable-all</b> Enable all of the above features
|
||||
<b>--disable-wrapping-as-root</b>
|
||||
Turn off wrapping of text by default when the
|
||||
user is root</pre></blockquote>
|
||||
<h2><a name="3.7"></a>3.7. Tell me more about this multibuffer stuff!</h2>
|
||||
<blockquote><p>To use multiple file buffers, you must be using nano 1.1.0 or newer, and you must have configured nano with <b>--enable-multibuffer</b> or <b>--enable-extra</b> (use nano -V to check). Then when you want to enable inserting a file into its own buffer instead of into the current file, just hit <b>Meta-F</b>, then insert the file as normal with <b>^R</b>. If you always want files to be loaded into their own buffers, use the <b>--multibuffer</b> or <b>-F</b> flag when you invoke nano.</p>
|
||||
<p>You can move between the buffers you have open with the <b>Meta-<</b> and <b>Meta-></b> keys, or more easily with <b>Meta-,</b> and <b>Meta-.</b> (clear as mud, right? =-). When you have more than one file buffer open, the ^X shortcut will say "Close", instead of the normal "Exit" when only one buffer is open.</p></blockquote>
|
||||
@@ -169,20 +174,21 @@
|
||||
<h1><a name="4"></a>4. Running</h1>
|
||||
<h2><a name="4.1"></a>4.1. Ack! My backspace/delete/enter/double bucky/meta key doesn't seem to work! What can I do?</h2>
|
||||
<blockquote><p>Try setting your $TERM variable to 'vt100'. Nano doesn't yet support every term entry under the sun.</p>
|
||||
<p>Bourne shell users (like bash): <b>export TERM=vt100</b><br>
|
||||
<p>Bourne shell users (bash and sh): <b>export TERM=vt100</b><br>
|
||||
C Shell users (tcsh and csh): <b>setenv TERM vt100</b></p></blockquote>
|
||||
<h2><a name="4.2"></a>4.2. Nano crashes when I type <insert keystroke here>!</h2>
|
||||
<h2><a name="4.2"></a>4.2. 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, or Eterm, Shift-F3 to Shift-F6 will generate F13 to F16.</p></blockquote>
|
||||
<h2><a name="4.3"></a>4.3. Nano crashes when I type <insert keystroke here>!</h2>
|
||||
<blockquote><p>If you aren't trying some bizarre keystroke combination with some bizarre $TERM entry, chances are you have found a bug. You are welcome to submit it to the <a href="mailto:nano-devel@gnu.org">nano-devel</a> list or to <a href="mailto:nano@nano-editor.org">nano@nano-editor.org</a>.</p></blockquote>
|
||||
<h2><a name="4.3"></a>4.3. Nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<h2><a name="4.4"></a>4.4. Nano crashes when I resize my window. How can I fix that?</h2>
|
||||
<blockquote><p>Older versions of nano had this problem, please upgrade to a newer version (at least 0.9.9 would be great, 0.9.12 is recommended).</p></blockquote>
|
||||
<h2><a name="4.4"></a>4.4. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
|
||||
<h2><a name="4.5"></a>4.5. [version 1.1.12 and earlier] Why does nano show ^\ in the shortcut list instead of ^J?</h2>
|
||||
<blockquote><p>The help (^G) and justify (^J) function were among the last to be written. To show the improvements that nano had over Pico (go to line # and replace), ^_ and ^\ were put on the shortcut list. Later, ^G came back in place of ^_ as it proved to be very valuable for new Unix users. If you use the <b>-p</b> option to nano (or hit Meta-P) you will get the same shortcuts at the bottom as Pico.</p></blockquote>
|
||||
<a name="4.5"></a>
|
||||
<h2><a name="4.5a"></a>4.5a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
|
||||
<h2><a name="4.6a"></a>4.6a. [version 1.1.12 and earlier] When I type in a search string, the string I last searched for is already in front of my cursor! What happened?!</h2>
|
||||
<blockquote><p>In nano version 0.9.20, the default is to have a completely consistent user interface across all user input functions. This means that regardless of whether you're being asked for a filename to insert or write, or a string to search for, the previous value is already inserted before the cursor. If you prefer the old behavior, use the Pico emulation mode (-p or --pico) or just hit Meta-P while in nano (see the ^G help text for more details).</p></blockquote>
|
||||
<h2><a name="4.5b"></a>4.5b. [version 1.2.2 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<h2><a name="4.6b"></a>4.6b. [version 1.1.99pre1 and later] Hey, the search string behavior has reverted, it's now like Pico, what happened to the consistency?</h2>
|
||||
<blockquote><p>It was decided that consistency was nice, but people are used to Pico's inconsistent behavior. Also, in version 1.1.99pre1, search and replace history was introduced. If you wish to edit your previous search/replace entry (or any previous entry), you can do so by hitting the up arrow to cycle through your history. This method allows the best of both worlds: You don't need to erase the previous string if you want to enter a new one, but you can with one keystroke recall previous entries for editing. Therefore there is now no "Pico mode", nano is and has always been a Pico <b>clone</b>, and clones by default should be compatible.</p></blockquote>
|
||||
<h2><a name="4.6"></a>4.6. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<h2><a name="4.7"></a>4.7. How do I make nano my default editor (in Pine, mutt, etc.)?</h2>
|
||||
<blockquote><p>You need to make nano your $EDITOR. If you want this to be saved, you should put a line like this in your <b>.bashrc</b> if you use bash (or <b>.zshrc</b> if you believe in zsh):</p>
|
||||
<p><b>export EDITOR=/usr/local/bin/nano</b></p>
|
||||
<p>or if you use tcsh put this in your <b>.cshrc</b> file:</p>
|
||||
@@ -195,8 +201,10 @@
|
||||
<p>Mutt users should see an effect immediately the next time you log in, no further configuration is needed. However, if you want to let people know you use nano to compose your email messages, you can put a line like this in your <b>.muttrc</b>:</p>
|
||||
<p><b>my_hdr X-Composer: nano x.y.z</b></p>
|
||||
<p>Again, replace x.y.z with the version of nano you use.</p></blockquote>
|
||||
<h2><a name="4.7"></a>4.7. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<h2><a name="4.8"></a>4.8. I've compiled nano with color support, but I don't see any color when I run it!</h2>
|
||||
<blockquote><p>If you want nano to actually use color, you have to specify the color configurations you want it to use in your .nanorc. Some example configurations are in the <b>nanorc.sample</b> that comes with the nano source or your nano package. See Section <a href="#3.9">3.9</a>.</p></blockquote>
|
||||
<h2><a name="4.9"></a>4.9. How do I select text for the clipboard in an X terminal when I'm running nano in one and nano's mouse support is turned on?</h2>
|
||||
<blockquote><p>Try holding down the Shift key and selecting the text as you normally would.</p></blockquote>
|
||||
<hr width="100%">
|
||||
<h1><a name="5"></a>5. Internationalization</h1>
|
||||
<h2><a name="5.1"></a>5.1. There's no translation for my language!</h2>
|
||||
@@ -227,7 +235,7 @@
|
||||
help-nano - <a href="http://mail.gnu.org/mailman/listinfo/help-nano/">http://mail.gnu.org/mailman/listinfo/help-nano/</a><br>
|
||||
nano-devel - <a href="http://mail.gnu.org/mailman/listinfo/nano-devel/">http://mail.gnu.org/mailman/listinfo/nano-devel/</a></p></blockquote>
|
||||
<h2><a name="7.2"></a>7.2. I want to send the development team a big load of cash (or just a thank you).</h2>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v1.2/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v1.2/TODO">cool feature</a> and send us that instead (though cash is fine too).</p></blockquote>
|
||||
<blockquote><p>That's fine. Send it <a href="mailto:nano-devel@gnu.org">our way</a>! Better yet, fix a <a href="http://www.nano-editor.org/dist/v1.3/BUGS">bug</a> in the program or implement a <a href="http://www.nano-editor.org/dist/v1.3/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 patch?</h2>
|
||||
<blockquote><p>See Section <a href="#7.2">7.2</a>.</p></blockquote>
|
||||
<h2><a name="7.4"></a>7.4. How do I join the development team?</h2>
|
||||
@@ -237,6 +245,8 @@
|
||||
<h2><a name="8"></a>8. ChangeLog</h2>
|
||||
<blockquote>
|
||||
<p>
|
||||
2004/11/21 - List sh as an example of a Bourne shell. (DLR)
|
||||
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>
|
||||
|
||||
@@ -2,19 +2,22 @@
|
||||
.\" nano.1 is copyright (C) 1999, 2000, 2001, 2002, 2003 by
|
||||
.\" Chris Allegretta <chrisa@asty.org>
|
||||
.\"
|
||||
.\" (c) 2003 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" (c) 2003-2004 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" pour l'adaptation française
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" Ce document est libre. Reportez-vous à la dernière version de la
|
||||
.\" licence publique générale GNU (GNU GPL) pour connaître ses
|
||||
.\" licence publique générale GNU (GNU GPL) pour connaître ses
|
||||
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
|
||||
.\"
|
||||
.TH NANO 1 "19 juin 2003 (v.f. du 25 août 2003)"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.4" "17 août 2004"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
.\"
|
||||
|
||||
|
||||
.SH NOM
|
||||
nano \- NAno un NOuvel éditeur, un clone libre et amélioré de Pico
|
||||
@@ -25,23 +28,31 @@ nano \- NAno un NOuvel
|
||||
.br
|
||||
|
||||
.SH DESCRIPTION
|
||||
Cette page de manuel décrit brièvement la commande \fBnano\fP.
|
||||
Cette page de manuel décrit brièvement la commande \fBnano\fR.
|
||||
.PP
|
||||
.\" TeX users may be more comfortable with the \fB<whatever>\fP and
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" \fI<whatever>\fP escape sequences to invoke bold face and italics,
|
||||
.\" respectively.
|
||||
\fBnano\fP est un petit éditeur sympathique et libre, qui vise à remplacer
|
||||
Pico, l'éditeur par défaut du paquet non-libre Pine. \fBnano\fP ne se
|
||||
contentant pas de copier l'interface et l'ergonomie de Pico, il offre
|
||||
également certaines fonctionnalités manquantes (ou désactivées par
|
||||
défaut) de Pico. Ces fonctionnalités sont, par exemple, les fonctions de
|
||||
recherche et de remplacement, et la possibilité de sauter directement à
|
||||
un numéro de ligne.
|
||||
\fBnano\fR est un éditeur petit, sympathique et libre, qui vise à remplacer
|
||||
Pico, l'éditeur par défaut du paquet non libre Pine. \fBnano\fR ne se
|
||||
contentant pas de copier l'interface et l'ergonomie de Pico, il offre
|
||||
également certaines fonctions manquantes (ou désactivées par défaut)
|
||||
dans Pico. Ces fonctionnalités sont, par exemple, les fonctions de
|
||||
recherche et de remplacement, et la possibilité de sauter directement à un
|
||||
numéro de ligne.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B \+\fILIGNE\fP
|
||||
Démarre avec le curseur positionné à la ligne numéro \fILIGNE\fP.
|
||||
.B \+\fILIGNE\fR
|
||||
Démarre avec le curseur positionné à la ligne numéro \fILIGNE\fR.
|
||||
.TP
|
||||
.B \-A (\-\-smarthome)
|
||||
Active le fonctionnement évolué de la touche «\ Début\ ». Lorsque cette
|
||||
touche est pressée à n'importe quel endroit excepté au tout début du
|
||||
texte d'une ligne (i.\ e. au premier caractère non blanc), le curseur se
|
||||
positionnera à ce début de ligne (qu'il soit en avant ou en arrière). Si
|
||||
le curseur est déjà au tout début de la ligne, il se placera au vrai
|
||||
début de la ligne.
|
||||
.TP
|
||||
.B \-B (\-\-backup)
|
||||
Lors de l'écriture d'un fichier, crée une copie de sécurité de la
|
||||
@@ -50,55 +61,46 @@ version pr
|
||||
.B \-D (\-\-dos)
|
||||
Écrit le fichier au format DOS.
|
||||
.TP
|
||||
.B \-E \fIrépertoire\fP (\-\-backupdir=\fIrépertoire\fP)
|
||||
Définit le répertoire utilisé par \fBnano\fP pour enregistrer les copies
|
||||
de sécurité si celles-ci sont activées.
|
||||
.TP
|
||||
.B \-F (\-\-multibuffer)
|
||||
Active le mode multifichiers, autorisant l'édition simultanée de
|
||||
plusieurs fichiers, si ce mode est disponible.
|
||||
Active le mode multifichier, autorisant l'édition simultanée de plusieurs
|
||||
fichiers, si ce mode est disponible.
|
||||
.TP
|
||||
.B \-H (\-\-historylog)
|
||||
Enregistre les chaînes ayant fait l'objet d'une recherche ou d'un
|
||||
remplacement dans le fichier
|
||||
.I ~/.nano_history
|
||||
afin de permettre leur réutilisation. Ceci n'est possible que si
|
||||
.B nano
|
||||
est capable d'utiliser les fichiers
|
||||
nanorc.
|
||||
remplacement dans le fichier \fI~/.nano_history\fR afin de permettre leur
|
||||
réutilisation. Ceci n'est possible que si \fBnano\fR est configuré pour
|
||||
utiliser les fichiers nanorc.
|
||||
.TP
|
||||
.B \-I (\-\-ignorercfiles)
|
||||
N'utilise pas les fichiers
|
||||
.I $SYSCONFDIR/nanorc
|
||||
et
|
||||
.IR ~/.nanorc ,
|
||||
même si
|
||||
.B nano
|
||||
est capable de les utiliser.
|
||||
.TP
|
||||
.B \-K (\-\-keypad)
|
||||
Essaie au maximum de ne pas utiliser les appels keypad() de ncurses.
|
||||
Utilisez ce paramètre si vous vous apercevez que les flèches du pavé
|
||||
numérique ne fonctionnent pas sous nano.
|
||||
N'utilise pas les fichiers \fISYSCONFDIR/nanorc\fR et \fI~/.nanorc\fR, même si
|
||||
\fBnano\fR est capable de les utiliser.
|
||||
.TP
|
||||
.B \-M (\-\-mac)
|
||||
Écrit le fichier au format Mac.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
Désactive la conversion automatique des fichiers depuis les
|
||||
formats Mac et DOS.
|
||||
Désactive la conversion automatique des fichiers depuis les formats Mac et
|
||||
DOS.
|
||||
.TP
|
||||
.B \-Q \fIchaîne\fP (\-\-quotestr=\fIchaîne\fP)
|
||||
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
|
||||
pour réaliser une justification correcte des citations.
|
||||
Si nano est capable d'utiliser des expressions rationnelles, le préfixe
|
||||
par défaut sera "^([\ \\t]*[|>:}#])+", sinon, ce sera ">\ ".
|
||||
Définit le préfixe par défaut des citations. Nano utilise ce préfixe
|
||||
pour réaliser une justification correcte des citations. Si nano est
|
||||
capable d'utiliser des expressions rationnelles, le préfixe par défaut
|
||||
sera "^([\ \\t]*[|>:}#])+", sinon, ce sera ">\ ".
|
||||
.TP
|
||||
.B \-R (\-\-regexp)
|
||||
Active l'utilisation d'expressions rationnelles lors des recherches,
|
||||
ainsi que la possibilité d'utiliser \\\fIn\fP dans les chaînes de
|
||||
remplacement pour faire référence à la \fIn\fP-ième sous-expression du
|
||||
motif de recherche, si cette fonction est disponible.
|
||||
Active l'utilisation d'expressions rationnelles lors des recherches, ainsi
|
||||
que la possibilité d'utiliser \\n dans les chaînes de remplacement pour
|
||||
faire référence à la n-ième sous-expression du motif de recherche, si
|
||||
cette fonction est disponible.
|
||||
.TP
|
||||
.B \-S (\-\-smooth)
|
||||
Active le défilement progressif. Le texte défilera ligne-par-ligne au
|
||||
lieu de défiler morceau-par-morceau.
|
||||
Active le défilement progressif. Le texte défilera ligne-par-ligne au lieu
|
||||
de défiler morceau-par-morceau.
|
||||
.TP
|
||||
.B \-T \fInombre\fP (\-\-tabsize=\fInombre\fP)
|
||||
Définit la taille (largeur) des tabulations.
|
||||
@@ -108,55 +110,68 @@ Affiche le num
|
||||
.TP
|
||||
.B \-Y \fIchaîne\fP (\-\-syntax=\fIchaîne\fP)
|
||||
Indique quel mode de colorisation syntaxique adopter, parmi les modes
|
||||
définis dans le fichier
|
||||
.IR .nanorc ,
|
||||
si cette fonctionnalité est disponible.
|
||||
définis dans le fichier \fI.nanorc\fR, si cette fonctionnalité est
|
||||
disponible.
|
||||
.TP
|
||||
.B \-Z (\-\-restricted)
|
||||
Mode restreint\ : aucune lecture ou écriture de fichiers non indiqués
|
||||
sur la ligne de commande, pas de lecture des fichiers nanorc,
|
||||
interdiction de suspendre et interdiction de sauvegarder (ou d'ajouter
|
||||
en tête ou en fin) un fichier ayant déjà un nom sous un nom différent.
|
||||
Cette option peut aussi être activée en appelant \fBnano\fP sous un nom
|
||||
commençant par «\ r\ » (par exemple «\ rnano\ »).
|
||||
.TP
|
||||
.B \-c (\-\-const)
|
||||
Affiche en permanence la position du curseur.
|
||||
.TP
|
||||
.B \-d (\-\-rebinddelete)
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous devriez n'avoir besoin de cette option que si la touche
|
||||
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
|
||||
sur votre système.
|
||||
.TP
|
||||
.B \-h (\-\-help)
|
||||
Affiche de la liste des options disponibles en ligne de commande.
|
||||
Affiche un résumé des options disponibles en ligne de commande.
|
||||
.TP
|
||||
.B \-i (\-\-autoindent)
|
||||
Indentation automatique. Commence chaque nouvelle ligne au même niveau
|
||||
que la ligne précédente. Utile pour l'édition de code source.
|
||||
Indentation automatique. Commence chaque nouvelle ligne au même niveau que
|
||||
la ligne précédente. Utile pour l'édition de code source.
|
||||
.TP
|
||||
.B \-k (\-\-cut)
|
||||
^K coupe le texte du curseur à la fin de la ligne, au lieu de couper la
|
||||
^K coupe le texte du curseur à la fin de la ligne, au lieu de couper la
|
||||
ligne entière.
|
||||
.TP
|
||||
.B \-l (\-\-nofollow)
|
||||
Si le fichier édité est un lien symbolique, remplace le lien par le
|
||||
nouveau fichier, sans le suivre. Ce mode ne serait-il pas utile pour
|
||||
éditer les fichiers de
|
||||
.IR /tmp \ ?
|
||||
Si le fichier édité est un lien symbolique, remplace le lien par le
|
||||
nouveau fichier, sans le suivre. Ce mode ne serait-il pas utile pour éditer
|
||||
les fichiers de \fI/tmp\fR ?
|
||||
.TP
|
||||
.B \-m (\-\-mouse)
|
||||
Active l'utilisation de la souris (si elle est disponible sur votre
|
||||
Active l'utilisation de la souris (si elle est disponible sur votre
|
||||
système).
|
||||
.TP
|
||||
.B \-o \fIrépertoire\fP (\-\-operatingdir=\fIrépertoire\fP)
|
||||
Définit le répertoire de travail. Demande à nano de mettre en place
|
||||
quelque-chose de similaire à une cage chroot.
|
||||
Définit le répertoire de travail. Demande à nano de mettre en place
|
||||
quelque chose de similaire à un environnement d'exécution restreint
|
||||
(\fIchroot\fR).
|
||||
.TP
|
||||
.B \-p (\-\-preserve)
|
||||
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient
|
||||
reçues par le terminal.
|
||||
Préserve les séquences XON et XOFF (^Q et ^S), afin qu'elle soient reçues
|
||||
par le terminal.
|
||||
.TP
|
||||
.B \-r \fIcolonne\fP (\-\-fill=\fIcolonne\fP)
|
||||
Passe automatiquement à la ligne à la colonne \fIcolonne\fP. Par défaut,
|
||||
le passage à la ligne se fait à la taille de l'écran moins huit. Si la
|
||||
valeur indiquée est négative, le point de passage à la ligne sera
|
||||
calculé relativement au bord droit de l'écran. Cela permet de faire
|
||||
varier le point de passage à la ligne lorsque l'on change la taille de
|
||||
l'écran.
|
||||
Passe automatiquement à la ligne à la colonne \fIcolonne\fR. Par défaut, le
|
||||
passage à la ligne se fait à la taille de l'écran moins huit. Si la
|
||||
valeur indiquée est négative, le point de passage à la ligne sera
|
||||
calculé relativement au bord droit de l'écran. Cela permet de faire varier
|
||||
le point de passage à la ligne lorsque l'on change la taille de l'écran.
|
||||
.TP
|
||||
.B \-s \fIprogramme\fP (\-\-speller=\fIprogramme\fP)
|
||||
Choix d'un correcteur orthographique de remplacement.
|
||||
.TP
|
||||
.B \-t (\-\-tempfile)
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement sans
|
||||
demande de confirmation. Identique à l'option -t de Pico.
|
||||
.TP
|
||||
.B \-v (\-\-view)
|
||||
@@ -174,56 +189,58 @@ Autorise
|
||||
.B \-a, \-b, \-e, \-f, \-g, \-j
|
||||
Ignoré, pour être compatible avec Pico.
|
||||
|
||||
.SH FICHIERS D'INITIALISATION
|
||||
\fBnano\fP lit les fichiers d'initialisation dans l'ordre suivant\ :
|
||||
\fI$SYSCONFDIR/nanorc\fP, puis \fI~/.nanorc\fP. Reportez-vous à la page
|
||||
de manuel de \fBnanorc\fP(5) et au fichier-exemple \fInanorc.sample\fP
|
||||
qui devrait être livré avec \fBnano\fP.
|
||||
.SH "FICHIERS D'INITIALISATION"
|
||||
\fBnano\fR lit les fichiers d'initialisation dans l'ordre suivant\ :
|
||||
\fISYSCONFDIR/nanorc\fR, puis \fI~/.nanorc\fR. Référez-vous à la page de manuel
|
||||
de \fBnanorc\fR(5) et au fichier-exemple \fInanorc.sample\fR qui devrait être
|
||||
livré avec \fBnano\fR.
|
||||
|
||||
.SH NOTES
|
||||
Dans certains cas, \fBnano\fP essaiera de sauvegarder le fichier en
|
||||
cours d'édition dans un fichier de secours. Cela arrivera
|
||||
principalement si \fBnano\fP reçoit un signal SIGHUP ou SIGTERM, ou
|
||||
bien se trouve à court de mémoire. Le nom de ce fichier de secours sera
|
||||
\fInano.save\fP si le fichier en cours n'avait pas encore de nom, ou
|
||||
sera composé du nom du fichier en cours suivi du suffixe «\ .save\ ». Si
|
||||
un fichier de ce nom existe déjà dans le répertoire, un «\ .save\ » et
|
||||
un nombre seront ajoutée à la fin du nom du fichier en cours afin de le
|
||||
rendre unique (par exemple, «\ .save.1\ »). En mode multifichiers,
|
||||
\fBnano\fP réalisera une sauvegarde de tous les fichiers en cours dans
|
||||
leurs fichiers de secours respectifs.
|
||||
Si aucun correcteur orthographique de remplacement n'est indiqué dans la
|
||||
ligne de commande ou dans le fichier nanorc, \fBnano\fR prendra
|
||||
la commande indiquée par la variable d'environnement \fBSPELL\fR si
|
||||
elle est définie.
|
||||
|
||||
Dans certains cas, \fBnano\fR essaiera de sauvegarder le fichier en cours
|
||||
d'édition dans un fichier de secours. Cela arrivera principalement si
|
||||
\fBnano\fR reçoit un signal SIGHUP ou SIGTERM, ou bien se trouve à court de
|
||||
mémoire. Le nom de ce fichier de secours sera \fInano.save\fR si le fichier en
|
||||
cours n'avait pas encore de nom, ou sera composé du nom du fichier en cours
|
||||
suivi du suffixe «\ .save\ ». Si un fichier de ce nom existe déjà dans
|
||||
le répertoire, un «\ .save\ » et un nombre seront ajoutés à la fin du
|
||||
nom du fichier en cours afin de le rendre unique (par exemple,
|
||||
«\ .save.1\ »). En mode multifichier, \fBnano\fR réalisera une
|
||||
sauvegarde de tous les fichiers en cours dans leurs fichiers de secours
|
||||
respectifs.
|
||||
|
||||
.SH BOGUES
|
||||
Merci de nous faire parvenir vos commentaires et de nous signaler les
|
||||
bogues, en écrivant, en anglais, à
|
||||
.BR nano@nano-editor.org .
|
||||
Merci de nous faire parvenir vos commentaires et de nous signaler les
|
||||
bogues, en écrivant, en anglais, à \fBnano@nano-editor.org\fR.
|
||||
|
||||
N'hésitez pas à faire parvenir vos suggestions et commentaires relatifs
|
||||
à la version française de \fBnano\fP à
|
||||
.BR jean-philippe.guerard@corbeaunoir.org .
|
||||
La liste de discussion anglophone \fBnano\fR est disponible via
|
||||
\fBnano-devel@gnu.org\fR.
|
||||
|
||||
La liste de discussion anglophone \fBnano\fP est disponible via
|
||||
.BR nano-devel@gnu.org .
|
||||
Pour vous abonner, envoyez un courrier électronique à
|
||||
.BR nano-devel-request@gnu.org ,
|
||||
ayant pour objet «\ subscribe\ ».
|
||||
\fBnano-devel-request@gnu.org\fR, ayant pour objet «\ subscribe\ ».
|
||||
|
||||
.SH SITE INTERNET
|
||||
.SH "SITE INTERNET"
|
||||
http://www.nano-editor.org/
|
||||
|
||||
.SH VOIR AUSSI
|
||||
.SH "VOIR AUSSI"
|
||||
.PD 0
|
||||
.TP
|
||||
\fBnanorc\fP(5)
|
||||
\fBnanorc\fR(5)
|
||||
.PP
|
||||
\fI/usr/share/doc/nano/\fP (ou son équivalent sur votre système)
|
||||
\fI/usr/share/doc/nano/\fR (ou son équivalent sur votre système)
|
||||
|
||||
.SH AUTEUR
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fP et \fITHANKS\fP pour plus d'information). Cette page de
|
||||
manuel a été initialement rédigée par Jordi Mallach
|
||||
<jordi@sindominio.net> pour le système GNU Debian (mais elle peut être
|
||||
utilisée par d'autres).
|
||||
Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
\fIAUTHORS\fR et \fITHANKS\fR pour plus d'information). Cette page de manuel a
|
||||
été initialement rédigée par Jordi Mallach
|
||||
<jordi@sindominio.net> pour le système GNU Debian (mais elle peut
|
||||
être utilisée par d'autres).
|
||||
|
||||
.SH TRADUCTION
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>, 2003.
|
||||
|
||||
Adaptation française du 4\ septembre\ 2004 par
|
||||
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
.\" Hey, EMACS: -*- nroff -*-
|
||||
.\" nanorc.5 is Copyright (C) 2003 Free Software Foundation, Inc.
|
||||
.\"
|
||||
.\" (c) 2003 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" (c) 2003-2004 Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>
|
||||
.\" pour l'adaptation française
|
||||
.\"
|
||||
.\" This is free documentation, see the latest version of the GNU General
|
||||
@@ -11,11 +11,12 @@
|
||||
.\" licence publique générale GNU (GNU GPL) pour connaître ses
|
||||
.\" conditions d'utilisation. AUCUNE garantie n'est offerte.
|
||||
.\"
|
||||
.TH NANORC 5 "19 juin 2003 (v.f. du 25 août 2003)"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 1.3.4" "17 août 2004"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\" Merci de modifier ces dates à chaque mise à jour de cette page.
|
||||
|
||||
.SH NAME
|
||||
.SH NOM
|
||||
nanorc \- fichier de configuration de l'éditeur nano du projet GNU
|
||||
|
||||
.SH DESCRIPTION
|
||||
@@ -32,7 +33,7 @@ sauter directement
|
||||
.PP
|
||||
Le fichier \fInanorc\fP contient les paramètres par défaut de
|
||||
\fBnano\fP. Lors de son démarrage, nano commence par lire le fichier de
|
||||
configuration général \fI$SYSCONFDIR/nanorc\fP, puis lit le fichier de
|
||||
configuration général \fISYSCONFDIR/nanorc\fP, puis lit le fichier de
|
||||
configuration personnel de l'utilisateur \fI~/.nanorc\fP.
|
||||
|
||||
.SH OPTIONS
|
||||
@@ -44,9 +45,9 @@ De plus, les mots clefs
|
||||
sont utilisés pour définir les règles de colorisation pour différents
|
||||
motifs de texte. Nano lira une commande par ligne.
|
||||
|
||||
Les options du fichier de configuration ont priorité sur les valeurs par
|
||||
défaut utilisées par nano. Les options données sur la ligne de commande
|
||||
permettent d'outrepasser les options du fichier de configuration.
|
||||
Les options du fichier de configuration ont priorité sur les valeurs par
|
||||
défaut utilisées par nano. Les options de la ligne de commande sont
|
||||
prioritaires par rapport aux options du fichier de configuration.
|
||||
|
||||
Les options sont désactivées (unset) par défaut, sauf les options
|
||||
prenant un argument.
|
||||
@@ -58,16 +59,15 @@ Les commandes et arguments reconnus sont\ :
|
||||
Active l'indentation automatique.
|
||||
.TP
|
||||
\fBset/unset backup\fP
|
||||
Crée des copie de sécurité appelées
|
||||
Crée des copie de sécurité nommées
|
||||
.IR nom_du_fichier~ .
|
||||
.TP
|
||||
\fBset/unset const\fP
|
||||
Affiche en permanence la position du curseur dans la barre
|
||||
d'information.
|
||||
Affiche en permanence la position du curseur dans la ligne d'état.
|
||||
.TP
|
||||
\fBset/unset cut\fP
|
||||
Par défaut, utilise ^K pour couper le texte du curseur à la fin de la
|
||||
ligne, au lieu de couper la ligne entière.
|
||||
Par défaut, ^K coupe le texte du curseur jusqu'à la fin de la ligne, au
|
||||
lieu de couper la ligne entière.
|
||||
.TP
|
||||
\fBset fill \fIn\fP\fP
|
||||
Passe automatiquement à la ligne à la colonne \fIn\fP. Si la valeur
|
||||
@@ -80,11 +80,9 @@ Active l'utilisation de
|
||||
pour enregistrer et relire les chaînes ayant fait l'objet d'une
|
||||
recherche ou d'un remplacement.
|
||||
.TP
|
||||
\fBset/unset keypad\fP
|
||||
Utilise l'autre gestion du pavé numérique.
|
||||
.TP
|
||||
\fBset/unset multibuffer\fP
|
||||
Permet de charger simultanément plusieurs fichiers.
|
||||
Mode multifichier\ : permet de charger les fichiers dans leur propre
|
||||
espace.
|
||||
.TP
|
||||
\fBset/unset noconvert\fP
|
||||
Pas de conversion depuis les formats DOS et Mac.
|
||||
@@ -93,7 +91,7 @@ Pas de conversion depuis les formats DOS et Mac.
|
||||
Ne suit pas les liens symboliques lors de l'écriture des fichiers.
|
||||
.TP
|
||||
\fBset/unset nohelp\fP
|
||||
Désactive la barre d'aide affichée en bas de l'écran.
|
||||
Désactive les lignes d'aide affichée en bas de l'écran.
|
||||
.TP
|
||||
\fBset/unset nowrap\fP
|
||||
Désactive le passage automatique à la ligne.
|
||||
@@ -101,12 +99,24 @@ D
|
||||
\fBset operatingdir "\fIrépertoire\fP"\fP
|
||||
\fBnano\fP ne lira et n'écrira des fichiers qu'à l'intérieur du
|
||||
\fIrépertoire\fP et de ses sous-répertoires. De plus, celui-ci devient
|
||||
le répertoire courant, afin que les fichiers soient écrits dans ce
|
||||
dossier. Par défaut, cette fonction est désactivée.
|
||||
le répertoire courant, afin que les fichiers soient lus depuis ce
|
||||
répertoire. Par défaut, cette fonction est désactivée.
|
||||
.TP
|
||||
\fBset/unset preserve\fP
|
||||
Préserve les séquences XON et XOFF (^Q et ^S).
|
||||
.TP
|
||||
\fBset punct "\fIchaîne\fP"\fP
|
||||
Définit les caractères interprétés comme des ponctuations terminales.
|
||||
Ces caractères ne peuvent inclure d'espaces ou de tabulations. Seules les
|
||||
ponctuations terminales, éventuellement suivies de crochets fermants,
|
||||
peuvent terminer une phrase.
|
||||
|
||||
(N.D.T.\ : ce réglage permet de conserver 2\ espaces au lieu d'une
|
||||
derrière les ponctuations terminales lors de la justification, ce qui
|
||||
correspond aux normes typographiques anglo-saxonnes, mais n'a pas lieu
|
||||
d'être en français. Pour le français, le plus simple est d'indiquer dans
|
||||
le fichier nanorc une chaîne vide pour ce paramètre.)
|
||||
.TP
|
||||
\fBset quotestr "\fIchaîne\fP"\fP
|
||||
Définit le préfixe par défaut utilisé pour les citations dans les
|
||||
courriers électroniques. Ce préfixe est utilisé pour réaliser une
|
||||
@@ -120,9 +130,24 @@ expressions rationnelles, la valeur par d
|
||||
Sinon, ce sera ">\ ". Notez que le «\ \\t\ » ci-dessus correspond à un
|
||||
caractère de tabulation.
|
||||
.TP
|
||||
\fBset/unset rebinddelete\fP
|
||||
Interprète différemment la touche «\ Supprimer\ », afin que les touches
|
||||
«\ Effacement arrière\ » et «\ Supprimer\ » fonctionnent correctement.
|
||||
Vous devriez uniquement avoir besoin de cette option si la touche
|
||||
«\ Effacement arrière\ » produit l'effet de la touche «\ Supprimer\ »
|
||||
sur votre système.
|
||||
.TP
|
||||
\fBset/unset regexp\fP
|
||||
Utilise par défaut des expressions rationnelles pour les recherches.
|
||||
.TP
|
||||
\fBset/unset smarthome\fP
|
||||
Active le fonctionnement évolué de la touche «\ Début\ ». Lorsque cette
|
||||
touche est pressée à n'importe quel endroit excepté au tout début du
|
||||
texte d'une ligne (i.\ e. au premier caractère non-blanc), le curseur se
|
||||
positionnera à ce début de ligne (qu'il soit en avant ou en arrière). Si
|
||||
le curseur est déjà au tout début de la ligne, il se placera au vrai
|
||||
début de la ligne.
|
||||
.TP
|
||||
\fBset/unset smooth\fP
|
||||
Active le défilement ligne-par-ligne du texte.
|
||||
.TP
|
||||
@@ -138,18 +163,23 @@ Utilise une largeur de tabulation de \fIn\fP au lieu de la valeur par
|
||||
défaut (8). Cette valeur doit être supérieur à 0.
|
||||
.TP
|
||||
\fBset/unset tempfile\fP
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement
|
||||
sans demande de confirmation.
|
||||
S'il a été modifié, le fichier sera sauvegardé automatiquement en
|
||||
quittant, sans demande de confirmation.
|
||||
.TP
|
||||
\fBset/unset view\fP
|
||||
Interdit la modification du fichier.
|
||||
.TP
|
||||
\fBset whitespace "\fIchaîne\fP"\fP
|
||||
Définit les deux caractères utilisés pour afficher les premiers
|
||||
caractères de tabulations et d'espaces. Cela ne doit pas être
|
||||
des caractère de contrôle.
|
||||
.TP
|
||||
.B syntax "\fIchaîne\fP" ["\fImotif_de_fichier\fP" ... ]
|
||||
Définit une syntaxe nommée \fIchaîne\fP qui pourra être activé via
|
||||
l'option \fB-Y\fP, ou qui sera automatiquement activé si le nom du
|
||||
fichier en cours correspond au \fImotif_de_fichier\fP. Toutes les
|
||||
instructions de colorisation \fBcolor\fP suivantes s'appliqueront à cette
|
||||
syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
|
||||
instructions suivantes de colorisation \fBcolor\fP s'appliqueront à
|
||||
cette syntaxe, jusqu'à la définition d'une nouvelle syntaxe.
|
||||
.TP
|
||||
.B color \fIcouleur_texte\fP[,\fIcouleur_fond\fP] "\fImotif\fP" ...
|
||||
Pour la syntaxe en cours, affiche toutes les expressions correspondant à
|
||||
@@ -170,7 +200,7 @@ par \fImotif_fin\fP en utilisant la couleur de texte \fIcouleur_texte\fP
|
||||
et éventuellement la couleur de fond \fIcouleur_fond\fP. Cela permet à
|
||||
la colorisation syntaxique de s'étendre sur plusieurs lignes. Notez que
|
||||
toutes les occurrences successives de \fImotif_début\fP après le
|
||||
\fImotif_début\fP initial seront colorées jusqu'à la prochaine instance
|
||||
\fImotif_début\fP initial seront surlignées jusqu'à la prochaine instance
|
||||
de \fImotif_fin\fP.
|
||||
|
||||
.SH FICHIERS
|
||||
@@ -195,4 +225,6 @@ Chris Allegretta <chrisa@asty.org> et d'autres (voir les fichiers
|
||||
manuel a été rédigée par Jordi Mallach <jordi@gnu.org>.
|
||||
|
||||
.SH TRADUCTION
|
||||
Jean-Philippe Guérard <jean-philippe.guerard@corbeaunoir.org>, 2003.
|
||||
|
||||
Adaptation française du 4\ septembre\ 2004 par
|
||||
Jean-Philippe\ Guérard\ <jean-philippe.guerard@corbeaunoir.org>.
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANO 1 "version 1.3.4" "August 17, 2004"
|
||||
.TH NANO 1 "version 1.3.5" "November 6, 2004"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
|
||||
@@ -46,9 +46,6 @@ line.
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
.TP
|
||||
.B \-D (\-\-dos)
|
||||
Write file in DOS format.
|
||||
.TP
|
||||
.B \-E \fIdir\fP (\-\-backupdir=\fIdir\fP)
|
||||
Set the directory where \fBnano\fP puts the backup files if file backups
|
||||
are enabled.
|
||||
@@ -69,9 +66,6 @@ or
|
||||
.IR ~/.nanorc ,
|
||||
if nanorc support is available.
|
||||
.TP
|
||||
.B \-M (\-\-mac)
|
||||
Write file in Mac format.
|
||||
.TP
|
||||
.B \-N (\-\-noconvert)
|
||||
Disable automatic conversion of files from DOS/Mac format.
|
||||
.TP
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
.\" Public License for copying conditions. There is NO warranty.
|
||||
.\"
|
||||
.\" $Id$
|
||||
.TH NANORC 5 "version 1.3.4" "August 17, 2004"
|
||||
.TH NANORC 5 "version 1.3.5" "November 6, 2004"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.SH NAME
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
## Constantly display the cursor position in the status bar.
|
||||
# set const
|
||||
|
||||
## Use cut to end of line with ^K by default.
|
||||
## Use cut to end of line by default.
|
||||
# set cut
|
||||
|
||||
## Set the line length for wrapping text and justifying paragraphs.
|
||||
@@ -42,9 +42,9 @@
|
||||
## and run shortcuts.
|
||||
# set mouse
|
||||
|
||||
## Allow multiple file buffers (using ^R will insert into a separate
|
||||
## buffer). You must have configured with --enable-multibuffer or
|
||||
## --enable-extra for this to work.
|
||||
## Allow multiple file buffers (inserting a file will put it into a
|
||||
## separate buffer). You must have configured with --enable-multibuffer
|
||||
## or --enable-extra for this to work.
|
||||
##
|
||||
# set multibuffer
|
||||
|
||||
@@ -104,9 +104,9 @@
|
||||
## Use this spelling checker instead of the internal one. This option
|
||||
## does not properly have a default value.
|
||||
##
|
||||
# set speller "aspell -c"
|
||||
# set speller "aspell -x -c"
|
||||
|
||||
## Allow nano to be suspended with ^Z.
|
||||
## Allow nano to be suspended.
|
||||
# set suspend
|
||||
|
||||
## Use this tab size instead of the default; it must be greater than 0.
|
||||
@@ -139,7 +139,7 @@
|
||||
# syntax "c-file" "\.(c|h)$"
|
||||
# color red "\<[A-Z_]{2,}\>"
|
||||
# color green "\<(float|double|char|int|short|long|enum|void|static|const|struct|union|typedef|extern|signed|unsigned|inline)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|switch|break)\>"
|
||||
# color brightyellow "\<(for|if|while|do|else|case|switch|goto|continue|break)\>"
|
||||
# color brightcyan "^ *# *(define|undef|include|ifn?def|endif|elif|else|if)"
|
||||
##
|
||||
## You will in general want your comments and strings to come last,
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
info_TEXINFOS = nano.texi
|
||||
|
||||
MAKEINFO = makeinfo --no-split
|
||||
|
||||
EXTRA_DIST = nano.info
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
@c Run `makeinfo' rather than `texinfo-format-buffer'.
|
||||
@smallbook
|
||||
@set EDITION 0.1
|
||||
@set VERSION 1.3.4
|
||||
@set UPDATED 17 Aug 2004
|
||||
@set VERSION 1.3.5
|
||||
@set UPDATED 6 Nov 2004
|
||||
|
||||
@dircategory Editors
|
||||
@direntry
|
||||
@@ -23,7 +23,7 @@
|
||||
@titlepage
|
||||
@title GNU @code{nano}
|
||||
@subtitle a small and friendly text editor.
|
||||
@subtitle version 1.3.4
|
||||
@subtitle version 1.3.5
|
||||
|
||||
@author Chris Allegretta
|
||||
@page
|
||||
@@ -118,9 +118,6 @@ line.
|
||||
When saving a file, back up the previous version of it to the current
|
||||
filename suffixed with a ~.
|
||||
|
||||
@item -D, --dos
|
||||
Write file in DOS format.
|
||||
|
||||
@item -E, --backupdir=[dir]
|
||||
Set the directory where @code{nano} puts the backup files if file
|
||||
backups are enabled.
|
||||
@@ -132,9 +129,6 @@ Enable multiple file buffers, if available.
|
||||
Don't look at SYSCONFDIR/nanorc or ~/.nanorc, if nanorc support is
|
||||
available.
|
||||
|
||||
@item -M, --mac
|
||||
Write file in Mac format.
|
||||
|
||||
@item -N, --noconvert
|
||||
Do not convert files from DOS/Mac format.
|
||||
|
||||
@@ -348,9 +342,6 @@ The following global toggles are available:
|
||||
@item Backup File Toggle (Meta-B)
|
||||
toggles the -B (@code{--backup}) command line flag.
|
||||
|
||||
@item DOS Format Toggle (Meta-D)
|
||||
toggles the -D (@code{--dos}) command line flag.
|
||||
|
||||
@item Multiple Files Toggle (Meta-F)
|
||||
toggles the -F (@code{--multibuffer}) command line flag.
|
||||
|
||||
@@ -369,9 +360,6 @@ toggles the -w (@code{--nowrap}) command line flag.
|
||||
@item Mouse Toggle (Meta-M)
|
||||
toggles the -m (@code{--mouse}) command line flag.
|
||||
|
||||
@item Mac Format Toggle (Meta-O)
|
||||
toggles the -M (@code{--mac}) command line flag.
|
||||
|
||||
@item Smooth Scrolling Toggle (Meta-S)
|
||||
toggles the -S (@code{--smooth}) command line flag.
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
EXTRA_DIST = ulonglong.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 \
|
||||
stdint_h.m4 uintmax_t.m4 isc-posix.m4 lib-ld.m4 lib-link.m4 \
|
||||
lib-prefix.m4 codeset.m4 glibc21.m4 progtest.m4 gettext.m4 \
|
||||
iconv.m4 lcmessage.m4
|
||||
iconv.m4 lcmessage.m4 glib-2.0.m4
|
||||
|
||||
212
m4/glib-2.0.m4
Normal file
212
m4/glib-2.0.m4
Normal file
@@ -0,0 +1,212 @@
|
||||
# Configure paths for GLIB
|
||||
# Owen Taylor 1997-2001
|
||||
|
||||
dnl AM_PATH_GLIB_2_0([MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND [, MODULES]]]])
|
||||
dnl Test for GLIB, and define GLIB_CFLAGS and GLIB_LIBS, if gmodule, gobject or
|
||||
dnl gthread is specified in MODULES, pass to pkg-config
|
||||
dnl
|
||||
AC_DEFUN([AM_PATH_GLIB_2_0],
|
||||
[dnl
|
||||
dnl Get the cflags and libraries from pkg-config
|
||||
dnl
|
||||
AC_ARG_ENABLE(glibtest, [ --disable-glibtest do not try to compile and run a test GLIB program],
|
||||
, enable_glibtest=yes)
|
||||
|
||||
pkg_config_args=glib-2.0
|
||||
for module in . $4
|
||||
do
|
||||
case "$module" in
|
||||
gmodule)
|
||||
pkg_config_args="$pkg_config_args gmodule-2.0"
|
||||
;;
|
||||
gobject)
|
||||
pkg_config_args="$pkg_config_args gobject-2.0"
|
||||
;;
|
||||
gthread)
|
||||
pkg_config_args="$pkg_config_args gthread-2.0"
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
AC_PATH_PROG(PKG_CONFIG, pkg-config, no)
|
||||
|
||||
no_glib=""
|
||||
|
||||
if test x$PKG_CONFIG != xno ; then
|
||||
if $PKG_CONFIG --atleast-pkgconfig-version 0.7 ; then
|
||||
:
|
||||
else
|
||||
echo *** pkg-config too old; version 0.7 or better required.
|
||||
no_glib=yes
|
||||
PKG_CONFIG=no
|
||||
fi
|
||||
else
|
||||
no_glib=yes
|
||||
fi
|
||||
|
||||
min_glib_version=ifelse([$1], ,2.0.0,$1)
|
||||
AC_MSG_CHECKING(for GLIB - version >= $min_glib_version)
|
||||
|
||||
if test x$PKG_CONFIG != xno ; then
|
||||
## don't try to run the test against uninstalled libtool libs
|
||||
if $PKG_CONFIG --uninstalled $pkg_config_args; then
|
||||
echo "Will use uninstalled version of GLib found in PKG_CONFIG_PATH"
|
||||
enable_glibtest=no
|
||||
fi
|
||||
|
||||
if $PKG_CONFIG --atleast-version $min_glib_version $pkg_config_args; then
|
||||
:
|
||||
else
|
||||
no_glib=yes
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x"$no_glib" = x ; then
|
||||
GLIB_GENMARSHAL=`$PKG_CONFIG --variable=glib_genmarshal glib-2.0`
|
||||
GOBJECT_QUERY=`$PKG_CONFIG --variable=gobject_query glib-2.0`
|
||||
GLIB_MKENUMS=`$PKG_CONFIG --variable=glib_mkenums glib-2.0`
|
||||
|
||||
GLIB_CFLAGS=`$PKG_CONFIG --cflags $pkg_config_args`
|
||||
GLIB_LIBS=`$PKG_CONFIG --libs $pkg_config_args`
|
||||
glib_config_major_version=`$PKG_CONFIG --modversion glib-2.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
|
||||
glib_config_minor_version=`$PKG_CONFIG --modversion glib-2.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
|
||||
glib_config_micro_version=`$PKG_CONFIG --modversion glib-2.0 | \
|
||||
sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
|
||||
if test "x$enable_glibtest" = "xyes" ; then
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$GLIB_LIBS $LIBS"
|
||||
dnl
|
||||
dnl Now check if the installed GLIB is sufficiently new. (Also sanity
|
||||
dnl checks the results of pkg-config to some extent)
|
||||
dnl
|
||||
rm -f conf.glibtest
|
||||
AC_TRY_RUN([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
int major, minor, micro;
|
||||
char *tmp_version;
|
||||
|
||||
system ("touch conf.glibtest");
|
||||
|
||||
/* HP/UX 9 (%@#!) writes to sscanf strings */
|
||||
tmp_version = g_strdup("$min_glib_version");
|
||||
if (sscanf(tmp_version, "%d.%d.%d", &major, &minor, µ) != 3) {
|
||||
printf("%s, bad version string\n", "$min_glib_version");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
if ((glib_major_version != $glib_config_major_version) ||
|
||||
(glib_minor_version != $glib_config_minor_version) ||
|
||||
(glib_micro_version != $glib_config_micro_version))
|
||||
{
|
||||
printf("\n*** 'pkg-config --modversion glib-2.0' returned %d.%d.%d, but GLIB (%d.%d.%d)\n",
|
||||
$glib_config_major_version, $glib_config_minor_version, $glib_config_micro_version,
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf ("*** was found! If pkg-config was correct, then it is best\n");
|
||||
printf ("*** to remove the old version of GLib. You may also be able to fix the error\n");
|
||||
printf("*** by modifying your LD_LIBRARY_PATH enviroment variable, or by editing\n");
|
||||
printf("*** /etc/ld.so.conf. Make sure you have run ldconfig if that is\n");
|
||||
printf("*** required on your system.\n");
|
||||
printf("*** If pkg-config was wrong, set the environment variable PKG_CONFIG_PATH\n");
|
||||
printf("*** to point to the correct configuration files\n");
|
||||
}
|
||||
else if ((glib_major_version != GLIB_MAJOR_VERSION) ||
|
||||
(glib_minor_version != GLIB_MINOR_VERSION) ||
|
||||
(glib_micro_version != GLIB_MICRO_VERSION))
|
||||
{
|
||||
printf("*** GLIB header files (version %d.%d.%d) do not match\n",
|
||||
GLIB_MAJOR_VERSION, GLIB_MINOR_VERSION, GLIB_MICRO_VERSION);
|
||||
printf("*** library (version %d.%d.%d)\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ((glib_major_version > major) ||
|
||||
((glib_major_version == major) && (glib_minor_version > minor)) ||
|
||||
((glib_major_version == major) && (glib_minor_version == minor) && (glib_micro_version >= micro)))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
printf("\n*** An old version of GLIB (%d.%d.%d) was found.\n",
|
||||
glib_major_version, glib_minor_version, glib_micro_version);
|
||||
printf("*** You need a version of GLIB newer than %d.%d.%d. The latest version of\n",
|
||||
major, minor, micro);
|
||||
printf("*** GLIB is always available from ftp://ftp.gtk.org.\n");
|
||||
printf("***\n");
|
||||
printf("*** If you have already installed a sufficiently new version, this error\n");
|
||||
printf("*** probably means that the wrong copy of the pkg-config shell script is\n");
|
||||
printf("*** being found. The easiest way to fix this is to remove the old version\n");
|
||||
printf("*** of GLIB, but you can also set the PKG_CONFIG environment to point to the\n");
|
||||
printf("*** correct copy of pkg-config. (In this case, you will have to\n");
|
||||
printf("*** modify your LD_LIBRARY_PATH enviroment variable, or edit /etc/ld.so.conf\n");
|
||||
printf("*** so that the correct libraries are found at run-time))\n");
|
||||
}
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
],, no_glib=yes,[echo $ac_n "cross compiling; assumed OK... $ac_c"])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
if test "x$no_glib" = x ; then
|
||||
AC_MSG_RESULT(yes (version $glib_config_major_version.$glib_config_minor_version.$glib_config_micro_version))
|
||||
ifelse([$2], , :, [$2])
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
if test "$PKG_CONFIG" = "no" ; then
|
||||
echo "*** A new enough version of pkg-config was not found."
|
||||
echo "*** See http://www.freedesktop.org/software/pkgconfig/"
|
||||
else
|
||||
if test -f conf.glibtest ; then
|
||||
:
|
||||
else
|
||||
echo "*** Could not run GLIB test program, checking why..."
|
||||
ac_save_CFLAGS="$CFLAGS"
|
||||
ac_save_LIBS="$LIBS"
|
||||
CFLAGS="$CFLAGS $GLIB_CFLAGS"
|
||||
LIBS="$LIBS $GLIB_LIBS"
|
||||
AC_TRY_LINK([
|
||||
#include <glib.h>
|
||||
#include <stdio.h>
|
||||
], [ return ((glib_major_version) || (glib_minor_version) || (glib_micro_version)); ],
|
||||
[ echo "*** The test program compiled, but did not run. This usually means"
|
||||
echo "*** that the run-time linker is not finding GLIB or finding the wrong"
|
||||
echo "*** version of GLIB. If it is not finding GLIB, you'll need to set your"
|
||||
echo "*** LD_LIBRARY_PATH environment variable, or edit /etc/ld.so.conf to point"
|
||||
echo "*** to the installed location Also, make sure you have run ldconfig if that"
|
||||
echo "*** is required on your system"
|
||||
echo "***"
|
||||
echo "*** If you have an old version installed, it is best to remove it, although"
|
||||
echo "*** you may also be able to get things to work by modifying LD_LIBRARY_PATH" ],
|
||||
[ echo "*** The test program failed to compile or link. See the file config.log for the"
|
||||
echo "*** exact error that occured. This usually means GLIB is incorrectly installed."])
|
||||
CFLAGS="$ac_save_CFLAGS"
|
||||
LIBS="$ac_save_LIBS"
|
||||
fi
|
||||
fi
|
||||
GLIB_CFLAGS=""
|
||||
GLIB_LIBS=""
|
||||
GLIB_GENMARSHAL=""
|
||||
GOBJECT_QUERY=""
|
||||
GLIB_MKENUMS=""
|
||||
ifelse([$3], , :, [$3])
|
||||
fi
|
||||
AC_SUBST(GLIB_CFLAGS)
|
||||
AC_SUBST(GLIB_LIBS)
|
||||
AC_SUBST(GLIB_GENMARSHAL)
|
||||
AC_SUBST(GOBJECT_QUERY)
|
||||
AC_SUBST(GLIB_MKENUMS)
|
||||
rm -f conf.glibtest
|
||||
])
|
||||
30
po/ChangeLog
30
po/ChangeLog
@@ -1,3 +1,33 @@
|
||||
2004-11-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated French translation by
|
||||
Jean-Philippe Guérard.
|
||||
|
||||
2004-11-18 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ms.po: Updated Malay translation by
|
||||
Sharuzzaman Ahmat Raslan.
|
||||
|
||||
2004-10-07 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* eu.po: Updated Basque translation by
|
||||
Mikel Olasagasti.
|
||||
|
||||
2004-08-31 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation by
|
||||
Ricardo Javier Cárdenes Medina.
|
||||
|
||||
2004-08-31 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* fr.po: Updated Catalan translation by
|
||||
Jean-Philippe Guérard.
|
||||
|
||||
2004-08-27 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* ca.po: Updated Catalan translation.
|
||||
* de.po: Updated German translation by Michael Piefel.
|
||||
|
||||
2004-06-01 Jordi Mallach <jordi@gnu.org>
|
||||
|
||||
* zh_TW.po: Added Traditional Chinese translation by
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# Tranditional Chinese Messages for the nano editor
|
||||
# Traditional Chinese Messages for the nano editor
|
||||
# Copyright (C) 2004 Free Software Foundation, Inc.
|
||||
# This file is distributed under the same license as the nano package.
|
||||
# 趙惟倫 <chaoweilun@pcmail.com.tw>, 2004
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
DEFS= -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
localedir = $(datadir)/locale
|
||||
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -I@includedir@
|
||||
INCLUDES = -Iintl -DLOCALEDIR=\"$(localedir)\" -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
|
||||
|
||||
@@ -19,13 +19,14 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
110
src/cut.c
110
src/cut.c
@@ -19,7 +19,9 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -30,11 +32,10 @@
|
||||
|
||||
static bool keep_cutbuffer = FALSE;
|
||||
/* Should we keep the contents of the cutbuffer? */
|
||||
static int marked_cut;
|
||||
/* Is the cutbuffer from a mark? 0 means whole-line cut, 1
|
||||
* means mark, and 2 means cut-from-cursor. */
|
||||
static cut_type marked_cut = CUT_LINE;
|
||||
/* What type of cut is in the cutbuffer? */
|
||||
#ifndef NANO_SMALL
|
||||
static bool concatenate_cut;
|
||||
static bool concatenate_cut = FALSE;
|
||||
/* Should we add this cut string to the end of the last one? */
|
||||
#endif
|
||||
static filestruct *cutbottom = NULL;
|
||||
@@ -60,8 +61,8 @@ void add_to_cutbuffer(filestruct *inptr, bool allow_concat)
|
||||
cutbuffer = inptr;
|
||||
#ifndef NANO_SMALL
|
||||
else if (allow_concat && concatenate_cut) {
|
||||
/* Just tack the text in inptr onto the text in cutbottom,
|
||||
* unless allow_concat is FALSE. */
|
||||
/* If allow_concat is TRUE and we're concatenating, tack the
|
||||
* text in inptr onto the text in cutbottom. */
|
||||
cutbottom->data = charealloc(cutbottom->data,
|
||||
strlen(cutbottom->data) + strlen(inptr->data) + 1);
|
||||
strcat(cutbottom->data, inptr->data);
|
||||
@@ -106,7 +107,7 @@ void cut_marked_segment(void)
|
||||
/* Set up the top and bottom lines and coordinates of the marked
|
||||
* text. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x);
|
||||
(const filestruct **)&bot, &bot_x, NULL);
|
||||
|
||||
/* Make the first cut line manually. Move the cut part of the top
|
||||
* line into tmp, and set newsize to that partial line's length. */
|
||||
@@ -121,9 +122,26 @@ void cut_marked_segment(void)
|
||||
cutbuffer = tmp;
|
||||
cutbottom = tmp;
|
||||
} else {
|
||||
if (concatenate_cut) {
|
||||
/* If we're concatenating, tack the text in the first line
|
||||
* of tmp onto the text in the bottom of the cutbuffer, and
|
||||
* move tmp one line down to where its next line begins. */
|
||||
cutbottom->data = charealloc(cutbottom->data,
|
||||
strlen(cutbottom->data) + strlen(tmp->data) + 1);
|
||||
strcat(cutbottom->data, tmp->data);
|
||||
tmp = tmp->next;
|
||||
}
|
||||
|
||||
/* Put tmp on the line after the bottom of the cutbuffer. */
|
||||
cutbottom->next = tmp;
|
||||
tmp->prev = cutbottom;
|
||||
cutbottom = tmp;
|
||||
|
||||
if (!concatenate_cut) {
|
||||
/* Tf we're not concatenating, attach tmp to the bottom of
|
||||
* the cutbuffer, and then move the bottom of the cutbuffer
|
||||
* one line down to where tmp is. */
|
||||
tmp->prev = cutbottom;
|
||||
cutbottom = tmp;
|
||||
}
|
||||
}
|
||||
|
||||
/* And make the top remainder line manually too. Update current_x
|
||||
@@ -205,12 +223,12 @@ void do_cut_text(void)
|
||||
|
||||
assert(current != NULL && current->data != NULL);
|
||||
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
|
||||
if (!keep_cutbuffer) {
|
||||
free_filestruct(cutbuffer);
|
||||
cutbuffer = NULL;
|
||||
marked_cut = 0;
|
||||
marked_cut = CUT_LINE;
|
||||
#ifndef NANO_SMALL
|
||||
concatenate_cut = FALSE;
|
||||
#endif
|
||||
@@ -223,26 +241,25 @@ void do_cut_text(void)
|
||||
* does clear the cutbuffer if keep_cutbuffer is FALSE. */
|
||||
if (current == filebot
|
||||
#ifndef NANO_SMALL
|
||||
&& !ISSET(MARK_ISSET)
|
||||
&& !ISSET(MARK_ISSET)
|
||||
#endif
|
||||
)
|
||||
)
|
||||
return;
|
||||
|
||||
keep_cutbuffer = TRUE;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(CUT_TO_END) && !ISSET(MARK_ISSET)) {
|
||||
assert(current_x >= 0 && current_x <= strlen(current->data));
|
||||
assert(current_x <= strlen(current->data));
|
||||
|
||||
if (current->data[current_x] == '\0') {
|
||||
/* If the line is empty and we didn't just cut a non-blank
|
||||
* line, create a dummy blank line and add it to the
|
||||
* cutbuffer. */
|
||||
if (marked_cut != 1 && current->next != filebot) {
|
||||
if (marked_cut != CUT_MARKED && current->next != filebot) {
|
||||
filestruct *junk = make_new_node(current);
|
||||
|
||||
junk->data = charalloc(1);
|
||||
junk->data[0] = '\0';
|
||||
junk->data = mallocstrcpy(NULL, "");
|
||||
add_to_cutbuffer(junk, TRUE);
|
||||
#ifdef DEBUG
|
||||
dump_buffer(cutbuffer);
|
||||
@@ -250,7 +267,7 @@ void do_cut_text(void)
|
||||
}
|
||||
|
||||
do_delete();
|
||||
marked_cut = 2;
|
||||
marked_cut = CUT_TO_EOL;
|
||||
return;
|
||||
} else {
|
||||
SET(MARK_ISSET);
|
||||
@@ -266,12 +283,9 @@ void do_cut_text(void)
|
||||
placewewant = xplustabs();
|
||||
UNSET(MARK_ISSET);
|
||||
|
||||
/* If we just did a marked cut of part of a line, we should add
|
||||
* the first line of any cut done immediately afterward to the
|
||||
* end of this cut, as Pico does. */
|
||||
if (current == mark_beginbuf && current_x < strlen(current->data))
|
||||
concatenate_cut = TRUE;
|
||||
marked_cut = 1;
|
||||
marked_cut = CUT_MARKED;
|
||||
concatenate_cut = TRUE;
|
||||
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
return;
|
||||
@@ -300,7 +314,7 @@ void do_cut_text(void)
|
||||
current_x = 0;
|
||||
edit_refresh();
|
||||
set_modified();
|
||||
marked_cut = 0;
|
||||
marked_cut = CUT_LINE;
|
||||
#ifndef NANO_SMALL
|
||||
concatenate_cut = FALSE;
|
||||
#endif
|
||||
@@ -315,7 +329,7 @@ void do_uncut_text(void)
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
if (cutbuffer == NULL || current == NULL)
|
||||
return; /* AIEEEEEEEEEEEE */
|
||||
|
||||
@@ -323,9 +337,9 @@ void do_uncut_text(void)
|
||||
* we're not at the beginning of the line. If we are at the
|
||||
* beginning of the line, set placewewant to 0. Pico does both of
|
||||
* these. */
|
||||
if (marked_cut == 0) {
|
||||
if (current_x != 0)
|
||||
marked_cut = 2;
|
||||
if (marked_cut == CUT_LINE) {
|
||||
if (current_x > 0)
|
||||
marked_cut = CUT_TO_EOL;
|
||||
else
|
||||
placewewant = 0;
|
||||
}
|
||||
@@ -335,7 +349,7 @@ void do_uncut_text(void)
|
||||
if (current->next == NULL)
|
||||
new_magicline();
|
||||
|
||||
if (marked_cut == 0 || cutbuffer->next != NULL) {
|
||||
if (marked_cut == CUT_LINE || cutbuffer->next != NULL) {
|
||||
newbuf = copy_filestruct(cutbuffer);
|
||||
for (newend = newbuf; newend->next != NULL && newend != NULL;
|
||||
newend = newend->next)
|
||||
@@ -343,7 +357,7 @@ void do_uncut_text(void)
|
||||
}
|
||||
|
||||
/* Hook newbuf in at current. */
|
||||
if (marked_cut != 0) {
|
||||
if (marked_cut != CUT_LINE) {
|
||||
filestruct *hold = current;
|
||||
|
||||
/* If there's only one line in the cutbuffer... */
|
||||
@@ -351,10 +365,12 @@ void do_uncut_text(void)
|
||||
size_t buf_len = strlen(cutbuffer->data);
|
||||
size_t cur_len = strlen(current->data);
|
||||
|
||||
current->data = charealloc(current->data, cur_len + buf_len + 1);
|
||||
current->data = charealloc(current->data, cur_len +
|
||||
buf_len + 1);
|
||||
charmove(current->data + current_x + buf_len,
|
||||
current->data + current_x, cur_len - current_x + 1);
|
||||
strncpy(current->data + current_x, cutbuffer->data, buf_len);
|
||||
current->data + current_x, cur_len - current_x + 1);
|
||||
strncpy(current->data + current_x, cutbuffer->data,
|
||||
buf_len);
|
||||
/* Use strncpy() to not copy the null terminator. */
|
||||
|
||||
current_x += buf_len;
|
||||
@@ -374,7 +390,7 @@ void do_uncut_text(void)
|
||||
|
||||
/* New end. */
|
||||
tmpstr2 = charalloc(strlen(newend->data) +
|
||||
strlen(¤t->data[current_x]) + 1);
|
||||
strlen(¤t->data[current_x]) + 1);
|
||||
strcpy(tmpstr2, newend->data);
|
||||
strcat(tmpstr2, ¤t->data[current_x]);
|
||||
|
||||
@@ -401,17 +417,19 @@ void do_uncut_text(void)
|
||||
new_magicline();
|
||||
}
|
||||
|
||||
/* Now why don't we update the totsize also? */
|
||||
for (tmp = current->next; tmp != newend; tmp = tmp->next)
|
||||
/* Recalculate current_y and totsize. */
|
||||
for (tmp = current->next; tmp != newend; tmp = tmp->next) {
|
||||
current_y++;
|
||||
totsize += strlen(tmp->data) + 1;
|
||||
}
|
||||
|
||||
current = newend;
|
||||
}
|
||||
|
||||
/* If marked cut == 2, it means that we're doing a cut to end
|
||||
* and we don't want anything else on the line, so we have to
|
||||
* screw up all the work we just did and separate the line. */
|
||||
if (marked_cut == 2) {
|
||||
/* If we're doing a cut to end, we don't want anything else on
|
||||
* the line, so we have to screw up all the work we just did and
|
||||
* separate the line. */
|
||||
if (marked_cut == CUT_TO_EOL) {
|
||||
tmp = make_new_node(current);
|
||||
tmp->data = mallocstrcpy(NULL, current->data + current_x);
|
||||
splice_node(current, tmp, current->next);
|
||||
@@ -424,6 +442,7 @@ void do_uncut_text(void)
|
||||
totlines++;
|
||||
totsize++;
|
||||
}
|
||||
|
||||
/* Renumber from BEFORE where we pasted ;) */
|
||||
renumber(hold);
|
||||
|
||||
@@ -442,6 +461,7 @@ void do_uncut_text(void)
|
||||
newbuf->prev = tmp;
|
||||
} else
|
||||
fileage = newbuf;
|
||||
|
||||
totlines++; /* Unmarked uncuts don't split lines. */
|
||||
|
||||
/* This is so uncutting at the top of the buffer will work => */
|
||||
@@ -452,9 +472,11 @@ void do_uncut_text(void)
|
||||
newend->next = current;
|
||||
current->prev = newend;
|
||||
|
||||
/* Recalculate size *sigh* */
|
||||
for (tmp = newbuf; tmp != current; tmp = tmp->next)
|
||||
/* Recalculate current_y and totsize. */
|
||||
for (tmp = newbuf; tmp != current; tmp = tmp->next) {
|
||||
current_y++;
|
||||
totsize += strlen(tmp->data) + 1;
|
||||
}
|
||||
|
||||
renumber(newbuf);
|
||||
edit_refresh();
|
||||
|
||||
1184
src/files.c
1184
src/files.c
File diff suppressed because it is too large
Load Diff
229
src/global.c
229
src/global.c
@@ -19,11 +19,12 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <assert.h>
|
||||
#include <sys/stat.h>
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
@@ -52,15 +53,18 @@ struct stat originalfilestat; /* Stat for the file as we loaded it */
|
||||
int editwinrows = 0; /* How many rows long is the edit
|
||||
window? */
|
||||
filestruct *current; /* Current buffer pointer */
|
||||
int current_x = 0, current_y = 0; /* Current position of X and Y in
|
||||
the editor - relative to edit
|
||||
window (0,0) */
|
||||
size_t current_x = 0; /* Current x-coordinate in the edit
|
||||
window */
|
||||
int current_y = 0; /* Current y-coordinate in the edit
|
||||
window */
|
||||
filestruct *fileage = NULL; /* Our file buffer */
|
||||
filestruct *edittop = NULL; /* Pointer to the top of the edit
|
||||
buffer with respect to the
|
||||
file struct */
|
||||
filestruct *filebot = NULL; /* Last node in the file struct */
|
||||
filestruct *cutbuffer = NULL; /* A place to store cut text */
|
||||
partition *filepart = NULL; /* A place to store a portion of the
|
||||
file struct */
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
openfilestruct *open_files = NULL; /* The list of open files */
|
||||
@@ -93,8 +97,6 @@ size_t quotelen; /* strlen(quotestr) */
|
||||
char *backup_dir = NULL; /* Backup directory. */
|
||||
#endif
|
||||
|
||||
int resetstatuspos; /* Hack for resetting the status bar
|
||||
cursor position */
|
||||
char *answer = NULL; /* Answer str to many questions */
|
||||
int totlines = 0; /* Total number of lines in the file */
|
||||
long totsize = 0; /* Total number of bytes in the file */
|
||||
@@ -114,7 +116,7 @@ char *help_text; /* The text in the help window */
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
filestruct *mark_beginbuf; /* The begin marker buffer */
|
||||
int mark_beginx; /* X value in the string to start */
|
||||
size_t mark_beginx; /* X value in the string to start */
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_OPERATINGDIR
|
||||
@@ -130,7 +132,7 @@ shortcut *main_list = NULL;
|
||||
shortcut *whereis_list = NULL;
|
||||
shortcut *replace_list = NULL;
|
||||
shortcut *replace_list_2 = NULL; /* 2nd half of replace dialog */
|
||||
shortcut *goto_list = NULL;
|
||||
shortcut *gotoline_list = NULL;
|
||||
shortcut *writefile_list = NULL;
|
||||
shortcut *insertfile_list = NULL;
|
||||
#ifndef DISABLE_HELP
|
||||
@@ -224,7 +226,7 @@ void sc_init_one(shortcut **shortcutage, int ctrlval, const char *desc,
|
||||
s->next = NULL;
|
||||
}
|
||||
|
||||
void shortcut_init(int unjustify)
|
||||
void shortcut_init(bool unjustify)
|
||||
{
|
||||
const char *get_help_msg = N_("Get Help");
|
||||
const char *exit_msg = N_("Exit");
|
||||
@@ -235,6 +237,11 @@ void shortcut_init(int unjustify)
|
||||
const char *cancel_msg = N_("Cancel");
|
||||
const char *first_line_msg = N_("First Line");
|
||||
const char *last_line_msg = N_("Last Line");
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *beg_of_par_msg = N_("Beg of Par");
|
||||
const char *end_of_par_msg = N_("End of Par");
|
||||
const char *fulljstify_msg = N_("FullJstify");
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
const char *case_sens_msg = N_("Case Sens");
|
||||
const char *direction_msg = N_("Direction");
|
||||
@@ -242,6 +249,9 @@ void shortcut_init(int unjustify)
|
||||
const char *regexp_msg = N_("Regexp");
|
||||
#endif
|
||||
const char *history_msg = N_("History");
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *new_buffer_msg = N_("New Buffer");
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
#ifndef DISABLE_BROWSER
|
||||
const char *to_files_msg = N_("To Files");
|
||||
@@ -269,8 +279,12 @@ void shortcut_init(int unjustify)
|
||||
N_("Uncut from the cutbuffer into the current line");
|
||||
const char *nano_cursorpos_msg = N_("Show the position of the cursor");
|
||||
const char *nano_spell_msg = N_("Invoke the spell checker, if available");
|
||||
const char *nano_goto_msg = N_("Go to a specific line number");
|
||||
const char *nano_gotoline_msg = N_("Go to a specific line number");
|
||||
const char *nano_replace_msg = N_("Replace text within the editor");
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_mark_msg = N_("Mark text at the cursor position");
|
||||
const char *nano_whereis_next_msg = N_("Repeat last search");
|
||||
#endif
|
||||
const char *nano_prevline_msg = N_("Move to the previous line");
|
||||
const char *nano_nextline_msg = N_("Move to the next line");
|
||||
const char *nano_forward_msg = N_("Move forward one character");
|
||||
@@ -278,38 +292,37 @@ void shortcut_init(int unjustify)
|
||||
const char *nano_home_msg = N_("Move to the beginning of the current line");
|
||||
const char *nano_end_msg = N_("Move to the end of the current line");
|
||||
const char *nano_refresh_msg = N_("Refresh (redraw) the current screen");
|
||||
const char *nano_mark_msg = N_("Mark text at the current cursor location");
|
||||
const char *nano_delete_msg = N_("Delete the character under the cursor");
|
||||
const char *nano_backspace_msg =
|
||||
N_("Delete the character to the left of the cursor");
|
||||
const char *nano_tab_msg = N_("Insert a tab character");
|
||||
const char *nano_tab_msg =
|
||||
N_("Insert a tab character at the cursor position");
|
||||
const char *nano_enter_msg =
|
||||
N_("Insert a carriage return at the cursor position");
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_nextword_msg = N_("Move forward one word");
|
||||
const char *nano_prevword_msg = N_("Move backward one word");
|
||||
#endif
|
||||
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *nano_openprev_msg = N_("Switch to previous file buffer");
|
||||
const char *nano_opennext_msg = N_("Switch to next file buffer");
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef HAVE_REGEX_H
|
||||
const char *nano_bracket_msg = N_("Find other bracket");
|
||||
#endif
|
||||
const char *nano_whereis_next_msg = N_("Repeat last search");
|
||||
#endif
|
||||
const char *nano_cancel_msg = N_("Cancel the current function");
|
||||
const char *nano_firstline_msg = N_("Go to the first line of the file");
|
||||
const char *nano_lastline_msg = N_("Go to the last line of the file");
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *nano_parabegin_msg =
|
||||
N_("Go to the beginning of the current paragraph");
|
||||
const char *nano_paraend_msg =
|
||||
N_("Go to the end of the current paragraph");
|
||||
#endif
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
const char *nano_openprev_msg = N_("Switch to the previous file buffer");
|
||||
const char *nano_opennext_msg = N_("Switch to the next file buffer");
|
||||
#endif
|
||||
const char *nano_verbatim_msg = N_("Insert character(s) verbatim");
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
const char *nano_fulljustify_msg = N_("Justify the entire file");
|
||||
#endif
|
||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
||||
const char *nano_bracket_msg = N_("Find other bracket");
|
||||
#endif
|
||||
const char *nano_cancel_msg = N_("Cancel the current function");
|
||||
const char *nano_firstline_msg = N_("Go to the first line of the file");
|
||||
const char *nano_lastline_msg = N_("Go to the last line of the file");
|
||||
#ifndef NANO_SMALL
|
||||
const char *nano_case_msg =
|
||||
N_("Make the current search/replace case (in)sensitive");
|
||||
@@ -367,7 +380,8 @@ void shortcut_init(int unjustify)
|
||||
);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
if (open_files != NULL && (open_files->prev != NULL || open_files->next != NULL))
|
||||
if (open_files != NULL && (open_files->prev != NULL ||
|
||||
open_files->next != NULL))
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_EXIT_KEY, N_("Close"),
|
||||
IFHELP(nano_exit_msg, NANO_NO_KEY), NANO_EXIT_FKEY,
|
||||
@@ -409,7 +423,8 @@ void shortcut_init(int unjustify)
|
||||
#else
|
||||
NOVIEW
|
||||
#endif
|
||||
, !ISSET(RESTRICTED) ? do_insertfile_void : nano_disabled_msg);
|
||||
, !ISSET(RESTRICTED) ? do_insertfile_void :
|
||||
nano_disabled_msg);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_WHEREIS_KEY, N_("Where Is"),
|
||||
@@ -459,13 +474,23 @@ void shortcut_init(int unjustify)
|
||||
#endif
|
||||
nano_disabled_msg);
|
||||
|
||||
sc_init_one(&main_list, NANO_GOTO_KEY, go_to_line_msg,
|
||||
IFHELP(nano_goto_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
sc_init_one(&main_list, NANO_GOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_GOTOLINE_ALTKEY),
|
||||
NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
|
||||
sc_init_one(&main_list, NANO_REPLACE_KEY, replace_msg,
|
||||
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY), NANO_REPLACE_FKEY,
|
||||
NANO_NO_KEY, NOVIEW, do_replace);
|
||||
IFHELP(nano_replace_msg, NANO_ALT_REPLACE_KEY),
|
||||
NANO_REPLACE_FKEY, NANO_NO_KEY, NOVIEW, do_replace);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
|
||||
IFHELP(nano_mark_msg, NANO_MARK_ALTKEY), NANO_MARK_FKEY,
|
||||
NANO_NO_KEY, NOVIEW, do_mark);
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"),
|
||||
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
|
||||
NANO_WHEREIS_NEXT_FKEY, NANO_NO_KEY, VIEW, do_research);
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list, NANO_PREVLINE_KEY, N_("Prev Line"),
|
||||
IFHELP(nano_prevline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
@@ -495,16 +520,6 @@ void shortcut_init(int unjustify)
|
||||
IFHELP(nano_refresh_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, total_refresh);
|
||||
|
||||
sc_init_one(&main_list, NANO_MARK_KEY, N_("Mark Text"),
|
||||
IFHELP(nano_mark_msg, NANO_ALT_MARK_KEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW,
|
||||
#ifndef NANO_SMALL
|
||||
do_mark
|
||||
#else
|
||||
nano_disabled_msg
|
||||
#endif
|
||||
);
|
||||
|
||||
sc_init_one(&main_list, NANO_DELETE_KEY, N_("Delete"),
|
||||
IFHELP(nano_delete_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, do_delete);
|
||||
@@ -531,9 +546,17 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, do_prev_word);
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
|
||||
IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, do_verbatim_input);
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_NO_KEY, beg_of_par_msg,
|
||||
IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_NO_KEY, end_of_par_msg,
|
||||
IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARAEND_ALTKEY2, VIEW, do_para_end);
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Previous File"),
|
||||
@@ -545,18 +568,23 @@ void shortcut_init(int unjustify)
|
||||
NANO_OPENNEXT_ALTKEY, VIEW, open_nextfile_void);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
#ifdef HAVE_REGEX_H
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Verbatim Input"),
|
||||
IFHELP(nano_verbatim_msg, NANO_VERBATIM_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, do_verbatim_input);
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&main_list, NANO_NO_KEY, fulljstify_msg,
|
||||
IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
|
||||
#endif
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(HAVE_REGEX_H)
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Find Other Bracket"),
|
||||
IFHELP(nano_bracket_msg, NANO_BRACKET_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_find_bracket);
|
||||
#endif
|
||||
|
||||
sc_init_one(&main_list, NANO_NO_KEY, N_("Where Is Next"),
|
||||
IFHELP(nano_whereis_next_msg, NANO_WHEREIS_NEXT_KEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, VIEW, do_research);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&whereis_list);
|
||||
|
||||
sc_init_one(&whereis_list, NANO_HELP_KEY, get_help_msg,
|
||||
@@ -585,30 +613,25 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_OTHERSEARCH_KEY, replace_msg,
|
||||
sc_init_one(&whereis_list, NANO_TOOTHERSEARCH_KEY, replace_msg,
|
||||
IFHELP(nano_replace_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_replace);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_FROMSEARCHTOGOTO_KEY, go_to_line_msg,
|
||||
IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
|
||||
sc_init_one(&whereis_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, N_("Beg of Par"),
|
||||
IFHELP(nano_parabegin_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_para_begin);
|
||||
sc_init_one(&whereis_list, NANO_PARABEGIN_KEY, beg_of_par_msg,
|
||||
IFHELP(nano_parabegin_msg, NANO_PARABEGIN_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARABEGIN_ALTKEY2, VIEW, do_para_begin);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_PARAEND_KEY, N_("End of Par"),
|
||||
IFHELP(nano_paraend_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_para_end);
|
||||
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, N_("FullJstify"),
|
||||
IFHELP(nano_fulljustify_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, do_full_justify);
|
||||
sc_init_one(&whereis_list, NANO_PARAEND_KEY, end_of_par_msg,
|
||||
IFHELP(nano_paraend_msg, NANO_PARAEND_ALTKEY1), NANO_NO_KEY,
|
||||
NANO_PARAEND_ALTKEY2, VIEW, do_para_end);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -629,13 +652,17 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_HISTORY_KEY, history_msg,
|
||||
IFHELP(nano_editstr_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_JUSTIFY
|
||||
/* Translators: try to keep this string under 10 characters long */
|
||||
sc_init_one(&whereis_list, NANO_FULLJUSTIFY_KEY, fulljstify_msg,
|
||||
IFHELP(nano_fulljustify_msg, NANO_FULLJUSTIFY_ALTKEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, do_full_justify);
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
|
||||
free_shortcutage(&replace_list);
|
||||
@@ -663,12 +690,12 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
/* Translators: try to keep this string under 12 characters long */
|
||||
sc_init_one(&replace_list, NANO_OTHERSEARCH_KEY, N_("No Replace"),
|
||||
sc_init_one(&replace_list, NANO_TOOTHERSEARCH_KEY, N_("No Replace"),
|
||||
IFHELP(nano_whereis_msg, NANO_NO_KEY), NANO_REPLACE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_search);
|
||||
|
||||
sc_init_one(&replace_list, NANO_FROMSEARCHTOGOTO_KEY, go_to_line_msg,
|
||||
IFHELP(nano_goto_msg, NANO_NO_KEY), NANO_GOTO_FKEY,
|
||||
sc_init_one(&replace_list, NANO_TOGOTOLINE_KEY, go_to_line_msg,
|
||||
IFHELP(nano_gotoline_msg, NANO_NO_KEY), NANO_GOTOLINE_FKEY,
|
||||
NANO_NO_KEY, VIEW, do_gotoline_void);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -721,9 +748,9 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
#endif
|
||||
|
||||
free_shortcutage(&goto_list);
|
||||
free_shortcutage(&gotoline_list);
|
||||
|
||||
sc_init_one(&goto_list, NANO_HELP_KEY, get_help_msg,
|
||||
sc_init_one(&gotoline_list, NANO_HELP_KEY, get_help_msg,
|
||||
IFHELP(nano_help_msg, NANO_NO_KEY), NANO_HELP_FKEY,
|
||||
NANO_NO_KEY, VIEW,
|
||||
#ifndef DISABLE_HELP
|
||||
@@ -733,18 +760,22 @@ void shortcut_init(int unjustify)
|
||||
#endif
|
||||
);
|
||||
|
||||
sc_init_one(&goto_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
sc_init_one(&gotoline_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
|
||||
sc_init_one(&goto_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||
sc_init_one(&gotoline_list, NANO_FIRSTLINE_KEY, first_line_msg,
|
||||
IFHELP(nano_firstline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_first_line);
|
||||
|
||||
sc_init_one(&goto_list, NANO_LASTLINE_KEY, last_line_msg,
|
||||
sc_init_one(&gotoline_list, NANO_LASTLINE_KEY, last_line_msg,
|
||||
IFHELP(nano_lastline_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, do_last_line);
|
||||
|
||||
sc_init_one(&gotoline_list, NANO_TOOTHERWHEREIS_KEY,
|
||||
N_("Go To Text"), IFHELP(nano_whereis_msg, NANO_NO_KEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, VIEW, do_search);
|
||||
|
||||
#ifndef DISABLE_HELP
|
||||
free_shortcutage(&help_list);
|
||||
|
||||
@@ -865,18 +896,18 @@ void shortcut_init(int unjustify)
|
||||
* It's useless since inserting files is disabled. */
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&insertfile_list, NANO_EXTCMD_KEY, N_("Execute Command"),
|
||||
IFHELP(nano_execute_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
sc_init_one(&insertfile_list, NANO_TOOTHERINSERT_KEY,
|
||||
N_("Execute Command"), IFHELP(nano_execute_msg,
|
||||
NANO_NO_KEY), NANO_NO_KEY, NANO_NO_KEY, NOVIEW, 0);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
/* If we're using restricted mode, the multibuffer toggle is
|
||||
* disabled. It's useless since inserting files is disabled. */
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
if (!ISSET(RESTRICTED))
|
||||
sc_init_one(&insertfile_list, NANO_NO_KEY, _("New Buffer"),
|
||||
IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, NOVIEW, 0);
|
||||
sc_init_one(&insertfile_list, NANO_NO_KEY, new_buffer_msg,
|
||||
IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -914,6 +945,16 @@ void shortcut_init(int unjustify)
|
||||
sc_init_one(&extcmd_list, NANO_CANCEL_KEY, cancel_msg,
|
||||
IFHELP(nano_cancel_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
|
||||
sc_init_one(&extcmd_list, NANO_TOOTHERINSERT_KEY, N_("Insert File"),
|
||||
IFHELP(nano_insert_msg, NANO_NO_KEY), NANO_NO_KEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
sc_init_one(&extcmd_list, NANO_NO_KEY, new_buffer_msg,
|
||||
IFHELP(nano_multibuffer_msg, TOGGLE_MULTIBUFFER_KEY),
|
||||
NANO_NO_KEY, NANO_NO_KEY, NOVIEW, 0);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef DISABLE_BROWSER
|
||||
@@ -942,9 +983,9 @@ void shortcut_init(int unjustify)
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
|
||||
/* Translators: try to keep this string under 22 characters long */
|
||||
sc_init_one(&browser_list, NANO_GOTO_KEY, N_("Go To Dir"),
|
||||
IFHELP(nano_gotodir_msg, NANO_ALT_GOTO_KEY), NANO_GOTO_FKEY,
|
||||
NANO_NO_KEY, VIEW, 0);
|
||||
sc_init_one(&browser_list, NANO_GOTOLINE_KEY, N_("Go To Dir"),
|
||||
IFHELP(nano_gotodir_msg, NANO_GOTOLINE_ALTKEY),
|
||||
NANO_GOTOLINE_FKEY, NANO_NO_KEY, VIEW, 0);
|
||||
|
||||
free_shortcutage(&gotodir_list);
|
||||
|
||||
@@ -1034,17 +1075,13 @@ void toggle_init(void)
|
||||
#ifndef DISABLE_MOUSE
|
||||
toggle_init_one(TOGGLE_MOUSE_KEY, N_("Mouse support"), USE_MOUSE);
|
||||
#endif
|
||||
/* If we're using restricted mode, the no-conversion, DOS format,
|
||||
* Mac format, and backup toggles are disabled. The first, second,
|
||||
* and third are useless since inserting files is disabled, and the
|
||||
* fourth is useless since backups are disabled. */
|
||||
/* If we're using restricted mode, the no-conversion and backup
|
||||
* backup toggles are disabled. The former is useless since
|
||||
* inserting files is disabled, and the latter is useless since
|
||||
* backups are disabled. */
|
||||
if (!ISSET(RESTRICTED)) {
|
||||
toggle_init_one(TOGGLE_NOCONVERT_KEY,
|
||||
N_("No conversion from DOS/Mac format"), NO_CONVERT);
|
||||
toggle_init_one(TOGGLE_DOS_KEY, N_("Writing file in DOS format"),
|
||||
DOS_FILE);
|
||||
toggle_init_one(TOGGLE_MAC_KEY, N_("Writing file in Mac format"),
|
||||
MAC_FILE);
|
||||
toggle_init_one(TOGGLE_BACKUP_KEY, N_("Backup files"), BACKUP_FILE);
|
||||
}
|
||||
toggle_init_one(TOGGLE_SMOOTH_KEY, N_("Smooth scrolling"), SMOOTHSCROLL);
|
||||
@@ -1128,7 +1165,7 @@ void thanks_for_all_the_fish(void)
|
||||
free_shortcutage(&whereis_list);
|
||||
free_shortcutage(&replace_list);
|
||||
free_shortcutage(&replace_list_2);
|
||||
free_shortcutage(&goto_list);
|
||||
free_shortcutage(&gotoline_list);
|
||||
free_shortcutage(&writefile_list);
|
||||
free_shortcutage(&insertfile_list);
|
||||
#ifndef DISABLE_HELP
|
||||
|
||||
26
src/move.c
26
src/move.c
@@ -19,7 +19,9 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -35,7 +37,7 @@ void do_first_line(void)
|
||||
placewewant = 0;
|
||||
current_x = 0;
|
||||
if (edittop != fileage || need_vertical_update(old_pww))
|
||||
edit_update(current, TOP);
|
||||
edit_update(TOP);
|
||||
}
|
||||
|
||||
void do_last_line(void)
|
||||
@@ -46,7 +48,7 @@ void do_last_line(void)
|
||||
current_x = 0;
|
||||
if (edittop->lineno + (editwinrows / 2) != filebot->lineno ||
|
||||
need_vertical_update(old_pww))
|
||||
edit_update(current, CENTER);
|
||||
edit_update(CENTER);
|
||||
}
|
||||
|
||||
void do_home(void)
|
||||
@@ -54,7 +56,7 @@ void do_home(void)
|
||||
size_t old_pww = placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(SMART_HOME)) {
|
||||
int old_current_x = current_x;
|
||||
size_t old_current_x = current_x;
|
||||
|
||||
for (current_x = 0; isblank(current->data[current_x]) &&
|
||||
current->data[current_x] != '\0'; current_x++)
|
||||
@@ -71,7 +73,7 @@ void do_home(void)
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
@@ -81,7 +83,7 @@ void do_end(void)
|
||||
size_t old_pww = placewewant;
|
||||
current_x = strlen(current->data);
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
if (need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
@@ -129,7 +131,7 @@ void do_page_up(void)
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(old_current, old_pww);
|
||||
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
}
|
||||
|
||||
void do_page_down(void)
|
||||
@@ -176,7 +178,7 @@ void do_page_down(void)
|
||||
/* Update all the lines that need to be updated. */
|
||||
edit_redraw(old_current, old_pww);
|
||||
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
}
|
||||
|
||||
void do_up(void)
|
||||
@@ -184,7 +186,7 @@ void do_up(void)
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
|
||||
if (current->prev == NULL)
|
||||
return;
|
||||
@@ -217,7 +219,7 @@ void do_down(void)
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
|
||||
if (current->next == NULL)
|
||||
return;
|
||||
@@ -255,7 +257,7 @@ void do_left(int allow_update)
|
||||
current_x = strlen(current->data);
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
@@ -277,7 +279,7 @@ void do_right(int allow_update)
|
||||
current_x = 0;
|
||||
}
|
||||
placewewant = xplustabs();
|
||||
check_statblank();
|
||||
check_statusblank();
|
||||
if (allow_update && need_horizontal_update(old_pww))
|
||||
update_line(current, current_x);
|
||||
}
|
||||
|
||||
965
src/nano.c
965
src/nano.c
File diff suppressed because it is too large
Load Diff
137
src/nano.h
137
src/nano.h
@@ -34,23 +34,25 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
/* Macros for the flags long... */
|
||||
/* Macros for the flags long. */
|
||||
#define SET(bit) flags |= bit
|
||||
#define UNSET(bit) flags &= ~bit
|
||||
#define ISSET(bit) ((flags & bit) != 0)
|
||||
#define TOGGLE(bit) flags ^= bit
|
||||
|
||||
/* Define charalloc as a macro rather than duplicating code */
|
||||
/* Macros for character allocation. */
|
||||
#define charalloc(howmuch) (char *)nmalloc((howmuch) * sizeof(char))
|
||||
#define charealloc(ptr, howmuch) (char *)nrealloc(ptr, (howmuch) * sizeof(char))
|
||||
#define charmove(dest, src, n) memmove(dest, src, (n) * sizeof(char))
|
||||
|
||||
#ifdef BROKEN_REGEXEC
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* For the backup file copy ... */
|
||||
#define COPYFILEBLOCKSIZE 1024
|
||||
/* Set a default value for PATH_MAX, so we can use it in lines like
|
||||
* "path = getcwd(NULL, PATH_MAX + 1);". */
|
||||
#ifndef PATH_MAX
|
||||
#define PATH_MAX -1
|
||||
#endif
|
||||
|
||||
#ifdef USE_SLANG
|
||||
@@ -142,6 +144,27 @@
|
||||
#define DISABLE_WRAPJUSTIFY 1
|
||||
#endif
|
||||
|
||||
/* Enumeration types. */
|
||||
typedef enum {
|
||||
CUT_LINE, CUT_MARKED, CUT_TO_EOL
|
||||
} cut_type;
|
||||
|
||||
typedef enum {
|
||||
NIX_FILE, DOS_FILE, MAC_FILE
|
||||
} file_format;
|
||||
|
||||
typedef enum {
|
||||
UP, DOWN
|
||||
} updown;
|
||||
|
||||
typedef enum {
|
||||
TOP, CENTER, NONE
|
||||
} topmidnone;
|
||||
|
||||
typedef enum {
|
||||
NO_SEQ, ESCAPE_SEQ, UTF8_SEQ
|
||||
} seq_type;
|
||||
|
||||
/* Structure types. */
|
||||
typedef struct filestruct {
|
||||
char *data;
|
||||
@@ -164,24 +187,34 @@ typedef struct openfilestruct {
|
||||
struct filestruct *file_mark_beginbuf;
|
||||
/* Current file's beginning marked
|
||||
* line. */
|
||||
int file_mark_beginx; /* Current file's beginning marked
|
||||
size_t file_mark_beginx; /* Current file's beginning marked
|
||||
* line's x-coordinate position. */
|
||||
#endif
|
||||
int file_current_x; /* Current file's x-coordinate
|
||||
size_t file_current_x; /* Current file's x-coordinate
|
||||
* position. */
|
||||
int file_current_y; /* Current file's y-coordinate
|
||||
* position. */
|
||||
long file_flags; /* Current file's flags: modification
|
||||
* status (and marking status, if
|
||||
* available). */
|
||||
size_t file_placewewant; /* Current file's place we want. */
|
||||
int file_totlines; /* Current file's total number of
|
||||
* lines. */
|
||||
long file_totsize; /* Current file's total size. */
|
||||
int file_lineno; /* Current file's line number. */
|
||||
long file_flags; /* Current file's flags: modification
|
||||
* status (and marking status, if
|
||||
* available). */
|
||||
file_format file_fmt; /* Current file's format. */
|
||||
} openfilestruct;
|
||||
#endif
|
||||
|
||||
typedef struct partition {
|
||||
filestruct *fileage;
|
||||
filestruct *top_prev;
|
||||
char *top_data;
|
||||
filestruct *filebot;
|
||||
filestruct *bot_next;
|
||||
char *bot_data;
|
||||
} partition;
|
||||
|
||||
typedef struct shortcut {
|
||||
/* Key values that aren't used should be set to NANO_NO_KEY. */
|
||||
int ctrlval; /* Special sentinel key or control key we want
|
||||
@@ -208,17 +241,16 @@ typedef struct toggle {
|
||||
long flag; /* What flag actually gets toggled. */
|
||||
struct toggle *next;
|
||||
} toggle;
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_NANORC
|
||||
typedef struct rcoption {
|
||||
const char *name;
|
||||
long flag;
|
||||
} rcoption;
|
||||
#endif /* ENABLE_NANORC */
|
||||
#endif
|
||||
|
||||
#ifdef ENABLE_COLOR
|
||||
|
||||
typedef struct colortype {
|
||||
int fg; /* fg color */
|
||||
int bg; /* bg color */
|
||||
@@ -240,8 +272,7 @@ typedef struct syntaxtype {
|
||||
colortype *color; /* color struct for this syntax */
|
||||
struct syntaxtype *next;
|
||||
} syntaxtype;
|
||||
|
||||
#endif /* ENABLE_COLOR */
|
||||
#endif
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
typedef struct historytype {
|
||||
@@ -249,6 +280,7 @@ typedef struct historytype {
|
||||
struct historytype *prev;
|
||||
char *data;
|
||||
} historytype;
|
||||
|
||||
typedef struct historyheadtype {
|
||||
struct historytype *next; /* Keep *next and *prev members
|
||||
* together. */
|
||||
@@ -259,7 +291,7 @@ typedef struct historyheadtype {
|
||||
int count;
|
||||
int len;
|
||||
} historyheadtype;
|
||||
#endif /* !NANO_SMALL */
|
||||
#endif
|
||||
|
||||
/* Bitwise flags so we can save space (or more correctly, not waste
|
||||
* it). */
|
||||
@@ -279,21 +311,19 @@ typedef struct historyheadtype {
|
||||
#define CUT_TO_END (1<<13)
|
||||
#define REVERSE_SEARCH (1<<14)
|
||||
#define MULTIBUFFER (1<<15)
|
||||
#define DOS_FILE (1<<16)
|
||||
#define MAC_FILE (1<<17)
|
||||
#define SMOOTHSCROLL (1<<18)
|
||||
#define DISABLE_CURPOS (1<<19) /* Damn, we still need it. */
|
||||
#define REBIND_DELETE (1<<20)
|
||||
#define NO_CONVERT (1<<21)
|
||||
#define BACKUP_FILE (1<<22)
|
||||
#define NO_RCFILE (1<<23)
|
||||
#define COLOR_SYNTAX (1<<24)
|
||||
#define PRESERVE (1<<25)
|
||||
#define HISTORY_CHANGED (1<<26)
|
||||
#define HISTORYLOG (1<<27)
|
||||
#define RESTRICTED (1<<28)
|
||||
#define SMART_HOME (1<<29)
|
||||
#define WHITESPACE_DISPLAY (1<<30)
|
||||
#define SMOOTHSCROLL (1<<16)
|
||||
#define DISABLE_CURPOS (1<<17) /* Damn, we still need it. */
|
||||
#define REBIND_DELETE (1<<18)
|
||||
#define NO_CONVERT (1<<19)
|
||||
#define BACKUP_FILE (1<<20)
|
||||
#define NO_RCFILE (1<<21)
|
||||
#define COLOR_SYNTAX (1<<22)
|
||||
#define PRESERVE (1<<23)
|
||||
#define HISTORY_CHANGED (1<<24)
|
||||
#define HISTORYLOG (1<<25)
|
||||
#define RESTRICTED (1<<26)
|
||||
#define SMART_HOME (1<<27)
|
||||
#define WHITESPACE_DISPLAY (1<<28)
|
||||
|
||||
/* Control key sequences, changing these would be very very bad. */
|
||||
#define NANO_CONTROL_SPACE 0
|
||||
@@ -330,6 +360,8 @@ typedef struct historyheadtype {
|
||||
#define NANO_CONTROL_7 31
|
||||
#define NANO_CONTROL_8 127
|
||||
|
||||
#define NANO_ALT_9 '9'
|
||||
#define NANO_ALT_0 '0'
|
||||
#define NANO_ALT_A 'a'
|
||||
#define NANO_ALT_B 'b'
|
||||
#define NANO_ALT_C 'c'
|
||||
@@ -358,6 +390,8 @@ typedef struct historyheadtype {
|
||||
#define NANO_ALT_Z 'z'
|
||||
#define NANO_ALT_PERIOD '.'
|
||||
#define NANO_ALT_COMMA ','
|
||||
#define NANO_ALT_LPAREN '('
|
||||
#define NANO_ALT_RPAREN ')'
|
||||
#define NANO_ALT_LCARAT '<'
|
||||
#define NANO_ALT_RCARAT '>'
|
||||
#define NANO_ALT_RBRACKET ']'
|
||||
@@ -375,24 +409,29 @@ typedef struct historyheadtype {
|
||||
/* Normal keys. */
|
||||
#define NANO_XON_KEY NANO_CONTROL_Q
|
||||
#define NANO_XOFF_KEY NANO_CONTROL_S
|
||||
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
||||
#define NANO_INSERTFILE_FKEY KEY_F(5)
|
||||
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
||||
#define NANO_EXIT_KEY NANO_CONTROL_X
|
||||
#define NANO_EXIT_FKEY KEY_F(2)
|
||||
#define NANO_INSERTFILE_KEY NANO_CONTROL_R
|
||||
#define NANO_INSERTFILE_FKEY KEY_F(5)
|
||||
#define NANO_TOOTHERINSERT_KEY NANO_CONTROL_X
|
||||
#define NANO_WRITEOUT_KEY NANO_CONTROL_O
|
||||
#define NANO_WRITEOUT_FKEY KEY_F(3)
|
||||
#define NANO_GOTO_KEY NANO_CONTROL_7
|
||||
#define NANO_GOTO_FKEY KEY_F(13)
|
||||
#define NANO_ALT_GOTO_KEY NANO_ALT_G
|
||||
#define NANO_GOTOLINE_KEY NANO_CONTROL_7
|
||||
#define NANO_GOTOLINE_FKEY KEY_F(13)
|
||||
#define NANO_GOTOLINE_ALTKEY NANO_ALT_G
|
||||
#define NANO_TOGOTOLINE_KEY NANO_CONTROL_T
|
||||
#define NANO_HELP_KEY NANO_CONTROL_G
|
||||
#define NANO_HELP_FKEY KEY_F(1)
|
||||
#define NANO_WHEREIS_KEY NANO_CONTROL_W
|
||||
#define NANO_WHEREIS_FKEY KEY_F(6)
|
||||
#define NANO_WHEREIS_NEXT_KEY NANO_ALT_W
|
||||
#define NANO_WHEREIS_NEXT_FKEY KEY_F(16)
|
||||
#define NANO_TOOTHERWHEREIS_KEY NANO_CONTROL_T
|
||||
#define NANO_REPLACE_KEY NANO_CONTROL_4
|
||||
#define NANO_REPLACE_FKEY KEY_F(14)
|
||||
#define NANO_ALT_REPLACE_KEY NANO_ALT_R
|
||||
#define NANO_OTHERSEARCH_KEY NANO_CONTROL_R
|
||||
#define NANO_TOOTHERSEARCH_KEY NANO_CONTROL_R
|
||||
#define NANO_PREVPAGE_KEY NANO_CONTROL_Y
|
||||
#define NANO_PREVPAGE_FKEY KEY_F(7)
|
||||
#define NANO_NEXTPAGE_KEY NANO_CONTROL_V
|
||||
@@ -409,7 +448,6 @@ typedef struct historyheadtype {
|
||||
#define NANO_FIRSTLINE_FKEY NANO_PREVPAGE_FKEY
|
||||
#define NANO_LASTLINE_KEY NANO_NEXTPAGE_KEY
|
||||
#define NANO_LASTLINE_FKEY NANO_NEXTPAGE_FKEY
|
||||
#define NANO_CANCEL_KEY NANO_CONTROL_C
|
||||
#define NANO_REFRESH_KEY NANO_CONTROL_L
|
||||
#define NANO_JUSTIFY_KEY NANO_CONTROL_J
|
||||
#define NANO_JUSTIFY_FKEY KEY_F(4)
|
||||
@@ -420,7 +458,8 @@ typedef struct historyheadtype {
|
||||
#define NANO_FORWARD_KEY NANO_CONTROL_F
|
||||
#define NANO_BACK_KEY NANO_CONTROL_B
|
||||
#define NANO_MARK_KEY NANO_CONTROL_6
|
||||
#define NANO_ALT_MARK_KEY NANO_ALT_A
|
||||
#define NANO_MARK_ALTKEY NANO_ALT_A
|
||||
#define NANO_MARK_FKEY KEY_F(15)
|
||||
#define NANO_HOME_KEY NANO_CONTROL_A
|
||||
#define NANO_END_KEY NANO_CONTROL_E
|
||||
#define NANO_DELETE_KEY NANO_CONTROL_D
|
||||
@@ -428,7 +467,6 @@ typedef struct historyheadtype {
|
||||
#define NANO_TAB_KEY NANO_CONTROL_I
|
||||
#define NANO_SUSPEND_KEY NANO_CONTROL_Z
|
||||
#define NANO_ENTER_KEY NANO_CONTROL_M
|
||||
#define NANO_FROMSEARCHTOGOTO_KEY NANO_CONTROL_T
|
||||
#define NANO_TOFILES_KEY NANO_CONTROL_T
|
||||
#define NANO_APPEND_KEY NANO_ALT_A
|
||||
#define NANO_PREPEND_KEY NANO_ALT_P
|
||||
@@ -437,12 +475,16 @@ typedef struct historyheadtype {
|
||||
#define NANO_OPENPREV_ALTKEY NANO_ALT_COMMA
|
||||
#define NANO_OPENNEXT_ALTKEY NANO_ALT_PERIOD
|
||||
#define NANO_BRACKET_KEY NANO_ALT_RBRACKET
|
||||
#define NANO_EXTCMD_KEY NANO_CONTROL_X
|
||||
#define NANO_NEXTWORD_KEY NANO_CONTROL_SPACE
|
||||
#define NANO_PREVWORD_KEY NANO_ALT_SPACE
|
||||
#define NANO_PARABEGIN_KEY NANO_CONTROL_W
|
||||
#define NANO_PARABEGIN_ALTKEY1 NANO_ALT_LPAREN
|
||||
#define NANO_PARABEGIN_ALTKEY2 NANO_ALT_9
|
||||
#define NANO_PARAEND_KEY NANO_CONTROL_O
|
||||
#define NANO_PARAEND_ALTKEY1 NANO_ALT_RPAREN
|
||||
#define NANO_PARAEND_ALTKEY2 NANO_ALT_0
|
||||
#define NANO_FULLJUSTIFY_KEY NANO_CONTROL_U
|
||||
#define NANO_FULLJUSTIFY_ALTKEY NANO_ALT_J
|
||||
#define NANO_VERBATIM_KEY NANO_ALT_V
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
@@ -459,7 +501,7 @@ typedef struct historyheadtype {
|
||||
#define TOGGLE_CASE_KEY NANO_ALT_C
|
||||
#define TOGGLE_MULTIBUFFER_KEY NANO_ALT_F
|
||||
#define TOGGLE_DOS_KEY NANO_ALT_D
|
||||
#define TOGGLE_MAC_KEY NANO_ALT_O
|
||||
#define TOGGLE_MAC_KEY NANO_ALT_M
|
||||
#define TOGGLE_SMOOTH_KEY NANO_ALT_S
|
||||
#define TOGGLE_NOCONVERT_KEY NANO_ALT_N
|
||||
#define TOGGLE_BACKUP_KEY NANO_ALT_B
|
||||
@@ -473,14 +515,6 @@ typedef struct historyheadtype {
|
||||
#define VIEW TRUE
|
||||
#define NOVIEW FALSE
|
||||
|
||||
typedef enum {
|
||||
UP, DOWN
|
||||
} updown;
|
||||
|
||||
typedef enum {
|
||||
TOP, CENTER, NONE
|
||||
} topmidnone;
|
||||
|
||||
/* Minimum editor window rows required for nano to work correctly. */
|
||||
#define MIN_EDITOR_ROWS 3
|
||||
|
||||
@@ -491,6 +525,9 @@ typedef enum {
|
||||
* occurs. */
|
||||
#define CHARS_FROM_EOL 8
|
||||
|
||||
/* Default width of a tab. */
|
||||
#define WIDTH_OF_TAB 8
|
||||
|
||||
/* Maximum number of search history strings saved, same value used for
|
||||
* replace history. */
|
||||
#define MAX_SEARCH_HISTORY 100
|
||||
|
||||
164
src/proto.h
164
src/proto.h
@@ -21,8 +21,8 @@
|
||||
|
||||
/* Externs. */
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#ifdef HAVE_REGEX_H
|
||||
#include <regex.h>
|
||||
#endif
|
||||
@@ -32,15 +32,16 @@
|
||||
extern ssize_t wrap_at;
|
||||
#endif
|
||||
extern int editwinrows;
|
||||
extern int current_x, current_y, totlines;
|
||||
extern size_t current_x;
|
||||
extern int current_y;
|
||||
extern int totlines;
|
||||
extern size_t placewewant;
|
||||
#ifndef NANO_SMALL
|
||||
extern int mark_beginx;
|
||||
extern size_t mark_beginx;
|
||||
#endif
|
||||
extern long totsize;
|
||||
extern long flags;
|
||||
extern ssize_t tabsize;
|
||||
extern int search_last_line;
|
||||
extern int currslen;
|
||||
|
||||
#if !defined(NANO_SMALL) && defined(ENABLE_NANORC)
|
||||
@@ -82,10 +83,10 @@ extern char *full_operating_dir;
|
||||
extern char *alt_speller;
|
||||
#endif
|
||||
|
||||
extern int resetstatuspos;
|
||||
extern struct stat fileinfo;
|
||||
extern filestruct *current, *fileage, *edittop, *filebot;
|
||||
extern filestruct *cutbuffer;
|
||||
extern partition *filepart;
|
||||
#ifndef NANO_SMALL
|
||||
extern filestruct *mark_beginbuf;
|
||||
#endif
|
||||
@@ -102,7 +103,7 @@ extern char *syntaxstr;
|
||||
|
||||
extern shortcut *shortcut_list;
|
||||
extern shortcut *main_list, *whereis_list;
|
||||
extern shortcut *replace_list, *goto_list;
|
||||
extern shortcut *replace_list, *gotoline_list;
|
||||
extern shortcut *writefile_list, *insertfile_list;
|
||||
extern shortcut *replace_list_2;
|
||||
#ifndef NANO_SMALL
|
||||
@@ -148,30 +149,42 @@ extern char *homedir;
|
||||
|
||||
/* Functions we want available. */
|
||||
|
||||
/* Public functions in color.c */
|
||||
/* Public functions in color.c. */
|
||||
#ifdef ENABLE_COLOR
|
||||
void set_colorpairs(void);
|
||||
void do_colorinit(void);
|
||||
void update_color(void);
|
||||
#endif /* ENABLE_COLOR */
|
||||
|
||||
/* Public functions in cut.c */
|
||||
/* Public functions in cut.c. */
|
||||
void cutbuffer_reset(void);
|
||||
filestruct *get_cutbottom(void);
|
||||
void add_to_cutbuffer(filestruct *inptr, bool allow_concat);
|
||||
#ifndef NANO_SMALL
|
||||
void cut_marked_segment(void);
|
||||
#endif
|
||||
void do_cut_text(void);
|
||||
void do_uncut_text(void);
|
||||
|
||||
/* Public functions in files.c */
|
||||
void load_file(int update);
|
||||
/* Public functions in files.c. */
|
||||
void new_file(void);
|
||||
filestruct *read_line(char *buf, filestruct *prev, int *line1ins, size_t
|
||||
len);
|
||||
void read_file(FILE *f, const char *filename, int quiet);
|
||||
bool open_file(const char *filename, int insert, int quiet);
|
||||
filestruct *read_line(char *buf, filestruct *prev, bool *first_line_ins,
|
||||
size_t len);
|
||||
void load_file(void);
|
||||
void read_file(FILE *f, const char *filename);
|
||||
int open_file(const char *filename, bool newfie, FILE **f);
|
||||
char *get_next_filename(const char *name);
|
||||
void do_insertfile(int loading_file);
|
||||
#ifndef NANO_SMALL
|
||||
void execute_command(const char *command);
|
||||
#endif
|
||||
void load_buffer(const char *name);
|
||||
void do_insertfile(
|
||||
#ifndef NANO_SMALL
|
||||
bool execute
|
||||
#else
|
||||
void
|
||||
#endif
|
||||
);
|
||||
void do_insertfile_void(void);
|
||||
#ifdef ENABLE_MULTIBUFFER
|
||||
openfilestruct *make_new_opennode(openfilestruct *prevnode);
|
||||
@@ -180,13 +193,13 @@ void splice_opennode(openfilestruct *begin, openfilestruct *newnode,
|
||||
void unlink_opennode(const openfilestruct *fileptr);
|
||||
void delete_opennode(openfilestruct *fileptr);
|
||||
void free_openfilestruct(openfilestruct *src);
|
||||
void add_open_file(int update);
|
||||
void add_open_file(bool update);
|
||||
void load_open_file(void);
|
||||
void open_prevfile(int closing_file);
|
||||
void open_prevfile(bool closing_file);
|
||||
void open_prevfile_void(void);
|
||||
void open_nextfile(int closing_file);
|
||||
void open_nextfile(bool closing_file);
|
||||
void open_nextfile_void(void);
|
||||
int close_open_file(void);
|
||||
bool close_open_file(void);
|
||||
#endif
|
||||
#if !defined(DISABLE_SPELLER) || !defined(DISABLE_OPERATINGDIR)
|
||||
char *get_full_path(const char *origpath);
|
||||
@@ -203,11 +216,12 @@ int check_operating_dir(const char *currpath, int allow_tabcomp);
|
||||
void init_backup_dir(void);
|
||||
#endif
|
||||
int copy_file(FILE *inn, FILE *out);
|
||||
int write_file(const char *name, int tmp, int append, int nonamechange);
|
||||
int write_file(const char *name, bool tmp, int append, bool
|
||||
nonamechange);
|
||||
#ifndef NANO_SMALL
|
||||
int write_marked(const char *name, int tmp, int append);
|
||||
int write_marked(const char *name, bool tmp, int append);
|
||||
#endif
|
||||
int do_writeout(int exiting);
|
||||
int do_writeout(bool exiting);
|
||||
void do_writeout_void(void);
|
||||
char *real_dir_from_tilde(const char *buf);
|
||||
#ifndef DISABLE_TABCOMP
|
||||
@@ -234,7 +248,7 @@ bool writehist(FILE *hist, historyheadtype *histhead);
|
||||
void save_history(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in global.c */
|
||||
/* Public functions in global.c. */
|
||||
size_t length_of_list(const shortcut *s);
|
||||
#ifndef NANO_SMALL
|
||||
void toggle_init_one(int val, const char *desc, long flag);
|
||||
@@ -249,13 +263,13 @@ void sc_init_one(shortcut **shortcutage, int key, const char *desc,
|
||||
#endif
|
||||
int metaval, int funcval, int miscval, int view, void
|
||||
(*func)(void));
|
||||
void shortcut_init(int unjustify);
|
||||
void shortcut_init(bool unjustify);
|
||||
void free_shortcutage(shortcut **shortcutage);
|
||||
#ifdef DEBUG
|
||||
void thanks_for_all_the_fish(void);
|
||||
#endif
|
||||
|
||||
/* Public functions in move.c */
|
||||
/* Public functions in move.c. */
|
||||
void do_first_line(void);
|
||||
void do_last_line(void);
|
||||
void do_home(void);
|
||||
@@ -269,7 +283,7 @@ void do_left_void(void);
|
||||
void do_right(int allow_update);
|
||||
void do_right_void(void);
|
||||
|
||||
/* Public functions in nano.c */
|
||||
/* Public functions in nano.c. */
|
||||
void finish(void);
|
||||
void die(const char *msg, ...);
|
||||
void die_save_file(const char *die_filename);
|
||||
@@ -291,6 +305,9 @@ void unlink_node(const filestruct *fileptr);
|
||||
void delete_node(filestruct *fileptr);
|
||||
filestruct *copy_filestruct(const filestruct *src);
|
||||
void free_filestruct(filestruct *src);
|
||||
partition *partition_filestruct(filestruct *top, size_t top_x,
|
||||
filestruct *bot, size_t bot_x);
|
||||
void unpartition_filestruct(partition **p);
|
||||
void renumber_all(void);
|
||||
void renumber(filestruct *fileptr);
|
||||
void print1opt(const char *shortflag, const char *longflag, const char
|
||||
@@ -303,9 +320,6 @@ void nano_disabled_msg(void);
|
||||
RETSIGTYPE cancel_fork(int signal);
|
||||
bool open_pipe(const char *command);
|
||||
#endif
|
||||
#ifndef DISABLE_MOUSE
|
||||
void do_mouse(void);
|
||||
#endif
|
||||
void do_char(char ch);
|
||||
void do_verbatim_input(void);
|
||||
void do_backspace(void);
|
||||
@@ -343,8 +357,8 @@ bool inpar(const char *str);
|
||||
void do_para_end(void);
|
||||
filestruct *backup_lines(filestruct *first_line, size_t par_len, size_t
|
||||
quote_len);
|
||||
bool breakable(const char *line, int goal);
|
||||
int break_line(const char *line, int goal, bool force);
|
||||
bool breakable(const char *line, ssize_t goal);
|
||||
ssize_t break_line(const char *line, ssize_t goal, bool force);
|
||||
bool do_para_search(size_t *const quote, size_t *const par);
|
||||
void do_justify(bool full_justify);
|
||||
void do_justify_void(void);
|
||||
@@ -362,6 +376,7 @@ void allow_pending_sigwinch(bool allow);
|
||||
#ifndef NANO_SMALL
|
||||
void do_toggle(const toggle *which);
|
||||
#endif
|
||||
void disable_extended_input(void);
|
||||
void disable_signals(void);
|
||||
#ifndef NANO_SMALL
|
||||
void enable_signals(void);
|
||||
@@ -370,7 +385,7 @@ void disable_flow_control(void);
|
||||
void enable_flow_control(void);
|
||||
void terminal_init(void);
|
||||
|
||||
/* Public functions in rcfile.c */
|
||||
/* Public functions in rcfile.c. */
|
||||
#ifdef ENABLE_NANORC
|
||||
void rcfile_error(const char *msg, ...);
|
||||
char *parse_next_word(char *ptr);
|
||||
@@ -386,7 +401,7 @@ void parse_rcfile(FILE *rcstream);
|
||||
void do_rcfile(void);
|
||||
#endif /* ENABLE_NANORC */
|
||||
|
||||
/* Public functions in search.c */
|
||||
/* Public functions in search.c. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
int regexp_init(const char *regexp);
|
||||
void regexp_cleanup(void);
|
||||
@@ -394,27 +409,30 @@ void regexp_cleanup(void);
|
||||
void not_found_msg(const char *str);
|
||||
void search_abort(void);
|
||||
void search_init_globals(void);
|
||||
int search_init(int replacing);
|
||||
int is_whole_word(int curr_pos, const char *datastr, const char
|
||||
int search_init(bool replacing, bool use_answer);
|
||||
bool is_whole_word(int curr_pos, const char *datastr, const char
|
||||
*searchword);
|
||||
int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
||||
*begin, size_t beginx, const char *needle, int no_sameline);
|
||||
bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
no_sameline, const filestruct *begin, size_t beginx, const char
|
||||
*needle, size_t *needle_len);
|
||||
void findnextstr_wrap_reset(void);
|
||||
void do_search(void);
|
||||
#ifndef NANO_SMALL
|
||||
void do_research(void);
|
||||
#endif
|
||||
void replace_abort(void);
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, int create_flag);
|
||||
int replace_regexp(char *string, bool create_flag);
|
||||
#endif
|
||||
char *replace_line(const char *needle);
|
||||
int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
size_t *real_current_x, int wholewords);
|
||||
ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
*real_current, size_t *real_current_x, bool wholewords, bool
|
||||
*canceled);
|
||||
void do_replace(void);
|
||||
void do_gotoline(int line, bool save_pos);
|
||||
void do_gotoline_void(void);
|
||||
#if defined (ENABLE_MULTIBUFFER) || !defined (DISABLE_SPELLER)
|
||||
void do_gotopos(int line, int pos_x, int pos_y, size_t pos_pww);
|
||||
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
|
||||
void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww);
|
||||
#endif
|
||||
void do_find_bracket(void);
|
||||
#ifndef NANO_SMALL
|
||||
@@ -431,7 +449,7 @@ void free_history(historyheadtype *h);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Public functions in utils.c */
|
||||
/* Public functions in utils.c. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
#ifdef BROKEN_REGEXEC
|
||||
int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
@@ -480,45 +498,60 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
void nperror(const char *s);
|
||||
void *nmalloc(size_t howmuch);
|
||||
void *nrealloc(void *ptr, size_t howmuch);
|
||||
char *mallocstrncpy(char *dest, const char *src, size_t n);
|
||||
char *mallocstrcpy(char *dest, const char *src);
|
||||
char *mallocstrassn(char *dest, char *src);
|
||||
void new_magicline(void);
|
||||
#ifndef NANO_SMALL
|
||||
void remove_magicline(void);
|
||||
void get_totals(const filestruct *begin, const filestruct *end, int
|
||||
*lines, long *size);
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x);
|
||||
**bot, size_t *bot_x, bool *right_side_up);
|
||||
#endif
|
||||
#ifndef DISABLE_TABCOMP
|
||||
int check_wildcard_match(const char *text, const char *pattern);
|
||||
#endif
|
||||
|
||||
/* Public functions in winio.c */
|
||||
/* Public functions in winio.c. */
|
||||
#ifndef NANO_SMALL
|
||||
void reset_kbinput(void);
|
||||
#endif
|
||||
int get_kbinput(WINDOW *win, int *meta_key);
|
||||
int get_translated_kbinput(int kbinput, int *es
|
||||
void unget_kbinput(int kbinput, bool meta_key, bool func_key);
|
||||
int get_kbinput(WINDOW *win, bool *meta_key, bool *func_key);
|
||||
int get_translated_kbinput(int kbinput, seq_type *seq
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
int get_ascii_kbinput(int kbinput, size_t ascii_digits
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
int get_control_kbinput(int kbinput);
|
||||
int get_escape_seq_kbinput(int *escape_seq, size_t es_len, int
|
||||
int get_escape_seq_kbinput(const int *escape_seq, size_t es_len, bool
|
||||
*ignore_seq);
|
||||
int get_escape_seq_abcd(int kbinput);
|
||||
int *get_verbatim_kbinput(WINDOW *win, int *v_kbinput, size_t *v_len,
|
||||
int allow_ascii);
|
||||
int get_untranslated_kbinput(int kbinput, size_t position, int
|
||||
int *get_verbatim_kbinput(WINDOW *win, int first, int *v_kbinput, size_t
|
||||
*v_len, bool allow_ascii);
|
||||
int get_untranslated_kbinput(int kbinput, size_t position, bool
|
||||
allow_ascii
|
||||
#ifndef NANO_SMALL
|
||||
, int reset
|
||||
, bool reset
|
||||
#endif
|
||||
);
|
||||
#ifndef DISABLE_MOUSE
|
||||
int get_mouseinput(int *mouse_x, int *mouse_y, int allow_shortcuts);
|
||||
bool get_mouseinput(int *mouse_x, int *mouse_y, bool allow_shortcuts);
|
||||
#endif
|
||||
const shortcut *get_shortcut(const shortcut *s_list, int kbinput, bool
|
||||
*meta_key, bool *func_key);
|
||||
#ifndef NANO_SMALL
|
||||
const toggle *get_toggle(int kbinput, bool meta_key);
|
||||
#endif
|
||||
int get_edit_input(bool *meta_key, bool *func_key, bool allow_funcs);
|
||||
#ifndef DISABLE_MOUSE
|
||||
bool get_edit_mouse(void);
|
||||
#endif
|
||||
size_t xplustabs(void);
|
||||
size_t actual_x(const char *str, size_t xplus);
|
||||
@@ -527,11 +560,11 @@ size_t strlenpt(const char *buf);
|
||||
void blank_titlebar(void);
|
||||
void blank_edit(void);
|
||||
void blank_statusbar(void);
|
||||
void check_statblank(void);
|
||||
void check_statusblank(void);
|
||||
void blank_bottombars(void);
|
||||
char *display_string(const char *buf, size_t start_col, size_t len);
|
||||
void nanoget_repaint(const char *buf, const char *inputbuf, size_t x);
|
||||
int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
int nanogetstr(bool allow_tabs, const char *buf, const char *def,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
#endif
|
||||
@@ -540,6 +573,12 @@ int nanogetstr(int allowtabs, const char *buf, const char *def,
|
||||
, bool *list
|
||||
#endif
|
||||
);
|
||||
int statusq(bool allow_tabs, const shortcut *s, const char *def,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
void statusq_abort(void);
|
||||
void titlebar(const char *path);
|
||||
void set_modified(void);
|
||||
void statusbar(const char *msg, ...);
|
||||
@@ -558,16 +597,11 @@ int need_vertical_update(size_t old_pww);
|
||||
void edit_scroll(updown direction, int nlines);
|
||||
void edit_redraw(const filestruct *old_current, size_t old_pww);
|
||||
void edit_refresh(void);
|
||||
void edit_update(filestruct *fileptr, topmidnone location);
|
||||
int statusq(int allowtabs, const shortcut *s, const char *def,
|
||||
#ifndef NANO_SMALL
|
||||
historyheadtype *history_list,
|
||||
#endif
|
||||
const char *msg, ...);
|
||||
int do_yesno(int all, const char *msg);
|
||||
void edit_update(topmidnone location);
|
||||
int do_yesno(bool all, const char *msg);
|
||||
void total_refresh(void);
|
||||
void display_main_list(void);
|
||||
void do_cursorpos(int constant);
|
||||
void do_cursorpos(bool constant);
|
||||
void do_cursorpos_void(void);
|
||||
#ifndef DISABLE_HELP
|
||||
int help_line_len(const char *ptr);
|
||||
|
||||
12
src/rcfile.c
12
src/rcfile.c
@@ -19,7 +19,9 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
@@ -27,7 +29,6 @@
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
#include <pwd.h>
|
||||
#include <ctype.h>
|
||||
@@ -611,20 +612,21 @@ void parse_rcfile(FILE *rcstream)
|
||||
else
|
||||
#endif
|
||||
if (strcasecmp(rcopts[i].name, "tabsize") == 0) {
|
||||
if (!parse_num(option, &tabsize) || tabsize <= 0)
|
||||
if (!parse_num(option, &tabsize) || tabsize <= 0) {
|
||||
rcfile_error(N_("Requested tab size %s invalid"), option);
|
||||
tabsize = -1;
|
||||
}
|
||||
}
|
||||
} else
|
||||
SET(rcopts[i].flag);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "set flag %d!\n",
|
||||
fprintf(stderr, "set flag %ld!\n",
|
||||
rcopts[i].flag);
|
||||
#endif
|
||||
} else {
|
||||
UNSET(rcopts[i].flag);
|
||||
#ifdef DEBUG
|
||||
fprintf(stderr, "unset flag %d!\n",
|
||||
fprintf(stderr, "unset flag %ld!\n",
|
||||
rcopts[i].flag);
|
||||
#endif
|
||||
}
|
||||
|
||||
502
src/search.c
502
src/search.c
@@ -19,7 +19,9 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -31,9 +33,11 @@
|
||||
#include "proto.h"
|
||||
#include "nano.h"
|
||||
|
||||
|
||||
static bool search_last_line = FALSE;
|
||||
/* Have we gone past the last line while searching? */
|
||||
#ifdef HAVE_REGEX_H
|
||||
static int regexp_compiled = FALSE;
|
||||
static bool regexp_compiled = FALSE;
|
||||
/* Have we compiled any regular expressions? */
|
||||
|
||||
/* Regular expression helper functions. */
|
||||
|
||||
@@ -42,8 +46,11 @@ static int regexp_compiled = FALSE;
|
||||
* bar. Return value 1 means success. */
|
||||
int regexp_init(const char *regexp)
|
||||
{
|
||||
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED |
|
||||
(ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE));
|
||||
int rc = regcomp(&search_regexp, regexp, REG_EXTENDED
|
||||
#ifndef NANO_SMALL
|
||||
| (ISSET(CASE_SENSITIVE) ? 0 : REG_ICASE)
|
||||
#endif
|
||||
);
|
||||
|
||||
assert(!regexp_compiled);
|
||||
if (rc != 0) {
|
||||
@@ -99,42 +106,45 @@ void search_abort(void)
|
||||
|
||||
void search_init_globals(void)
|
||||
{
|
||||
if (last_search == NULL) {
|
||||
last_search = charalloc(1);
|
||||
last_search[0] = '\0';
|
||||
}
|
||||
if (last_replace == NULL) {
|
||||
last_replace = charalloc(1);
|
||||
last_replace[0] = '\0';
|
||||
}
|
||||
if (last_search == NULL)
|
||||
last_search = mallocstrcpy(NULL, "");
|
||||
if (last_replace == NULL)
|
||||
last_replace = mallocstrcpy(NULL, "");
|
||||
}
|
||||
|
||||
/* Set up the system variables for a search or replace. Return -1 if
|
||||
* the search should be cancelled (due to Cancel, Go to Line, or a
|
||||
* failed regcomp()). Return 0 on success, and 1 on rerun calling
|
||||
* program. Return -2 to run opposite program (search -> replace,
|
||||
* replace -> search).
|
||||
/* Set up the system variables for a search or replace. If use_answer
|
||||
* is TRUE, only set backupstring to answer. Return -2 to run opposite
|
||||
* program (search -> replace, replace -> search), return -1 if the
|
||||
* search should be canceled (due to Cancel, Go to Line, or a failed
|
||||
* regcomp()), return 0 on success, and return 1 on rerun calling
|
||||
* program.
|
||||
*
|
||||
* replacing = 1 if we call from do_replace(), 0 if called from
|
||||
* do_search(). */
|
||||
int search_init(int replacing)
|
||||
* replacing is TRUE if we call from do_replace(), and FALSE if called
|
||||
* from do_search(). */
|
||||
int search_init(bool replacing, bool use_answer)
|
||||
{
|
||||
int i = 0;
|
||||
char *buf;
|
||||
static char *backupstring = NULL;
|
||||
/* The search string we'll be using. */
|
||||
|
||||
/* If backupstring doesn't exist, initialize it to "". */
|
||||
if (backupstring == NULL)
|
||||
backupstring = mallocstrcpy(NULL, "");
|
||||
|
||||
/* If use_answer is TRUE, set backupstring to answer and get out. */
|
||||
if (use_answer) {
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* We display the search prompt below. If the user types a partial
|
||||
* search string and then Replace or a toggle, we will return to
|
||||
* do_search() or do_replace() and be called again. In that case,
|
||||
* we should put the same search string back up. backupstring holds
|
||||
* this string. */
|
||||
* we should put the same search string back up. */
|
||||
|
||||
search_init_globals();
|
||||
|
||||
/* If we don't already have a backupstring, set it. */
|
||||
if (backupstring == NULL)
|
||||
backupstring = mallocstrcpy(NULL, "");
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
search_history.current = (historytype *)&search_history.next;
|
||||
#endif
|
||||
@@ -148,10 +158,8 @@ int search_init(int replacing)
|
||||
sprintf(buf, " [%s%s]", disp,
|
||||
strlenpt(last_search) > COLS / 3 ? "..." : "");
|
||||
free(disp);
|
||||
} else {
|
||||
buf = charalloc(1);
|
||||
buf[0] = '\0';
|
||||
}
|
||||
} else
|
||||
buf = mallocstrcpy(NULL, "");
|
||||
|
||||
/* This is now one simple call. It just does a lot. */
|
||||
i = statusq(FALSE, replacing ? replace_list : whereis_list,
|
||||
@@ -182,7 +190,16 @@ int search_init(int replacing)
|
||||
#endif
|
||||
"",
|
||||
|
||||
replacing ? _(" (to replace)") : "",
|
||||
replacing ?
|
||||
#ifndef NANO_SMALL
|
||||
(ISSET(MARK_ISSET) ? _(" (to replace) in selection") :
|
||||
#endif
|
||||
_(" (to replace)")
|
||||
#ifndef NANO_SMALL
|
||||
)
|
||||
#endif
|
||||
: "",
|
||||
|
||||
buf);
|
||||
|
||||
/* Release buf now that we don't need it anymore. */
|
||||
@@ -194,129 +211,174 @@ int search_init(int replacing)
|
||||
/* Cancel any search, or just return with no previous search. */
|
||||
if (i == -1 || (i < 0 && last_search[0] == '\0') ||
|
||||
(!replacing && i == 0 && answer[0] == '\0')) {
|
||||
statusbar(_("Search Cancelled"));
|
||||
statusbar(_("Cancelled"));
|
||||
#ifndef NANO_SMALL
|
||||
search_history.current = search_history.next;
|
||||
#endif
|
||||
return -1;
|
||||
} else {
|
||||
switch (i) {
|
||||
case -2: /* It's the same string. */
|
||||
case -2: /* It's the same string. */
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* Since answer is "", use last_search! */
|
||||
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
|
||||
return -1;
|
||||
/* Since answer is "", use last_search! */
|
||||
if (ISSET(USE_REGEXP) && regexp_init(last_search) == 0)
|
||||
return -1;
|
||||
#endif
|
||||
break;
|
||||
case 0: /* They entered something new. */
|
||||
last_replace[0] = '\0';
|
||||
break;
|
||||
case 0: /* They entered something new. */
|
||||
last_replace[0] = '\0';
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP) && regexp_init(answer) == 0)
|
||||
return -1;
|
||||
if (ISSET(USE_REGEXP) && regexp_init(answer) == 0)
|
||||
return -1;
|
||||
#endif
|
||||
break;
|
||||
break;
|
||||
#ifndef NANO_SMALL
|
||||
case TOGGLE_CASE_KEY:
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
case TOGGLE_BACKWARDS_KEY:
|
||||
TOGGLE(REVERSE_SEARCH);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
case TOGGLE_CASE_KEY:
|
||||
TOGGLE(CASE_SENSITIVE);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
case TOGGLE_BACKWARDS_KEY:
|
||||
TOGGLE(REVERSE_SEARCH);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#ifdef HAVE_REGEX_H
|
||||
case TOGGLE_REGEXP_KEY:
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
case TOGGLE_REGEXP_KEY:
|
||||
TOGGLE(USE_REGEXP);
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return 1;
|
||||
#endif
|
||||
#endif /* !NANO_SMALL */
|
||||
case NANO_OTHERSEARCH_KEY:
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
case NANO_FROMSEARCHTOGOTO_KEY:
|
||||
case NANO_TOOTHERSEARCH_KEY:
|
||||
backupstring = mallocstrcpy(backupstring, answer);
|
||||
return -2; /* Call the opposite search function. */
|
||||
case NANO_TOGOTOLINE_KEY:
|
||||
#ifndef NANO_SMALL
|
||||
search_history.current = search_history.next;
|
||||
search_history.current = search_history.next;
|
||||
#endif
|
||||
/* If answer parses as an integer, put it up on the
|
||||
* statusbar. */
|
||||
do_gotoline(parse_num(answer, NULL) ? -1 : 0, FALSE);
|
||||
/* Fall through. */
|
||||
default:
|
||||
return -1;
|
||||
/* Put answer up on the statusbar. */
|
||||
do_gotoline(-1, FALSE);
|
||||
/* Fall through. */
|
||||
default:
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int is_whole_word(int curr_pos, const char *datastr, const char
|
||||
bool is_whole_word(int curr_pos, const char *datastr, const char
|
||||
*searchword)
|
||||
{
|
||||
size_t sln = curr_pos + strlen(searchword);
|
||||
|
||||
/* Start of line or previous character is not a letter and end of
|
||||
* line or next character is not a letter. */
|
||||
return (curr_pos < 1 || !isalpha((int)datastr[curr_pos - 1])) &&
|
||||
(sln == strlen(datastr) || !isalpha((int)datastr[sln]));
|
||||
return (curr_pos < 1 || !isalpha(datastr[curr_pos - 1])) &&
|
||||
(sln == strlen(datastr) || !isalpha(datastr[sln]));
|
||||
}
|
||||
|
||||
/* Look for needle, starting at current, column current_x. If
|
||||
* no_sameline is nonzero, skip over begin when looking for needle.
|
||||
* begin is the line where we first started searching, at column beginx.
|
||||
* If can_display_wrap is nonzero, we put messages on the statusbar, and
|
||||
* wrap around the file boundaries. The return value specifies whether
|
||||
* we found anything. */
|
||||
int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
||||
*begin, size_t beginx, const char *needle, int no_sameline)
|
||||
* no_sameline is TRUE, skip over begin when looking for needle. begin
|
||||
* is the line where we first started searching, at column beginx. If
|
||||
* can_display_wrap is TRUE, we put messages on the statusbar, wrap
|
||||
* around the file boundaries. The return value specifies whether we
|
||||
* found anything. If we did, set needle_len to the length of the
|
||||
* string we found if it isn't NULL. */
|
||||
bool findnextstr(bool can_display_wrap, bool wholeword, bool
|
||||
no_sameline, const filestruct *begin, size_t beginx, const char
|
||||
*needle, size_t *needle_len)
|
||||
{
|
||||
filestruct *fileptr = current;
|
||||
const char *rev_start = NULL, *found = NULL;
|
||||
size_t found_len;
|
||||
/* The length of the match we found. */
|
||||
size_t current_x_find = 0;
|
||||
/* Where needle was found. */
|
||||
/* The location of the match we found. */
|
||||
int current_y_find = current_y;
|
||||
|
||||
/* rev_start might end up 1 character before the start or after the
|
||||
* end of the line. This won't be a problem because strstrwrapper()
|
||||
* will return immediately and say that no match was found, and
|
||||
* rev_start will be properly set when the search continues on the
|
||||
* previous or next line. */
|
||||
rev_start =
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
rev_start = fileptr->data + (current_x - 1);
|
||||
else
|
||||
ISSET(REVERSE_SEARCH) ? fileptr->data + (current_x - 1) :
|
||||
#endif
|
||||
rev_start = fileptr->data + (current_x + 1);
|
||||
fileptr->data + (current_x + 1);
|
||||
|
||||
/* Look for needle in searchstr. */
|
||||
while (TRUE) {
|
||||
found = strstrwrapper(fileptr->data, needle, rev_start);
|
||||
|
||||
if (found != NULL && (!wholeword || is_whole_word(found -
|
||||
fileptr->data, fileptr->data, needle))) {
|
||||
if (!no_sameline || fileptr != current)
|
||||
/* We've found a potential match. */
|
||||
if (found != NULL) {
|
||||
bool found_whole = FALSE;
|
||||
/* Is this potential match a whole word? */
|
||||
|
||||
/* Set found_len to the length of the potential match. */
|
||||
found_len =
|
||||
#ifdef HAVE_REGEX_H
|
||||
ISSET(USE_REGEXP) ?
|
||||
regmatches[0].rm_eo - regmatches[0].rm_so :
|
||||
#endif
|
||||
strlen(needle);
|
||||
|
||||
/* If we're searching for whole words, see if this potential
|
||||
* match is a whole word. */
|
||||
if (wholeword) {
|
||||
char *word = mallocstrncpy(NULL, found, found_len + 1);
|
||||
word[found_len] = '\0';
|
||||
|
||||
found_whole = is_whole_word(found - fileptr->data,
|
||||
fileptr->data, word);
|
||||
free(word);
|
||||
}
|
||||
|
||||
/* If we're searching for whole words and this potential
|
||||
* match isn't a whole word, or if we're not allowed to find
|
||||
* a match on the same line we started on and this potential
|
||||
* match is on that line, continue searching. */
|
||||
if ((!wholeword || found_whole) && (!no_sameline ||
|
||||
fileptr != current))
|
||||
break;
|
||||
}
|
||||
|
||||
/* Finished processing file, get out. */
|
||||
/* We've finished processing the file, so get out. */
|
||||
if (search_last_line) {
|
||||
if (can_display_wrap)
|
||||
not_found_msg(needle);
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
fileptr =
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(REVERSE_SEARCH) ? fileptr->prev :
|
||||
#endif
|
||||
fileptr->next;
|
||||
|
||||
/* Start or end of buffer reached; wrap around. */
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
fileptr = fileptr->prev;
|
||||
current_y_find--;
|
||||
} else {
|
||||
#endif
|
||||
fileptr = fileptr->next;
|
||||
current_y_find++;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Start or end of buffer reached, so wrap around. */
|
||||
if (fileptr == NULL) {
|
||||
if (!can_display_wrap)
|
||||
return 0;
|
||||
fileptr =
|
||||
return FALSE;
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
ISSET(REVERSE_SEARCH) ? filebot :
|
||||
if (ISSET(REVERSE_SEARCH)) {
|
||||
fileptr = filebot;
|
||||
current_y_find = editwinrows - 1;
|
||||
} else {
|
||||
#endif
|
||||
fileage;
|
||||
fileptr = fileage;
|
||||
current_y_find = 0;
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
|
||||
if (can_display_wrap)
|
||||
statusbar(_("Search Wrapped"));
|
||||
}
|
||||
@@ -324,6 +386,7 @@ int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
||||
/* Original start line reached. */
|
||||
if (fileptr == begin)
|
||||
search_last_line = TRUE;
|
||||
|
||||
rev_start = fileptr->data;
|
||||
#ifndef NANO_SMALL
|
||||
if (ISSET(REVERSE_SEARCH))
|
||||
@@ -346,27 +409,40 @@ int findnextstr(int can_display_wrap, int wholeword, const filestruct
|
||||
|
||||
if (can_display_wrap)
|
||||
not_found_msg(needle);
|
||||
return 0;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Set globals now that we are sure we found something. */
|
||||
current = fileptr;
|
||||
current_x = current_x_find;
|
||||
current_y = current_y_find;
|
||||
placewewant = xplustabs();
|
||||
|
||||
return 1;
|
||||
/* needle_len holds the length of needle. */
|
||||
if (needle_len != NULL)
|
||||
*needle_len = found_len;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void findnextstr_wrap_reset(void)
|
||||
{
|
||||
search_last_line = FALSE;
|
||||
}
|
||||
|
||||
/* Search for a string. */
|
||||
void do_search(void)
|
||||
{
|
||||
size_t old_pww = placewewant, fileptr_x = current_x;
|
||||
int i, didfind;
|
||||
int i;
|
||||
bool didfind;
|
||||
filestruct *fileptr = current;
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
i = search_init(0);
|
||||
|
||||
i = search_init(FALSE, FALSE);
|
||||
if (i == -1) /* Cancel, Go to Line, blank search string, or
|
||||
* regcomp() failed. */
|
||||
search_abort();
|
||||
@@ -394,8 +470,9 @@ void do_search(void)
|
||||
update_history(&search_history, answer);
|
||||
#endif
|
||||
|
||||
search_last_line = FALSE;
|
||||
didfind = findnextstr(TRUE, FALSE, current, current_x, answer, FALSE);
|
||||
findnextstr_wrap_reset();
|
||||
didfind = findnextstr(TRUE, FALSE, FALSE, current, current_x,
|
||||
answer, NULL);
|
||||
|
||||
/* Check to see if there's only one occurrence of the string and
|
||||
* we're on it now. */
|
||||
@@ -408,8 +485,8 @@ void do_search(void)
|
||||
* which case it's the only occurrence. */
|
||||
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
|
||||
last_search)) {
|
||||
didfind = findnextstr(TRUE, FALSE, current, current_x,
|
||||
answer, TRUE);
|
||||
didfind = findnextstr(TRUE, FALSE, TRUE, current, current_x,
|
||||
answer, NULL);
|
||||
if (fileptr == current && fileptr_x == current_x && !didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
} else {
|
||||
@@ -430,12 +507,13 @@ void do_search(void)
|
||||
void do_research(void)
|
||||
{
|
||||
size_t old_pww = placewewant, fileptr_x = current_x;
|
||||
int didfind;
|
||||
bool didfind;
|
||||
filestruct *fileptr = current;
|
||||
|
||||
#ifndef DISABLE_WRAPPING
|
||||
wrap_reset();
|
||||
#endif
|
||||
|
||||
search_init_globals();
|
||||
|
||||
if (last_search[0] != '\0') {
|
||||
@@ -446,9 +524,9 @@ void do_research(void)
|
||||
return;
|
||||
#endif
|
||||
|
||||
search_last_line = FALSE;
|
||||
didfind = findnextstr(TRUE, FALSE, current, current_x,
|
||||
last_search, FALSE);
|
||||
findnextstr_wrap_reset();
|
||||
didfind = findnextstr(TRUE, FALSE, FALSE, current, current_x,
|
||||
last_search, NULL);
|
||||
|
||||
/* Check to see if there's only one occurrence of the string and
|
||||
* we're on it now. */
|
||||
@@ -461,8 +539,8 @@ void do_research(void)
|
||||
* found again, in which case it's the only occurrence. */
|
||||
if (ISSET(USE_REGEXP) && regexp_bol_or_eol(&search_regexp,
|
||||
last_search)) {
|
||||
didfind = findnextstr(TRUE, FALSE, current, current_x,
|
||||
answer, TRUE);
|
||||
didfind = findnextstr(TRUE, FALSE, TRUE, current,
|
||||
current_x, answer, NULL);
|
||||
if (fileptr == current && fileptr_x == current_x && !didfind)
|
||||
statusbar(_("This is the only occurrence"));
|
||||
} else {
|
||||
@@ -491,9 +569,9 @@ void replace_abort(void)
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
int replace_regexp(char *string, int create_flag)
|
||||
int replace_regexp(char *string, bool create_flag)
|
||||
{
|
||||
/* Split personality here - if create_flag is zero, just calculate
|
||||
/* Split personality here - if create_flag is FALSE, just calculate
|
||||
* the size of the replacement line (necessary because of
|
||||
* subexpressions \1 to \9 in the replaced text). */
|
||||
|
||||
@@ -506,7 +584,8 @@ int replace_regexp(char *string, int create_flag)
|
||||
while (*c != '\0') {
|
||||
int num = (int)(*(c + 1) - '0');
|
||||
|
||||
if (*c != '\\' || num < 1 || num > 9 || num > search_regexp.re_nsub) {
|
||||
if (*c != '\\' || num < 1 || num > 9 || num >
|
||||
search_regexp.re_nsub) {
|
||||
if (create_flag)
|
||||
*string++ = *c;
|
||||
c++;
|
||||
@@ -520,7 +599,7 @@ int replace_regexp(char *string, int create_flag)
|
||||
/* But add the length of the subexpression to new_size. */
|
||||
new_size += i;
|
||||
|
||||
/* And if create_flag is nonzero, append the result of the
|
||||
/* And if create_flag is TRUE, append the result of the
|
||||
* subexpression match to the new line. */
|
||||
if (create_flag) {
|
||||
strncpy(string, current->data + current_x +
|
||||
@@ -579,31 +658,51 @@ char *replace_line(const char *needle)
|
||||
}
|
||||
|
||||
/* Step through each replace word and prompt user before replacing.
|
||||
* Parameters real_current and real_current_x are needed by the internal
|
||||
* speller, to allow the cursor position to be updated when a word
|
||||
* before the cursor is replaced by a shorter word.
|
||||
* Parameters real_current and real_current_x are needed in order to
|
||||
* allow the cursor position to be updated when a word before the cursor
|
||||
* is replaced by a shorter word.
|
||||
*
|
||||
* needle is the string to seek. We replace it with answer. Return -1
|
||||
* if needle isn't found, else the number of replacements performed. */
|
||||
int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
size_t *real_current_x, int wholewords)
|
||||
* if needle isn't found, else the number of replacements performed. If
|
||||
* canceled isn't NULL, set it to TRUE if we canceled. */
|
||||
ssize_t do_replace_loop(const char *needle, const filestruct
|
||||
*real_current, size_t *real_current_x, bool wholewords, bool
|
||||
*canceled)
|
||||
{
|
||||
int replaceall = FALSE, numreplaced = -1;
|
||||
size_t old_pww = placewewant, current_x_save = current_x;
|
||||
const filestruct *current_save = current;
|
||||
ssize_t numreplaced = -1;
|
||||
size_t match_len;
|
||||
size_t pww_save = placewewant;
|
||||
bool replaceall = FALSE;
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* The starting-line match and bol/eol regex flags. */
|
||||
int begin_line = FALSE, bol_or_eol = FALSE;
|
||||
bool begin_line = FALSE, bol_or_eol = FALSE;
|
||||
#endif
|
||||
#ifndef NANO_SMALL
|
||||
int mark_set = ISSET(MARK_ISSET);
|
||||
bool old_mark_set = ISSET(MARK_ISSET);
|
||||
filestruct *edittop_save = edittop, *top, *bot;
|
||||
size_t top_x, bot_x;
|
||||
bool right_side_up = FALSE;
|
||||
/* TRUE if (mark_beginbuf, mark_beginx) is the top of the mark,
|
||||
* FALSE if (current, current_x) is. */
|
||||
|
||||
UNSET(MARK_ISSET);
|
||||
edit_refresh();
|
||||
if (old_mark_set) {
|
||||
/* If the mark is on, partition the filestruct so that it
|
||||
* contains only the marked text, set edittop to the top of the
|
||||
* partition, turn the mark off, and refresh the screen. */
|
||||
mark_order((const filestruct **)&top, &top_x,
|
||||
(const filestruct **)&bot, &bot_x, &right_side_up);
|
||||
filepart = partition_filestruct(top, top_x, bot, bot_x);
|
||||
edittop = fileage;
|
||||
UNSET(MARK_ISSET);
|
||||
edit_refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
while (findnextstr(TRUE, wholewords, current_save, current_x_save,
|
||||
needle,
|
||||
if (canceled != NULL)
|
||||
*canceled = FALSE;
|
||||
|
||||
findnextstr_wrap_reset();
|
||||
while (findnextstr(TRUE, wholewords,
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* We should find a bol and/or eol regex only once per line. If
|
||||
* the bol_or_eol flag is set, it means that the last search
|
||||
@@ -613,10 +712,9 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
#else
|
||||
FALSE
|
||||
#endif
|
||||
) != 0) {
|
||||
, real_current, *real_current_x, needle, &match_len)) {
|
||||
|
||||
int i = 0;
|
||||
size_t match_len;
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
/* If the bol_or_eol flag is set, we've found a match on the
|
||||
@@ -636,19 +734,12 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
#endif
|
||||
|
||||
if (!replaceall) {
|
||||
placewewant = xplustabs();
|
||||
edit_redraw(current_save, old_pww);
|
||||
old_pww = placewewant;
|
||||
edit_redraw(real_current, pww_save);
|
||||
pww_save = placewewant;
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (ISSET(USE_REGEXP))
|
||||
match_len = regmatches[0].rm_eo - regmatches[0].rm_so;
|
||||
else
|
||||
#endif
|
||||
match_len = strlen(needle);
|
||||
|
||||
/* Record for the return value that we found the search string. */
|
||||
/* Record for the return value that we found the search
|
||||
* string. */
|
||||
if (numreplaced == -1)
|
||||
numreplaced = 0;
|
||||
|
||||
@@ -668,8 +759,11 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
free(exp_word);
|
||||
curs_set(1);
|
||||
|
||||
if (i == -1) /* We canceled the replace. */
|
||||
if (i == -1) { /* We canceled the replace. */
|
||||
if (canceled != NULL)
|
||||
*canceled = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
@@ -682,7 +776,7 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
|
||||
if (i > 0 || replaceall) { /* Yes, replace it!!!! */
|
||||
char *copy;
|
||||
int length_change;
|
||||
size_t length_change;
|
||||
|
||||
if (i == 2)
|
||||
replaceall = TRUE;
|
||||
@@ -692,24 +786,38 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
length_change = strlen(copy) - strlen(current->data);
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (current == mark_beginbuf && mark_beginx > current_x) {
|
||||
if (mark_beginx < current_x + match_len)
|
||||
mark_beginx = current_x;
|
||||
else
|
||||
mark_beginx += length_change;
|
||||
/* If the mark was on and (mark_beginbuf, mark_begin_x) was
|
||||
* the top of it, don't change mark_beginx. */
|
||||
if (!old_mark_set || !right_side_up) {
|
||||
/* Keep mark_beginx in sync with the text changes. */
|
||||
if (current == mark_beginbuf && mark_beginx >
|
||||
current_x) {
|
||||
if (mark_beginx < current_x + match_len)
|
||||
mark_beginx = current_x;
|
||||
else
|
||||
mark_beginx += length_change;
|
||||
}
|
||||
}
|
||||
|
||||
/* If the mark was on and (current, current_x) was the top
|
||||
* of it, don't change real_current_x. */
|
||||
if (!old_mark_set || right_side_up) {
|
||||
#endif
|
||||
/* Keep real_current_x in sync with the text changes. */
|
||||
if (current == real_current && current_x <=
|
||||
*real_current_x) {
|
||||
if (*real_current_x < current_x + match_len)
|
||||
*real_current_x = current_x + match_len;
|
||||
*real_current_x += length_change;
|
||||
}
|
||||
#ifndef NANO_SMALL
|
||||
}
|
||||
#endif
|
||||
|
||||
assert(0 <= match_len + length_change);
|
||||
if (current == real_current && current_x <= *real_current_x) {
|
||||
if (*real_current_x < current_x + match_len)
|
||||
*real_current_x = current_x + match_len;
|
||||
*real_current_x += length_change;
|
||||
}
|
||||
|
||||
/* Set the cursor at the last character of the replacement
|
||||
* text, so searching will resume after the replacement
|
||||
* text. Note that current_x might be set to -1 here. */
|
||||
* text. Note that current_x might be set to (size_t)-1
|
||||
* here. */
|
||||
#ifndef NANO_SMALL
|
||||
if (!ISSET(REVERSE_SEARCH))
|
||||
#endif
|
||||
@@ -734,24 +842,32 @@ int do_replace_loop(const char *needle, const filestruct *real_current,
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (old_mark_set) {
|
||||
/* If the mark was on, unpartition the filestruct so that it
|
||||
* contains all the text again, set edittop back to what it was
|
||||
* before, turn the mark back on, and refresh the screen. */
|
||||
unpartition_filestruct(&filepart);
|
||||
edittop = edittop_save;
|
||||
SET(MARK_ISSET);
|
||||
edit_refresh();
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If text has been added to the magicline, make a new magicline. */
|
||||
if (filebot->data[0] != '\0')
|
||||
new_magicline();
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
if (mark_set)
|
||||
SET(MARK_ISSET);
|
||||
#endif
|
||||
|
||||
return numreplaced;
|
||||
}
|
||||
|
||||
/* Replace a string. */
|
||||
void do_replace(void)
|
||||
{
|
||||
int i, numreplaced;
|
||||
int i;
|
||||
filestruct *edittop_save, *begin;
|
||||
size_t beginx;
|
||||
size_t beginx, pww_save;
|
||||
ssize_t numreplaced;
|
||||
|
||||
if (ISSET(VIEW_MODE)) {
|
||||
print_view_warning();
|
||||
@@ -759,7 +875,7 @@ void do_replace(void)
|
||||
return;
|
||||
}
|
||||
|
||||
i = search_init(1);
|
||||
i = search_init(TRUE, FALSE);
|
||||
if (i == -1) { /* Cancel, Go to Line, blank search
|
||||
* string, or regcomp() failed. */
|
||||
replace_abort();
|
||||
@@ -805,7 +921,7 @@ void do_replace(void)
|
||||
if (i == -1) { /* Cancel. */
|
||||
if (last_replace[0] != '\0')
|
||||
answer = mallocstrcpy(answer, last_replace);
|
||||
statusbar(_("Replace Cancelled"));
|
||||
statusbar(_("Cancelled"));
|
||||
}
|
||||
replace_abort();
|
||||
return;
|
||||
@@ -814,23 +930,26 @@ void do_replace(void)
|
||||
last_replace = mallocstrcpy(last_replace, answer);
|
||||
|
||||
/* Save where we are. */
|
||||
edittop_save = edittop;
|
||||
begin = current;
|
||||
beginx = current_x;
|
||||
edittop_save = edittop;
|
||||
search_last_line = FALSE;
|
||||
pww_save = placewewant;
|
||||
|
||||
numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE);
|
||||
numreplaced = do_replace_loop(last_search, begin, &beginx, FALSE,
|
||||
NULL);
|
||||
|
||||
/* Restore where we were. */
|
||||
edittop = edittop_save;
|
||||
current = begin;
|
||||
current_x = beginx;
|
||||
placewewant = pww_save;
|
||||
|
||||
renumber_all();
|
||||
edit_refresh();
|
||||
|
||||
if (numreplaced >= 0)
|
||||
statusbar(P_("Replaced %d occurrence", "Replaced %d occurrences",
|
||||
numreplaced), numreplaced);
|
||||
statusbar(P_("Replaced %ld occurrence", "Replaced %ld occurrences",
|
||||
(long)numreplaced), (long)numreplaced);
|
||||
|
||||
replace_abort();
|
||||
}
|
||||
@@ -839,7 +958,7 @@ void do_gotoline(int line, bool save_pos)
|
||||
{
|
||||
if (line <= 0) { /* Ask for it. */
|
||||
char *ans = mallocstrcpy(NULL, answer);
|
||||
int st = statusq(FALSE, goto_list, line < 0 ? ans : "",
|
||||
int i = statusq(FALSE, gotoline_list, line < 0 ? ans : "",
|
||||
#ifndef NANO_SMALL
|
||||
NULL,
|
||||
#endif
|
||||
@@ -848,16 +967,25 @@ void do_gotoline(int line, bool save_pos)
|
||||
free(ans);
|
||||
|
||||
/* Cancel, or Enter with blank string. */
|
||||
if (st == -1 || st == -2)
|
||||
statusbar(_("Aborted"));
|
||||
if (st != 0) {
|
||||
if (i < 0) {
|
||||
statusbar(_("Cancelled"));
|
||||
display_main_list();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Bounds check. */
|
||||
if (i == NANO_TOOTHERWHEREIS_KEY) {
|
||||
/* Keep answer up on the statusbar. */
|
||||
search_init(TRUE, TRUE);
|
||||
|
||||
do_search();
|
||||
return;
|
||||
}
|
||||
|
||||
/* Do a bounds check. Display a warning on an out-of-bounds
|
||||
* line number only if we hit Enter at the statusbar prompt. */
|
||||
if (!parse_num(answer, &line) || line < 0) {
|
||||
statusbar(_("Come on, be reasonable"));
|
||||
if (i == 0)
|
||||
statusbar(_("Come on, be reasonable"));
|
||||
display_main_list();
|
||||
return;
|
||||
}
|
||||
@@ -877,7 +1005,7 @@ void do_gotoline(int line, bool save_pos)
|
||||
|
||||
/* If save_pos is TRUE, don't change the cursor position when
|
||||
* updating the edit window. */
|
||||
edit_update(current, save_pos ? NONE : CENTER);
|
||||
edit_update(save_pos ? NONE : CENTER);
|
||||
|
||||
placewewant = 0;
|
||||
display_main_list();
|
||||
@@ -889,7 +1017,7 @@ void do_gotoline_void(void)
|
||||
}
|
||||
|
||||
#if defined(ENABLE_MULTIBUFFER) || !defined(DISABLE_SPELLER)
|
||||
void do_gotopos(int line, int pos_x, int pos_y, size_t pos_pww)
|
||||
void do_gotopos(int line, size_t pos_x, int pos_y, size_t pos_pww)
|
||||
{
|
||||
/* Since do_gotoline() resets the x-coordinate but not the
|
||||
* y-coordinate, set the coordinates up this way. */
|
||||
@@ -913,7 +1041,7 @@ void do_find_bracket(void)
|
||||
char ch_under_cursor, wanted_ch;
|
||||
const char *pos, *brackets = "([{<>}])";
|
||||
char regexp_pat[] = "[ ]";
|
||||
size_t old_pww, current_x_save;
|
||||
size_t current_x_save, pww_save;
|
||||
int count = 1;
|
||||
long flags_save;
|
||||
filestruct *current_save;
|
||||
@@ -929,9 +1057,9 @@ void do_find_bracket(void)
|
||||
assert(strlen(brackets) % 2 == 0);
|
||||
wanted_ch = brackets[(strlen(brackets) - 1) - (pos - brackets)];
|
||||
|
||||
old_pww = placewewant;
|
||||
current_x_save = current_x;
|
||||
current_save = current;
|
||||
current_x_save = current_x;
|
||||
pww_save = placewewant;
|
||||
flags_save = flags;
|
||||
SET(USE_REGEXP);
|
||||
|
||||
@@ -954,24 +1082,24 @@ void do_find_bracket(void)
|
||||
/* We constructed regexp_pat to be a valid expression. */
|
||||
assert(regexp_compiled);
|
||||
|
||||
search_last_line = FALSE;
|
||||
findnextstr_wrap_reset();
|
||||
while (TRUE) {
|
||||
if (findnextstr(FALSE, FALSE, current, current_x, regexp_pat,
|
||||
FALSE) != 0) {
|
||||
if (findnextstr(FALSE, FALSE, FALSE, current, current_x,
|
||||
regexp_pat, NULL)) {
|
||||
/* Found identical bracket. */
|
||||
if (current->data[current_x] == ch_under_cursor)
|
||||
count++;
|
||||
/* Found complementary bracket. */
|
||||
else if (--count == 0) {
|
||||
placewewant = xplustabs();
|
||||
edit_redraw(current_save, old_pww);
|
||||
edit_redraw(current_save, pww_save);
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
/* Didn't find either a left or right bracket. */
|
||||
statusbar(_("No matching bracket"));
|
||||
current_x = current_x_save;
|
||||
current = current_save;
|
||||
current_x = current_x_save;
|
||||
update_line(current, current_x);
|
||||
break;
|
||||
}
|
||||
|
||||
125
src/utils.c
125
src/utils.c
@@ -19,7 +19,9 @@
|
||||
* *
|
||||
**************************************************************************/
|
||||
|
||||
#include "config.h"
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@@ -44,11 +46,10 @@ int regexec_safe(const regex_t *preg, const char *string, size_t nmatch,
|
||||
#define regexec(preg, string, nmatch, pmatch, eflags) regexec_safe(preg, string, nmatch, pmatch, eflags)
|
||||
#endif /* BROKEN_REGEXEC */
|
||||
|
||||
/* Assume that string will be found by regexec() if the REG_NOTBOL and
|
||||
* REG_NOTEOL glags are not set. */
|
||||
int regexp_bol_or_eol(const regex_t *preg, const char *string)
|
||||
{
|
||||
return (regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
|
||||
return (regexec(preg, string, 0, NULL, 0) == 0 &&
|
||||
regexec(preg, string, 0, NULL, REG_NOTBOL | REG_NOTEOL) ==
|
||||
REG_NOMATCH);
|
||||
}
|
||||
#endif /* HAVE_REGEX_H */
|
||||
@@ -84,9 +85,9 @@ int num_of_digits(int n)
|
||||
return i;
|
||||
}
|
||||
|
||||
/* Read an int from str, and store it in *val (if val is not NULL). On
|
||||
* error, we return FALSE and don't change *val. Otherwise, we return
|
||||
* TRUE. */
|
||||
/* Read a ssize_t from str, and store it in *val (if val is not NULL).
|
||||
* On error, we return FALSE and don't change *val. Otherwise, we
|
||||
* return TRUE. */
|
||||
bool parse_num(const char *str, ssize_t *val)
|
||||
{
|
||||
char *first_error;
|
||||
@@ -310,7 +311,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
const char *start)
|
||||
{
|
||||
/* start can be 1 character before the start or after the end of the
|
||||
* line. In either case, we just say there is no match found. */
|
||||
* line. In either case, we just say no match was found. */
|
||||
if ((start > haystack && *(start - 1) == '\0') || start < haystack)
|
||||
return NULL;
|
||||
assert(haystack != NULL && needle != NULL && start != NULL);
|
||||
@@ -322,7 +323,7 @@ const char *strstrwrapper(const char *haystack, const char *needle,
|
||||
&& haystack + regmatches[0].rm_so <= start) {
|
||||
const char *retval = haystack + regmatches[0].rm_so;
|
||||
|
||||
/* Search forward until there is no more match. */
|
||||
/* Search forward until there are no more matches. */
|
||||
while (regexec(&search_regexp, retval + 1, 1, regmatches,
|
||||
REG_NOTBOL) == 0 && retval + 1 +
|
||||
regmatches[0].rm_so <= start)
|
||||
@@ -395,9 +396,10 @@ void *nrealloc(void *ptr, size_t howmuch)
|
||||
return r;
|
||||
}
|
||||
|
||||
/* Copy one malloc()ed string to another pointer. Should be used as:
|
||||
* dest = mallocstrcpy(dest, src); */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
/* Copy the first n characters of one malloc()ed string to another
|
||||
* pointer. Should be used as: "dest = mallocstrncpy(dest, src,
|
||||
* n);". */
|
||||
char *mallocstrncpy(char *dest, const char *src, size_t n)
|
||||
{
|
||||
if (src == NULL)
|
||||
src = "";
|
||||
@@ -405,18 +407,33 @@ char *mallocstrcpy(char *dest, const char *src)
|
||||
if (src != dest)
|
||||
free(dest);
|
||||
|
||||
dest = charalloc(strlen(src) + 1);
|
||||
strcpy(dest, src);
|
||||
dest = charalloc(n);
|
||||
strncpy(dest, src, n);
|
||||
|
||||
return dest;
|
||||
}
|
||||
|
||||
/* Append a new magic-line to filebot. */
|
||||
/* Copy one malloc()ed string to another pointer. Should be used as:
|
||||
* "dest = mallocstrcpy(dest, src);". */
|
||||
char *mallocstrcpy(char *dest, const char *src)
|
||||
{
|
||||
return mallocstrncpy(dest, src, src == NULL ? 1 : strlen(src) + 1);
|
||||
}
|
||||
|
||||
/* Free the malloc()ed string at dest and return the malloc()ed string
|
||||
* at src. Should be used as: "answer = mallocstrassn(answer,
|
||||
* real_dir_from_tilde(answer));". */
|
||||
char *mallocstrassn(char *dest, char *src)
|
||||
{
|
||||
free(dest);
|
||||
return src;
|
||||
}
|
||||
|
||||
/* Append a new magicline to filebot. */
|
||||
void new_magicline(void)
|
||||
{
|
||||
filebot->next = (filestruct *)nmalloc(sizeof(filestruct));
|
||||
filebot->next->data = charalloc(1);
|
||||
filebot->next->data[0] = '\0';
|
||||
filebot->next->data = mallocstrcpy(NULL, "");
|
||||
filebot->next->prev = filebot;
|
||||
filebot->next->next = NULL;
|
||||
filebot->next->lineno = filebot->lineno + 1;
|
||||
@@ -426,23 +443,89 @@ void new_magicline(void)
|
||||
}
|
||||
|
||||
#ifndef NANO_SMALL
|
||||
/* Remove the magicline from filebot, if there is one and it isn't the
|
||||
* only line in the file. */
|
||||
void remove_magicline(void)
|
||||
{
|
||||
if (filebot->data[0] == '\0' && filebot->prev != NULL) {
|
||||
filebot = filebot->prev;
|
||||
free_filestruct(filebot->next);
|
||||
filebot->next = NULL;
|
||||
totlines--;
|
||||
totsize--;
|
||||
}
|
||||
}
|
||||
|
||||
/* Calculate the number of lines and the number of characters between
|
||||
* begin and end, and return them in lines and size, respectively. */
|
||||
void get_totals(const filestruct *begin, const filestruct *end, int
|
||||
*lines, long *size)
|
||||
{
|
||||
const filestruct *f;
|
||||
|
||||
if (lines != NULL)
|
||||
*lines = 0;
|
||||
if (size != NULL)
|
||||
*size = 0;
|
||||
|
||||
/* Go through the lines from begin to end->prev, if we can. */
|
||||
for (f = begin; f != NULL && f != end; f = f->next) {
|
||||
/* Count this line. */
|
||||
if (lines != NULL)
|
||||
(*lines)++;
|
||||
|
||||
/* Count the number of characters on this line. */
|
||||
if (size != NULL) {
|
||||
*size += strlen(f->data);
|
||||
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
(*size)++;
|
||||
}
|
||||
}
|
||||
|
||||
/* Go through the line at end, if we can. */
|
||||
if (f != NULL) {
|
||||
/* Count this line. */
|
||||
if (lines != NULL)
|
||||
(*lines)++;
|
||||
|
||||
/* Count the number of characters on this line. */
|
||||
if (size != NULL) {
|
||||
*size += strlen(f->data);
|
||||
|
||||
/* Count the newline if we have one. */
|
||||
if (f->next != NULL)
|
||||
(*size)++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Set top_x and bot_x to the top and bottom x-coordinates of the mark,
|
||||
* respectively, based on the locations of top and bot. */
|
||||
* respectively, based on the locations of top and bot. If
|
||||
* right_side_up isn't NULL, set it to TRUE If the mark begins with
|
||||
* (mark_beginbuf, mark_beginx) and ends with (current, current_x), or
|
||||
* FALSE otherwise. */
|
||||
void mark_order(const filestruct **top, size_t *top_x, const filestruct
|
||||
**bot, size_t *bot_x)
|
||||
**bot, size_t *bot_x, bool *right_side_up)
|
||||
{
|
||||
assert(top != NULL && top_x != NULL && bot != NULL && bot_x != NULL);
|
||||
if ((current->lineno == mark_beginbuf->lineno && current_x > mark_beginx)
|
||||
|| current->lineno > mark_beginbuf->lineno) {
|
||||
|
||||
if ((current->lineno == mark_beginbuf->lineno && current_x >
|
||||
mark_beginx) || current->lineno > mark_beginbuf->lineno) {
|
||||
*top = mark_beginbuf;
|
||||
*top_x = mark_beginx;
|
||||
*bot = current;
|
||||
*bot_x = current_x;
|
||||
if (right_side_up != NULL)
|
||||
*right_side_up = TRUE;
|
||||
} else {
|
||||
*bot = mark_beginbuf;
|
||||
*bot_x = mark_beginx;
|
||||
*top = current;
|
||||
*top_x = current_x;
|
||||
if (right_side_up != NULL)
|
||||
*right_side_up = FALSE;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
929
src/winio.c
929
src/winio.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user