Commit Graph

9170 Commits

Author SHA1 Message Date
Benno Schulenberg
40a0463250 tweaks: reshuffle an assignment, for conciseness, and rename a variable 2020-05-17 11:34:22 +02:00
Benno Schulenberg
187843d2da tweaks: exclude a bit of bracketed-paste code from the tiny version
The tiny version does not support bracketed pastes.
2020-05-14 18:47:50 +02:00
Benno Schulenberg
0f2dd8456f usage: unabbreviate option arguments where possible
And make it clearer what kind of argument is expected:
digits, characters, or a program name.
2020-05-14 17:27:15 +02:00
Benno Schulenberg
821fbf713d tweaks: reshuffle a bit of code, to elide an #ifndef 2020-05-14 11:44:21 +02:00
Benno Schulenberg
ebc2364742 tweaks: move a fragment of code to the one branch that needs it
When two lines are joined, 'refresh_needed' is already set to TRUE,
so only when a midline character is deleted the check for a changed
number of chunks is needed.
2020-05-14 11:43:30 +02:00
Benno Schulenberg
15fadd700a tweaks: rename a function, to be more precise, and reshuffle it 2020-05-13 12:43:22 +02:00
Benno Schulenberg
78bfc9223a tweaks: add a condition, so that two ifs can be elided
Now all functions that are relevant only to softwrapping
get called only when softwrapping is on.

This also allows to elide an intermediate function call.
2020-05-13 12:32:57 +02:00
Benno Schulenberg
e8e9b8ad82 tweaks: move an 'if', to not call leftedge_for() when not softwrapping 2020-05-13 12:01:55 +02:00
Benno Schulenberg
964771afc3 tweaks: reshuffle a condition, for symmetry 2020-05-13 11:11:24 +02:00
Benno Schulenberg
fe94999c1c tweaks: don't bother overwriting a CR -- decreasing the length is enough
The string of bytes get properly terminated by encode_data(); there is
no need to do that earlier.
2020-05-13 10:31:39 +02:00
Benno Schulenberg
56bf29409b tweaks: correct a comment, and avoid third repetition of some conditions 2020-05-12 20:53:08 +02:00
Benno Schulenberg
fcbf85887b files: never report a file as being of mixed format
A file is always in either Unix or DOS or Mac format, and should
by default be saved again in that same format.

Any lone CRs or LFs after the first line should not change the
format that was deduced from that very first line.
2020-05-12 18:55:31 +02:00
Benno Schulenberg
ac0f2c9485 files: do not let a stray CR in a DOS file trigger Mac format
Only when a CR is seen before any LF, and the CR is not followed
by a LF, should this CR be interpreted as a line separator.  And
only then the file should be reported as being in Mac format --
as long as --noconvert is not used.

This fixes https://savannah.gnu.org/bugs/?58357.

