Commit Graph

6223 Commits

Author SHA1 Message Date
Mike Frysinger
ba8d71f447 add support for gnulib
On a system with up-to-date GNU tools, this does not change
the size of nano's binary.

We start off with importing only a few modules, although we
don't yet delete the fallback logic for them.
2017-03-06 11:56:02 +01:00
Mike Frysinger
9d0331dea2 configure: require gettext-0.18.3, and drop our bundled m4 files
The gettext-0.18.3 release was made in Jul 2013, while the 0.11.5
release was made in Aug 2002.  Time to update :).

Also drop all the bundled gettext m4 files.  When you run autogen.sh,
these will get copied in automatically for you.
2017-03-06 11:52:16 +01:00
Mike Frysinger
c04a8ce654 configure: require autoconf-2.69/automake-1.14
The autoconf-2.69 release was made in Apr 2012.
The automake-1.14 release was made in Jun 2013.

Update the requirements so we know we can rely on macros/features
available in those versions.
2017-03-06 11:52:04 +01:00
Benno Schulenberg
83a841cd06 tweaks: chuck some debugging stuff and some useless asserts 2017-03-01 13:56:08 +01:00
Benno Schulenberg
0af5788a94 tweaks: reduce the scope of five variables, and frob some comments 2017-03-01 09:56:38 +01:00
Benno Schulenberg
d5b950cc29 tweaks: don't turn the mark off before it's needed
The mark only needs to be off when calling replace_marked_buffer(),
because this indirectly calls ingraft_buffer(), which fiddles with
the end points if the mark is on.
2017-03-01 09:35:45 +01:00
Benno Schulenberg
adf69a05f1 spelling: keep the cursor at end-of-line if it was there
This fixes https://savannah.gnu.org/bugs/?50415.
2017-02-28 20:45:49 +01:00
Benno Schulenberg
355a07bbce tweaks: don't optimize for the wrong case
Running strlenpt() on a string that takes up more than 80 columns
(the width of an average terminal) takes /more/ time than simply
converting an extra character (the one that will be overwritten
by the "$" at the edge of the terminal).  So... just convert one
more character than necessary when the line is overlong.  In the
most common case, however, the line will fit fully onscreen, and
we save a whole call of strlenpt().
2017-02-28 17:07:38 +01:00
David Lawrence Ramsey
0404474ec2 tweaks: stop converting text once we overshoot span columns
Since we only need span columns of the string, stop scanning the string
as soon as we have that many columns, instead of scanning the string all
the way to the end.  This speeds up the conversion of very long lines.
2017-02-28 16:50:22 +01:00
Benno Schulenberg
a80ade38d7 tweaks: rename two variables, to be more distinctive 2017-02-28 15:17:03 +01:00
Benno Schulenberg
48643cbdf3 tweaks: elide a small intermediate buffer 2017-02-28 15:05:02 +01:00
Benno Schulenberg
aa013aa007 tweaks: elide a variable 2017-02-28 14:53:10 +01:00
Benno Schulenberg
91910b2364 input: count a manually entered unicode as one character
This fixes https://savannah.gnu.org/bugs/?50403.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-02-28 14:47:45 +01:00
David Lawrence Ramsey
29681e0e9f weeding: remove partitioning and related stuff from do_justify()
Replace partitioning with calls to extract_buffer() and ingraft_buffer().

In addition to pasting the unjustified text back into the buffer at
current[current_x], ingraft_buffer() also deals with renumbering and
updating totsize, so do_justify() doesn't need to do those anymore
when unjustifying.
2017-02-28 14:35:44 +01:00
David Lawrence Ramsey
234bd9c9be speller: fix replacing marked text in the alternate spell checker
With read_file() revamped, it now uses partition_filestruct() indirectly
via ingraft_buffer(), so we can't use partition_filestruct() to replace
marked text in the alternate spell checker anymore without segfaulting.

Add the new function replace_marked_buffer() to accomplish this instead.
Based on replace_buffer(), it uses extract_buffer() to throw away the
marked un-spell-checked text, and then uses read_file() to insert the
spell-checked text at the position where the mark was.

