Commit Graph

6207 Commits (ef43ebfef4c7fd7a8c9ded728a190afa38a10ec4)

Author SHA1 Message Date
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
David Lawrence Ramsey 61e8b3d542 screen: don't hide two-column characters at left edge in softwrap mode
When in softwrap mode, no "$" continuation characters are displayed,
so the code that reserves space for them should be skipped then.

This fixes https://savannah.gnu.org/bugs/?50335.
2017-02-17 11:39:37 +01:00
Benno Schulenberg de36e1c120 tweaks: rename a variable, to be more general 2017-02-16 13:27:09 +01:00
Benno Schulenberg a8c1dc1402 rcfile: don't accept empty regexes for syntax coloring
As a small service to the user, reject empty regex strings,
because an entirely empty regex simply doesn't make sense.

Inspired-by: Elia Geretto <elia.f.geretto@gmail.com>
2017-02-16 13:25:38 +01:00
Benno Schulenberg d60e7d374c spelling: correctly adjust the length of a single-line region
When the marked region covers only a single line (or a part of it),
its new endpoint is not simply the length of the last line of the
spell-checked text, but instead the old endpoint plus the /change/
in length.

This fixes https://savannah.gnu.org/bugs/?50316.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>
2017-02-16 11:52:24 +01:00
Benno Schulenberg 2358badc65 painting: properly detect a change in start/end matches
The inversion of the logic in commit a6605dce was incomplete -- oops.

This fixes https://savannah.gnu.org/bugs/?50306.
2017-02-14 16:56:43 +01:00
David Lawrence Ramsey efdb543f8c tweaks: fix compilation when configured with --enable-tiny 2017-02-13 20:41:48 +01:00
David Lawrence Ramsey c24545fe9a tweaks: always directly do a refresh when the margin changes
The previous code only directly refreshed the screen when the margin
changed due to toggling line numbering on.  When the margin changed
due to toggling it off, it would indirectly refresh via do_toggle().
2017-02-13 20:25:38 +01:00
Benno Schulenberg 8fbadecf0a tweaks: adjust whitespace after preceding changes 2017-02-13 19:47:24 +01:00
Benno Schulenberg a6605dce00 tweaks: rename two variables, to avoid double negatives 2017-02-13 19:47:20 +01:00
Benno Schulenberg 9ec546d293 tweaks: rename a function, and drop an unneeded parameter
When replacements are made, nothing needs to be reset any more
(it was done insufficiently anyway).  Just make sure the screen
is refreshed when all is done -- this may be superfluous when
doing interactive replacements, but not when replacing all.
2017-02-13 19:47:03 +01:00
Benno Schulenberg fccfcccd37 tweaks: reshuffle an assignment and trim some comments 2017-02-13 19:46:51 +01:00
Benno Schulenberg 03148804e6 tweaks: scrap some debugging stuff 2017-02-13 19:46:41 +01:00
Benno Schulenberg 3b86c7a190 tweaks: discard the now unused multidata-resetting routine 2017-02-13 12:14:58 +01:00
Benno Schulenberg 7ef5c53263 painting: mark an unpaired start match as CWOULDBE
The lines that come after an unpaired start have to know about this.

This fixes https://savannah.gnu.org/bugs/?50293.
2017-02-13 11:18:54 +01:00
Benno Schulenberg 6bd94040df painting: don't look at the current multidata when coloring a line
When coloring a line, look only at the multidata of the preceding
line, and based on that determine what to seek in the current line.

This fixes https://savannah.gnu.org/bugs/?50292.
2017-02-13 10:03:07 +01:00
Benno Schulenberg b3bcc8eeac painting: make use of the multidata of the preceding line
When painting a line, the multidata of the line /before/ it is valid
in most cases: it was determined just a moment ago.  And it tells us
all we need to know: whether there is an unpaired start match before
the current line or not.

The only exception is when painting the first line of the screen:
the multidata of the line before it might be stale.  So for the
first screen line we will always have to do some backtracking.
But that is left for later.

This fixes https://savannah.gnu.org/bugs/?50121.
2017-02-12 18:24:49 +01:00