Bug existed since at least version 2.0.6.
2020-05-12 17:25:04 +02:00
Benno Schulenberg
0a1817e893 tweaks: exclude an unneeded fragment of code from the tiny version 2020-05-12 11:09:23 +02:00
Benno Schulenberg
b18f1265ff tweaks: reshuffle a condition, to make a little more sense 2020-05-11 19:40:17 +02:00
Benno Schulenberg
2dd97a0352 tweaks: rename two variables, and reduce the scope of a third 2020-05-11 16:59:39 +02:00
Benno Schulenberg
ef4b0edd4e tweaks: rename a symbol, to better suit its purpose, and reduce its scope 2020-05-11 16:44:16 +02:00
Benno Schulenberg
b47d111a3d tweaks: don't use a symbol for other purposes 2020-05-11 16:18:03 +02:00
Benno Schulenberg
d80ecf0209 tweaks: trim some oververbose comments -- they overshadow the code
The text was harder to understand than the code itself.
2020-05-11 15:58:08 +02:00
Benno Schulenberg
ff4973458c tweaks: adjust the file format indicator in a quicker way 2020-05-11 15:32:41 +02:00
Benno Schulenberg
f9ff902bbc tweaks: drop two redundant conditions, and improve three comments 2020-05-08 11:06:43 +02:00
Benno Schulenberg
95c966c3fc tweaks: do the saving of histories in a single place
Also, when finish() is called when the user presses Cancel upon
encountering a lock file, there is no need to save any history
files because nothing has changed.
2020-05-08 11:01:37 +02:00
Benno Schulenberg
982e226c3f tweaks: elide three parameters, as they are the same for both calls 2020-05-08 10:40:03 +02:00
Benno Schulenberg
42ca89039a tweaks: improve three comments, drop one, and unwrap a line 2020-05-08 10:21:02 +02:00
Benno Schulenberg
07b48024d1 tweaks: condense a comment, and reshuffle some conditions 2020-05-07 13:34:07 +02:00
Benno Schulenberg
1c4dd79b9b files: trigger the Easter egg only when "zzy" is typed at the prompt
When the user mentions the file "zzy" on the command line,
the magic spell "Xyzzy" does not actually get typed, so the
Easter egg should then not be triggered.
2020-05-07 13:28:41 +02:00
Benno Schulenberg
56fc8f6d30 tweaks: improve a comment, reshuffle a scroll command, elide a variable
Also, drop an unneeded keyboard check: the next check is just a few
microseconds away.
2020-05-06 17:29:20 +02:00
Benno Schulenberg
ad1331527e color: when syntax coloring is toggled back on, calculate multiline data
This will not catch all cases, but at least it will precalculate the
data when syntax coloring was toggled off (M-Y) while in one buffer
and then toggled back on after having switched to a new buffer.
2020-05-01 14:08:55 +02:00
Benno Schulenberg
1bbf07b27e color: avoid allocating emptiness when there are no multiline regexes
When a file is saved under a different name, and as a result the
applicable syntax changes, and the old syntax had multiline regexes
and the new syntax doesn't, then the call of precalc_multicolorinfo()
in write_file() should not result in nano setting up a multicache of
zero bytes for each line in the buffer.

(Problem was found by locally letting nano crash when zero bytes are
allocated, and then happening to rename a file.py to a file.sh.)
2020-05-01 13:59:56 +02:00
Benno Schulenberg
b9deb883fa tweaks: shorten the name of a symbol, to match its bindable function 2020-05-01 13:25:15 +02:00
Benno Schulenberg
9c4ebed3ff tweaks: remove an unneeded element from the openfilestruct 2020-05-01 12:38:02 +02:00
Benno Schulenberg
e64e54d57f tweaks: condense a bit of code, by reusing an existing variable 2020-05-01 12:37:50 +02:00
Benno Schulenberg
d4ee6a2b53 options: rename --tempfile to --saveonexit, to be far clearer
A long option should describe what it does, not vaguely hint at it.

Also, in several places of nano's code we deal with actual temp files,
and then having a flag called TEMP_FILE that doesn't have anything to
do with temp files is somewhat confusing.
2020-04-30 19:12:54 +02:00
Benno Schulenberg
af062af490 docs: mention that doing a full-buffer operation wipes away all anchors 2020-04-30 18:58:17 +02:00
Benno Schulenberg
4bdd6013b0 anchor: do not let piping and spelling transfer an anchor to the top
Just let all anchors disappear when doing an external spell check or
formatting or piping the buffer through an external command, because
leaving just a single anchor on the top line is useless.

This fixes https://savannah.gnu.org/bugs/?58273.

Bug existed since commit 732cf887 from one month ago.  That code
causes an anchor to persist at the point where lines are removed.
2020-04-30 16:51:22 +02:00
Benno Schulenberg
11f099e1da anchor: during full justification preserve anchors as during single ones
When a single paragraph is justified, any anchor on any of its lines
gets moved to its first line.  Let a full justification do the same
for each of the paragraphs.

