Commit Graph

8031 Commits

Author SHA1 Message Date
Benno Schulenberg 71236e145d tweaks: rename two variables, away from a single letter
And adjust the indentation after the previous change.
2019-06-09 11:08:34 +02:00
Benno Schulenberg 7be76af418 tweaks: speed up the counting of characters in mbstrlen()
This function is used in get_totsize(), so speed is important.

There is no reason why the length of the string must limited to a
certain size -- that is just a leftover from the function merge in
commit ba2e6f43 from a year ago.
2019-06-09 11:04:52 +02:00
Benno Schulenberg fb17929fab tweaks: use FALSE for booleans instead of zero
Also adjust some indentation and reduce the scope of a variable.
2019-06-09 10:41:14 +02:00
Benno Schulenberg fea1901592 docs: remove "--" from the default value of 'quotestr'
Adjust the documentation to the removal of "--" in the previous commit.
2019-06-08 17:48:44 +02:00
Benno Schulenberg 33fea90bcd justify: remove "--" from the quoting regex, to avoid false paragraphs
The use of a double dash (for an option name or as sentence separator)
is too common to allow it to be seen always as a comment introducer.
Users of Lua and Postgres will have to redefine 'quotestr' themselves
if they want to be able to rewrap block comments with ^J.

The other characters that were added in commit c5a72103 (!, %, and ;)
are less problematic because they tend to be glued to the end of words,
so they are unlikely to appear at the start of a line.

This fixes https://savannah.gnu.org/bugs/?56462,
and fixes https://savannah.gnu.org/bugs/?56461.

Bug existed since version 4.0, commit c5a72103.
2019-06-08 16:47:08 +02:00
Benno Schulenberg f03c87c300 tweaks: squeeze excess spaces out of a line in situ
There is no need to make a copy of the line, because if there are some
bytes that are moved, they are always moved toward the left -- the line
can only shrink, never expand.
2019-06-08 16:17:59 +02:00
Benno Schulenberg 45b1a38b82 tweaks: factor out a fragment of code that is repeated three times 2019-06-08 14:17:41 +02:00
Benno Schulenberg c3bf17a801 tweaks: improve a handful of comments 2019-06-08 14:00:24 +02:00
Benno Schulenberg 8582e4a6b9 tweaks: don't bother keeping track of whether a squeezed line has shrunk
When squeezing excess spaces from a line has proved unsuccessful, we
have already copied all of its data, so it hardly makes a difference
whether we free the old or the new data.  Choose to free always the
old data, so that we can simplify things.
2019-06-08 14:00:03 +02:00
Benno Schulenberg 9b34d0a4fb tweaks: rename two variables, to be unique 2019-06-08 10:10:31 +02:00
Benno Schulenberg 26d16ab9d1 tweaks: rename a variable, to better suit its counterpart 2019-06-08 10:05:32 +02:00
Benno Schulenberg 6ca8518428 tweaks: make better use of two variables, and reshuffle two comments 2019-06-08 10:03:15 +02:00
Benno Schulenberg f2c61c4b9a docs: mention the default value for 'errorcolor' 2019-06-07 11:24:51 +02:00
Benno Schulenberg c4e04eb682 docs: show double quotes where they are needed
Instead of saying that string parameters should be enclosed in
double quotes, just show the quotes in the relevant commands.

Also, rename the parameters, to better fit the subsequent description.
2019-06-07 11:15:02 +02:00
Benno Schulenberg 0b257fe558 tweaks: sort three translator names better 2019-06-06 15:22:02 +02:00
Benno Schulenberg 941637615b docs: clarify that in nano regexes are extended regular expressions
And add a concise summary of the most important special characters.

This addresses https://savannah.gnu.org/bugs/?56438.
2019-06-06 15:16:56 +02:00
Benno Schulenberg 378aa8bc41 docs: slightly reword the notice about the changed defaults since 4.0 2019-06-05 19:40:15 +02:00
Benno Schulenberg 157098ee75 gnulib: update to its current upstream state 2019-06-05 16:45:27 +02:00
Benno Schulenberg 8d4e171d3c tweaks: improve a couple of comments 2019-06-05 16:23:34 +02:00
Benno Schulenberg 6f1e5912a9 tweaks: stop allocating and freeing a holder struct for every cut/paste
This "holder" information is needed for every cut and paste and other
block operation.  Instead of allocating and freeing it for every such
operation, just have the six elements as static variables.  This saves
a little churn, and saves having to declare a type that is used just
once.  Plus, the access to these variables will be a little quicker.
2019-06-05 16:10:07 +02:00
Benno Schulenberg 28a6d9f300 tweaks: rename four elements of the holder struct, for more contrast 2019-06-05 15:32:50 +02:00
Benno Schulenberg f92606491c speller: when something goes wrong with 'sort', do not blame 'spell'
That is, check the exit status of 'sort' before the one of 'spell'.
2019-06-05 15:07:33 +02:00
Benno Schulenberg 260588af1e speller: be more concise and to the point when something goes wrong 2019-06-05 14:57:24 +02:00
Benno Schulenberg cdc9482d8f tweaks: rename three variables, to use full words instead of abbrevs 2019-06-05 14:50:01 +02:00
Benno Schulenberg 7c1b649eb8 tweaks: rename a function and its parameters, to be more fitting
Also, reshuffle their order, and improve or adjust some comments.
And change the type of 'pairnum' to short, what ncurses uses too.
2019-06-05 13:08:14 +02:00
Brand Huntsman 57b3f83cfe rcfile: compile the color regexes just once
When a syntax gets parsed, store the compiled color regexes right away,
instead of compiling them a second time in color_update().

