Commit Graph

8327 Commits (38743b0016dcb0a155f0eddefe1f8c23ed4b494e)

Author SHA1 Message Date
Benno Schulenberg e0c5c589ad tweaks: remove a superfluous condition, in three places
When 'last_action' has a specific value, then necessarily there must
exist a corresponding current undo item.

(The condition is already absent in do_deletion(), for the BACK and DEL
undo items, and it works fine there.)
2019-05-03 12:18:04 +02:00
Benno Schulenberg dfe87540c6 syntax: po: colorize also escaped hex and octal codes 2019-05-03 12:12:44 +02:00
Benno Schulenberg 6c4f228f6f tweaks: invert two conditions, in order to elide an extra variable 2019-05-02 14:34:05 +02:00
Benno Schulenberg fe06ae5f48 tweaks: normalize the indentation after the previous two changes 2019-05-02 14:27:35 +02:00
Benno Schulenberg 07289f437f tweaks: invert a condition, in order to return earlier 2019-05-02 14:12:23 +02:00
Benno Schulenberg 99d155d80f tweaks: reshuffle an assignment, to be able to return earlier 2019-05-02 14:10:23 +02:00
Benno Schulenberg 3346c5395e tweaks: place a function better, and reduce some comments to a single one 2019-05-02 10:17:10 +02:00
Benno Schulenberg 083218aca5 tweaks: rename two parameters, to differentiate them from function names 2019-05-02 10:17:04 +02:00
Benno Schulenberg fd3b3bc1d6 cutting: clear the cutbuffer when the previous operation was copying
The cut and copy operations (^K and M-6) are different operations and
one should not add to the cutbuffer created by the other.

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

Bug existed since version 3.0, commit 71f85937.
2019-05-02 09:27:37 +02:00
Benno Schulenberg 9bc6bc83c0 tweaks: rename two variables, for more contrast 2019-05-01 19:14:06 +02:00
Benno Schulenberg d4468b2def tweaks: condense a comment and reshuffle a couple of lines 2019-05-01 19:10:56 +02:00
Benno Schulenberg 404a6862cd tweaks: really don't bother renumbering the lines in the cutbuffer
The lines from the cutbuffer will be renumbered when it matters: when
they get pasted.

The only place that used the numbering of (a copy of) the cutbuffer
(the updating of an undo item) already iterates through its lines.
Just add a counter there instead of making use of the line numbers.
2019-05-01 13:09:22 +02:00
Benno Schulenberg 85fc41470b tweaks: stop passing 'cutbuffer' and 'cutbottom' back and forth
All extractions are done into the cutbuffer, so it is pointless to pass
'cutbuffer' and 'cutbottom' in and back out as parameters all the time.
Just use those global variables directly.

Also, rename the function as there is no longer a buffer among its
parameters.
2019-05-01 11:33:37 +02:00
Benno Schulenberg 2b9dd6c574 tweaks: don't bother saving and restoring 'cutbottom' all the time
The 'cutbottom' variable is only ever used when cutting or copying
consecutive lines: for appending the current line to the already
existing lines in the cutbuffer.  As soon as some other operation
is performed, 'cutbottom' becomes irrelevant, it could be set to
anything, it doesn't matter: the pasting of the cutbuffer does not
use the value of 'cutbottom', nor does any other operation.
2019-05-01 11:19:14 +02:00
Benno Schulenberg 9e44a53be7 copying: scroll just one line when M-6 is pressed on the bottom row
This fixes https://savannah.gnu.org/bugs/?56249.

Bug existed since version 2.6.0, commit 318ed6b1.
2019-04-30 19:31:44 +02:00
Benno Schulenberg 0c561f0325 copying: make M-6 do nothing when at end of buffer 2019-04-30 19:03:18 +02:00
Benno Schulenberg e5831f81bb tweaks: rename two variables, to be less cryptic 2019-04-30 18:41:05 +02:00
Benno Schulenberg fa21986ecf oops: apparently the line numbers in the cutbuffer do matter
The line numbers don't matter for the cutbuffer itself, but they matter
for the copy of the cutbuffer that is stored in an undo item.

This reverts commit 14140d52 from two hours ago.

This fixes https://savannah.gnu.org/bugs/?56245.
2019-04-30 12:49:57 +02:00
Benno Schulenberg 772137cabe tweaks: rename a variable, to fit a bit better 2019-04-30 12:24:56 +02:00
Benno Schulenberg 4c53e2f56b tweaks: elide two unneeded variables
After extracting a line or region, the current line is always the one
where renumbering should start.  And when ingrafting a buffer, it is
always the first ingrafted line where renumbering should start.  The
'top_save' variable was indirectly getting set to those lines.

Also, renumber immediately after unpartitioning the file buffer, before
doing anything else.
2019-04-30 12:20:41 +02:00
Benno Schulenberg 14140d5249 tweaks: don't bother renumbering the lines in the cutbuffer
The numbering of the lines in the cutbuffer is irrelevant.  These lines
will be renumbered when it matters: when they get pasted.
2019-04-30 10:55:15 +02:00
Benno Schulenberg 17aa9371b5 tweaks: rename a function, to better indicate what it does 2019-04-30 10:27:10 +02:00
Benno Schulenberg 208995e4a7 tweaks: move a bit of timing code to where it will be needed 2019-04-30 10:15:46 +02:00
Benno Schulenberg b503670750 tweaks: rename a variable, to match another with the same meaning
Also, remove a redundant condition.
2019-04-30 10:15:11 +02:00
Benno Schulenberg 7c08e8ea69 cutting: ignore the mark when a word is deleted
Just like for deleting a word to the left, the mark should be ignored
also when deleting a word to the right.