This fixes https://savannah.gnu.org/bugs/?58272 in a better way.
2020-04-30 16:07:31 +02:00
Benno Schulenberg
703cebaaac anchor: do not let a full justification transfer an anchor to the top
This fixes https://savannah.gnu.org/bugs/?58272.

Bug existed since commit 732cf887 from one month ago.  That code
causes an anchor to persist at the point where lines are removed.
2020-04-29 19:34:48 +02:00
Benno Schulenberg
4710b94cfb tweaks: move a function to before the one that calls it 2020-04-29 12:22:02 +02:00
Benno Schulenberg
5ca2fd887a startup: initialize colors only when the terminal is capable of colors
This avoids trying to show colors on a vt100, for example.
2020-04-29 12:07:31 +02:00
Benno Schulenberg
d1e1438ca0 tweaks: delete some unneeded code, and rename the function accordingly
When set_colorpairs() is called, no files have been loaded yet, so
no syntaxes will have been loaded yet either.  Thus it is pointless
to run through the list of available syntaxes.
2020-04-28 16:49:45 +02:00
Benno Schulenberg
382ec84248 tweaks: rename a function, to match with the boolean that guards it 2020-04-28 16:38:27 +02:00
Benno Schulenberg
bc4240dda5 tweaks: rename a function, to better describe what it does
Its major function is to find an applicable syntax, if there is any.
And if the syntax hasn't been used before, to prime its color pairs.

Also, reshuffle a line to be able to elide an #ifdef.
2020-04-28 16:34:45 +02:00
Benno Schulenberg
b97da1dfe4 files: reinitialize the palette only when the syntax actually changed 2020-04-28 15:30:00 +02:00
Benno Schulenberg
e62a6964f7 syntax: sql: condense some regexes, and reduce their number 2020-04-26 19:32:44 +02:00
Benno Schulenberg
fd70c25d21 menus: remove unneeded words and shortenings from key labels
In "Cut Text" and "Paste Text" the word "Text" is superfluous.  (It
could even be called slightly misleading, because by default ^K will
cut the current line, whether or not it contains text.)

The "Get Help" is of course inherited from Pico, but to me it has
always sounded a bit as if it would go search help on the internet.

Instead of "Spelling" I would have preferred "Spellcheck", but that
gets a bit too cramped on an 80-column terminal.

For ^C I've chosen "Location" because I tend to understand "Position"
as a verb, especially when seen next to "Go To Line" (even when having
two items with the same meaning next to each other doesn't make sense).

"Mark Text" has simply always been wrong.  It doesn't mark anything,
but just *sets* the mark (or unsets it, but that normally happens
automatically, no need to mention that in the label).

The "Cut Till End" and "Full Justify" get shown only on very wide
terminals, and at such widths there is enough room for each label
to write out those two labels in full.
2020-04-21 19:14:28 +02:00
Benno Schulenberg
227467adb9 syntaxes: remove some superfluous outer parentheses from regexes
Also, standardize some comments, condense a few regexes, add some
word-edge anchors, and remove some superfluous backslashes.
2020-04-21 12:49:29 +02:00
Benno Schulenberg
afce41c754 syntaxes: move the rules for Fortran and Povray files down to extra/
Fortran and POV-Ray files are not found on any regular install of a
Unixy system nor in common software packages.  People who want these
syntaxes will have to make a little effort to enable them.
2020-04-21 12:11:44 +02:00
Ryan Westlund
36e22c99a1 syntax: haskell: new file -- coloring rules for Haskell programs
Adapted from the original coloring rules by Alex Taber found at:
  https://github.com/scopatz/nanorc/blob/master/haskell.nanorc

Signed-off-by: Ryan Westlund <rlwestlund@gmail.com>
2020-04-21 11:56:24 +02:00
Benno Schulenberg
dd25d807df syntaxes: remove some stuff that has been commented out for a long time 2020-04-20 19:22:39 +02:00
Benno Schulenberg
fea5d7c612 syntaxes: uniformize the initial comment 2020-04-20 19:21:56 +02:00