Accordingly, remove unneeded partitioning and related stuff from
do_alt_speller().  Besides pasting the file into the buffer at
current[current_x], ingraft_buffer() also deals with renumbering,
updating totsize, and handling a magicline, so do_alt_speller()
doesn't need to do those anymore.
2017-02-28 14:35:44 +01:00
David Lawrence Ramsey
0d9313763d undo: fix undoing/redoing insertions, since they no longer do partitioning 2017-02-28 14:35:44 +01:00
David Lawrence Ramsey
ef43ebfef4 weeding: remove partitioning and related stuff from do_insertfile()
With read_file() revamped to handle inserting a file at the current
position, partitioning the buffer is no longer needed.
2017-02-28 14:35:44 +01:00
David Lawrence Ramsey
86f7bc1868 files: revamp the insertion of a file, to be more like pasting text
Move buffer handling and '\r' stripping from read_line() to read_file(),
so that the file gets its format determined and gets stored in its own
buffer entirely in one function.  Then use ingraft_buffer() to insert
this new buffer into the current one.

In addition to pasting the file at current[current_x], ingraft_buffer()
also deals with renumbering, the updating of totsize, and the handling
of a magicline, so read_file() doesn't need to do those anymore.

Note that all this makes read_file() depend on the position of
current[current_x] to know where to insert the file.  Accordingly,
set current_x to zero in initialize_buffer_text() instead of in
make_new_buffer(), so that replace_buffer() keeps working properly.
2017-02-28 14:35:44 +01:00
Benno Schulenberg
3d9a4d6257 tweaks: make WhereIsNext available in browser in tiny version
Also, avoid a warning with with --enable-tiny --enable-browser.
2017-02-27 19:22:50 +01:00
Benno Schulenberg
eb67af9347 tweaks: fix compilation with --enable-tiny --enable-help 2017-02-27 19:10:39 +01:00
Benno Schulenberg
efdd73922e oops -- that's what you get when you don't test things before pushing
Of course 'row' needs to be initialized to zero for the softwrap case.
2017-02-26 18:29:18 +01:00
Benno Schulenberg
2e53ed2928 tweaks: use two extra variables to make it clearer what is being done
This addresses https://savannah.gnu.org/patch/?9215.
Inspired-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-02-26 17:33:10 +01:00
Benno Schulenberg
59e10bdef2 usage: don't mention +LINE,COLUMN as an option, because it isn't
Add its explanation as a separate paragraph.

Also: improve the argument of the --syntax option, as this is a <name>
and not merely a bundle of characters like the other <str> arguments.
2017-02-25 14:05:07 +01:00
David Lawrence Ramsey
6eefad4fff tweaks: mention nano's ability to read from standard input in usage() 2017-02-25 14:00:27 +01:00
Benno Schulenberg
e5731fe198 tweaks: reshuffle three statements, and shorten a comment 2017-02-25 12:33:01 +01:00
Benno Schulenberg
2bbb6cfeb5 wrapping: add the correct char length when skipping consecutive blanks
In this last loop of break_line(), the pointer 'line' is one step ahead
of the index 'lastblank'.  So the loop should first add the length of
the preceding character to 'lastblank' before determining the length
of the current character (and using this to advance 'line').
2017-02-25 11:18:24 +01:00
Benno Schulenberg
1623bc7779 tweaks: rename three variables, to better distinguish bytes from columns
(There is something wrong in the last loop: line is one character ahead
of lastblank, but the current character length is added to both of them.
It thus assumes that all blank characters are the same number of bytes.
For spaces and tabs this works fine.  But for more exotic blanks...)
2017-02-24 22:08:55 +01:00
Benno Schulenberg
99ecd33c18 tweaks: elide two variables, and condense some statements
Also, remove an assert and adjust some comments.
2017-02-24 21:11:37 +01:00
David Lawrence Ramsey
6500f769aa tweaks: move comments outside of if blocks in break_line() 2017-02-24 21:04:31 +01:00
David Lawrence Ramsey
f95836a951 tweaks: remove cluttering #ifdefs from break_line()
Also, rename a parameter to be less cryptic, and remove an entire
condition because the relevant block will never be reached when
getting called from the help routines: if blank_loc is negative,
the function will have bailed out in the preceding if.
2017-02-24 17:33:39 +01:00
Benno Schulenberg
0378146add tweaks: rename a variable, drop a false assert, and reshuffle a bit 2017-02-24 15:07:04 +01:00
David Lawrence Ramsey
6e9d6a08b9 replacing: fix spotlight() to highlight words properly in softwrap mode
In softwrap mode, the entire line is onscreen, so the word is never
partially offscreen, so we always have enough columns to show it.