This fixes https://savannah.gnu.org/bugs/?56241.
2019-04-30 09:53:10 +02:00
Benno Schulenberg 542426f1f1 tweaks: add a warning for something that shouldn't occur 2019-04-30 09:44:47 +02:00
Benno Schulenberg 6319a86178 tweaks: improve some comments, reshuffle a line, and rename a variable 2019-04-29 11:08:21 +02:00
Benno Schulenberg 9888e67b20 tweaks: rename two variables, for more contrast with the partition stuff 2019-04-29 09:45:41 +02:00
Benno Schulenberg 8fe19e344f tweaks: use a more direct call when a single linestruct is deleted 2019-04-28 17:20:08 +02:00
Benno Schulenberg 896cfcef95 tweaks: when OR'ing, put the most likely condition first
Also, slightly reword a comment, adjust some whitespace, and use
a more direct comparison for equality.
2019-04-28 15:53:33 +02:00
Benno Schulenberg d54180ad8b tweaks: reduce a bit of mark-adjusting code to its essence
It doesn't matter whether the grafted text contains a newline or not.

It only matters whether the mark was before or after the cursor.  When
it was after the cursor, the mark needs to be set to the bottom line of
the grafted text and its x coordinate needs adjustment; and when it was
before the cursor, the mark just needs to be set to the top line of the
grafted text.
2019-04-28 12:18:24 +02:00
Benno Schulenberg 065afe6e0f tweaks: reshuffle a bit of code, to be less intertwined 2019-04-28 11:54:23 +02:00
Benno Schulenberg 37eccd3117 tweaks: rename a function, to be more fitting
Also, adjust some whitespace, for esthetics.
2019-04-28 11:01:51 +02:00
Benno Schulenberg b9dd572a67 tweaks: set a boolean directly, instead of using a function call 2019-04-28 10:40:37 +02:00
Benno Schulenberg 3fe17e0355 docs: adjust the wording of the README to be factually correct
That is: don't say that nano doesn't change the file contents by default.

Also, correct the style of the preceding paragraph.
2019-04-28 10:35:27 +02:00
Benno Schulenberg 6e3a3964ce tweaks: adjust the indentation after the previous change
Also, condense a couple of comments.
2019-04-27 17:17:06 +02:00
Benno Schulenberg 18eb7e6d21 tweaks: elide an unneeded 'if' and 'break' 2019-04-27 17:10:10 +02:00
Benno Schulenberg e84a790b5d tweaks: rename a variable, to better indicate it contains two characters
Also rename a function, to differentiate it more from do_find_bracket().
2019-04-27 17:01:34 +02:00
Benno Schulenberg 20d9070aa1 tweaks: move an assignment that is useful only when searching forward 2019-04-27 16:31:57 +02:00
Benno Schulenberg 482b2814b4 tweaks: step away one character from the current bracket, not one byte 2019-04-27 14:41:53 +02:00
Benno Schulenberg e92c3110a1 po: update translations and regenerate POT file and PO files 2019-04-24 11:08:23 +02:00
Benno Schulenberg 1ca9241eaa bump version numbers and add a news item for the 4.2 release 2019-04-24 10:55:23 +02:00
Benno Schulenberg 0b6889cbd8 tweaks: rename another function, to be distinct and fitting 2019-04-24 10:52:49 +02:00
Benno Schulenberg 00410d83fc tweaks: rename a function, to be distinct and fitting
It was hard to remember that the "pt" stood for "plus tabs", and the
"len" seemed to say it was about number of bytes instead of columns.
2019-04-24 10:52:35 +02:00
Benno Schulenberg fcad442d80 tweaks: declare a function as const and let its allocated string leak
Avoiding this leak is more trouble than it's worth: invocation_error()
will be called seldomly, and when it is called, the user will probably
quickly exit from nano to fix things.

Also declare the speller functions as const again, so they don't give
the impression that their result can be freed.

Suggested-by: Brand Huntsman <alpha@qzx.com>
2019-04-23 12:07:56 +02:00
Benno Schulenberg 34d22d3f00 wrapping: improve the persistence of the prepending behavior
Now you can have a look elsewhere in the buffer (and even delete
or paste stuff there) and when you return to the original line
and continue typing, any spillover from automatic hard-wrapping
will spill over onto the same line it spilled over to before.

You can even switch to a different buffer and return and continue
typing, and stuff will still spill over to the same line.

In the bargain, this gets rid of a bit of flag-resetting code
that was run for many keystrokes, in most cases needlessly.

This addresses https://savannah.gnu.org/bugs/?56189.
2019-04-23 10:20:12 +02:00
Benno Schulenberg 1326af7eae tweaks: drop an unneeded saving and restoring of a variable
Since commit aa1ae0a1, from three years ago, do_next_word() no longer
changes 'placewewant'.
2019-04-23 10:18:46 +02:00
Benno Schulenberg 11aa191bdc tweaks: rename a variable, to distinguish it from a browser function 2019-04-22 19:58:43 +02:00
Benno Schulenberg ea844d28fe tweaks: exclude a bit more code from a single-buffer build 2019-04-22 19:38:19 +02:00
Benno Schulenberg 7668bfe6f2 tweaks: remove a redundant, enclosed #ifdef 2019-04-22 19:18:29 +02:00