This addresses https://savannah.gnu.org/bugs/?56432.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2019-06-04 19:57:46 +02:00
Benno Schulenberg edbdcb9b9a docs: add a light warning to the explanation of --nonewlines 2019-06-04 19:54:58 +02:00
Benno Schulenberg a6978b54f1 docs: say thanks to the Korean translator, and trim a double space 2019-06-04 19:32:52 +02:00
Brand Huntsman 8bc2d18fa9 tweaks: remove an unneeded pre-processor '#else' clause
Commit 1e2e6733 added braces and made the semicolon no longer needed
when libmagic is not used.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2019-06-04 19:27:34 +02:00
Brand Huntsman fb10a94f35 startup: prevent a crash when no applicable syntax is found
This fixes https://savannah.gnu.org/bugs/?56434.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2019-06-04 12:42:24 +02:00
Benno Schulenberg 9b30bb15cc tweaks: adjust the indentation after the previous change
And reshuffle two declarations.
2019-06-03 15:51:07 +02:00
Benno Schulenberg a1669e1bfd rcfile: disallow extending a syntax that is defined in a main nanorc
The /etc/nanorc file should not define any syntax directly (and
preferably not include any either, to not slow startup down with
syntaxes the user is never going to use), and if the ~/.nanorc file
defines a syntax directly, there is no need to use 'extendsyntax':
the command can be added to the syntax itself -- it would be better
even: it keeps things together.
2019-06-03 15:42:06 +02:00
Benno Schulenberg 3d6eca3f26 tweaks: reshuffle some lines, to put the most likely candidate first 2019-06-03 15:04:00 +02:00
Benno Schulenberg c025a60ce9 tweaks: rename a function and a variable, for contrast and variety 2019-06-03 15:01:28 +02:00
Benno Schulenberg 5e1f90d8fa tweaks: don't bother to free the content of 'extendsyntax' commands
Extending a syntax will be rather rare, so the amount of memory it
takes up will be minimal.  It's not worth the trouble to free this
memory -- it only takes time.  Plus: we don't bother to free the
memory of a syntax that gets fully redefined either.
2019-06-03 14:37:27 +02:00
Benno Schulenberg 7f3ffe8544 tweaks: remove a bit of redundant code
When an included file has just been fully parsed, 'lastcolor' is still
pointing at the last color regex that was added to the list -- no need
to refind the end of this list.
2019-06-03 14:21:17 +02:00
Benno Schulenberg ea1016efdb feedback: make an error check work also when curses hasn't started yet
Add a temporary boolean for this, because isendwin() returns TRUE
only when curses mode has actually been started with initscr() and
then exited with endwin().
2019-06-03 13:38:21 +02:00
Benno Schulenberg f63fee79e3 tweaks: merge two functions, as the first is called just once 2019-06-01 11:14:21 +02:00
Benno Schulenberg 2003413989 tweaks: move a function to the file where it is used 2019-06-01 10:52:38 +02:00
Benno Schulenberg 9369af77ce tweaks: elide a function that is used just once 2019-06-01 10:43:50 +02:00
Benno Schulenberg 35d2bc6b38 build: fix compilation on another system
The <signal.h> header file is needed to define 'sig_atomic_t'.
(Don't know why on my main system it compiled fine without it.)
2019-05-31 20:53:00 +02:00
Benno Schulenberg b52d166afa tweaks: rename a type, to make more sense
The sphere, the holder, is everything *around* the partition;
it was confusing to call this holder type 'partition'.

Also correct and improve some comments.
2019-05-31 19:44:47 +02:00
Benno Schulenberg 3952dcb629 tweaks: rename a variable, reduce its scope, and use it consistently 2019-05-31 19:25:50 +02:00
Benno Schulenberg 7e9dd385f5 tweaks: elide a parameter and a return value
As 'filepart' is a global variable, there is no need to pass it around.
Just use it directly.
2019-05-31 19:00:20 +02:00
Benno Schulenberg 2e81023553 tweaks: rename two variables, and reshuffle their declarations 2019-05-31 17:45:51 +02:00
Benno Schulenberg b9f994b2c0 tweaks: elide a variable, drop a comment, and remove unneeded braces
There is no need to save, clear, and restore the mark when counting
words, lines and characters, because partitioning and unpartitioning
the buffer does not use the mark nor affect it.
2019-05-31 17:43:40 +02:00
Benno Schulenberg e98847200e tweaks: reshuffle some lines, to reduce duplication 2019-05-31 17:42:42 +02:00
Benno Schulenberg a77b21388a build: remove two #includes that don't seem to be needed 2019-05-31 17:16:07 +02:00
Benno Schulenberg 58ca5fb0f3 build: move an #include to where it is needed 2019-05-31 17:14:28 +02:00
Benno Schulenberg 844214b4a0 tweaks: rename two variables, to not be abbreviations
Also reshuffle two declarations.
2019-05-31 12:54:20 +02:00