This fixes https://savannah.gnu.org/bugs/?50389.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-02-24 15:06:44 +01:00
Benno Schulenberg
07ebba5e99 tweaks: rename a variable and invert its logic 2017-02-24 12:21:59 +01:00
Benno Schulenberg
9e6e1ebe58 tweaks: remove a disabled warning, and adjust a translator hint 2017-02-24 12:06:15 +01:00
Benno Schulenberg
d365ca80bf tweaks: optimize determining the number of columns that a text spans
Give the strlenpt() routine its own implementation, so that it avoids
a needless comparison plus subtraction in the inner loop.
2017-02-24 11:01:24 +01:00
David Lawrence Ramsey
f1d214c0ef tweaks: slightly optimize an allocation in display_string()
Instead of allocating enough space to convert the entire passed string,
just allocate space for converting the part that will be converted --
that is: starting from start_index.  This still allocates far too much
(if the passed string is very long and its tail part won't fit on the
screen), but it's better than before.
2017-02-24 10:52:04 +01:00
Benno Schulenberg
1d3f3a6e25 tweaks: mark a message for translation 2017-02-23 15:22:07 +01:00
Benno Schulenberg
4474bc0970 po: update translations and regenerate POT file and PO files 2017-02-23 11:46:40 +01:00
Benno Schulenberg
926fe5f789 bump version numbers and add a news item for the 2.7.5 release 2017-02-23 11:33:45 +01:00
Mike Frysinger
d0c64e8086 syntax: gentoo: match .eblit files too 2017-02-22 13:35:36 -05:00
Benno Schulenberg
de3260cdb1 justify: reduce the character count when trimming trailing spaces
This fixes https://savannah.gnu.org/bugs/?50379.
2017-02-22 17:29:39 +01:00
Benno Schulenberg
23c3fd9bcd statusbar: display at most three consecutive alert messages
Cap the number of pauses when displaying ALERT messages, to avoid
making the user wait for ages when tens or hundreds of files were
specified on the command line.

This fixes https://savannah.gnu.org/bugs/?50362.
Reported-by: Mike Frysinger <vapier@gentoo.org>
2017-02-22 10:48:26 +01:00
Benno Schulenberg
c118397a14 tweaks: update some copyright years
Reflect the significant changes in painting and regex searching
in the copyright notices.
2017-02-21 20:27:49 +01:00
Mike Frysinger
cd5d7faa4e syntax: gentoo: flag mixed whitespace 2017-02-21 17:46:13 +01:00
Mike Frysinger
3ca6c9241f syntax: c++: add override keyword 2017-02-21 17:46:07 +01:00
David Lawrence Ramsey
a847d37b24 tweaks: split the grafting code off from copy_from_buffer()
Later on we're going to need the ability to graft a buffer into the
current file buffer without making a copy of it first.
2017-02-17 21:00:34 +01:00
David Lawrence Ramsey
1cb945fe8e tweaks: rename the functions for moving to and copying from a buffer
The name "filestruct" was a mistake.  What was meant was:
buffer -- a linked list of structs that each describe a line.
2017-02-17 20:06:32 +01:00
Benno Schulenberg
330741b650 tweaks: adjust two comments, to be more accurate 2017-02-17 19:59:34 +01:00
David Lawrence Ramsey
f773d715e8 tweaks: rewrap two lines and fix two typos 2017-02-17 19:55:54 +01:00
Benno Schulenberg
407f2d5bcf tweaks: move a comment and rewrap a line 2017-02-17 12:01:25 +01:00