Commit Graph

707 Commits (20971e8392b3d2c8597df757d2b3fb6ac015c113)

Author SHA1 Message Date
David Lawrence Ramsey 20971e8392 undo: position the cursor properly when undoing/redoing magicline cuts
Take our cue from undoing/redoing line joins: when they take place on
the magicline without --nonewlines, they produce undo/redo items that
don't do anything to the text, but still position the cursor properly.
Reshuffle a bit of code so that we can do the same for magicline cuts.

This fixes https://savannah.gnu.org/bugs/?54032.
2018-07-08 17:29:28 +02:00
Benno Schulenberg fb372ed0a8 tweaks: remove two superfluous assignments
The variable 'last_action' is set at the end of these functions,
serving to prevent a fresh action from being merged with an older
action further down on the stack.  Setting 'last_action' before
exiting from undo()/redo() makes no sense.

Also adjust a sideways related old Changelog item.
2018-06-02 19:32:54 +02:00
Benno Schulenberg ed433f6af0 tweaks: drop a condition that has been made redundant two commits ago 2018-06-02 18:17:31 +02:00
Benno Schulenberg 44814055b5 tweaks: correct a comment, rewrap a line, and drop some debugging stuff
An add can be contiguous even when the cursor has moved around in the
meantime but has returned to the same spot before more characters are
typed.
2018-06-02 18:04:36 +02:00
Benno Schulenberg 71f859377d cut: concentrate the logic for clearing the cutbuffer mostly in one place
It should not be the task of the undo code to take care that the
cutbuffer will be cleared at the right moments.
2018-06-02 17:57:19 +02:00
Benno Schulenberg 5550d15418 tweaks: improve a couple of comments, and reshuffle a group of lines 2018-06-01 16:56:56 +02:00
Benno Schulenberg 6df30a634e docs: register Marco as the author of the filtering feature
The macro stuff, however, is basically my code: I told him exactly
how to do it, and I changed most of the patch before applying it.

Also, put myself in second place, as I've just about overtaken David
in the duration of maintainership.
2018-06-01 10:00:08 +02:00
Benno Schulenberg ad5d0f7530 wrapping: use "smart" autoindenting only when hard-wrapping is enabled
The paragraph-aware indenting is needed only when automatic long-line
wrapping is on (that is, when not using 'nowrap': when writing prose).
When writing code, the user most likely uses --nowrap, which will make
nano indent a new line always to the same amount as the preceding line
-- when --autoindent is in effect, of course.
2018-06-01 08:45:25 +02:00
David Lawrence Ramsey dc4146f077 tweaks: avoid an unused variable warning with --enable-tiny
This fixes https://savannah.gnu.org/bugs/?53998.
2018-05-29 09:00:08 +02:00
Benno Schulenberg 738487f13d tweaks: make better use of an existing variable 2018-05-28 10:39:47 +02:00
Benno Schulenberg c8a9a96578 build: fix compilation when configured with --disable-justify 2018-05-28 09:57:24 +02:00
David Lawrence Ramsey fce54a724d tweaks: fix some grammar plus a typo in the comments 2018-05-27 20:19:46 +02:00
Benno Schulenberg ebdb647450 tweaks: adjust a translator hint 2018-05-27 17:53:36 +02:00
Benno Schulenberg 0c2aac5ff8 tweaks: reshuffle a couple of assignments 2018-05-27 17:45:51 +02:00
Benno Schulenberg 7952d68830 tweaks: frob a couple of comments 2018-05-27 17:27:07 +02:00
Benno Schulenberg 5cb4485fa5 tweaks: remove a superfluous assignment -- the lead length never changes 2018-05-27 17:16:04 +02:00
Benno Schulenberg d7c1ab8e80 tweaks: rename two variables, to better fit their tasks 2018-05-27 17:11:18 +02:00
Benno Schulenberg 1881db099d tweaks: make better use of an intermediate variable 2018-05-27 16:41:55 +02:00
Benno Schulenberg 36c83d92dd tweaks: stop decreasing both the iterator and the limit of a loop 2018-05-27 16:34:20 +02:00
Benno Schulenberg 9021725d53 justification: limit the amount of recursion to prevent a stack overflow 2018-05-27 16:09:53 +02:00
Benno Schulenberg d00ab406bc wrapping: when autoindenting, use indentation of next line as example
When doing autoindentation, and the next line is not the start of
a new paragraph, then use the indentation of that line for the new
line, as it is more likely to have the desired indentation -- the
current line might be the start of the paragraph and thus could
have a deviant indentation.
2018-05-27 16:09:53 +02:00
Benno Schulenberg d63d79b067 tweaks: elide another function that is called just once 2018-05-27 16:09:53 +02:00
Benno Schulenberg 446c7d5fff tweaks: elide a function that is called just once 2018-05-27 16:09:53 +02:00
Benno Schulenberg 52efac535b tweaks: rename a variable, to give it some meaning 2018-05-27 16:09:53 +02:00
Benno Schulenberg 45c36f93e5 tweaks: simplify the determining of the prefix for justified lines 2018-05-27 16:09:53 +02:00
Benno Schulenberg 432a7d7729 justification: find the beginning of a paragraph in a better way
Any line whose indentation differs from that of a pair of adjacent lines
is the beginning of a paragraph, also when its indentation is smaller.

This fulfills https://savannah.gnu.org/bugs/?53932,
and fixes point 2) of https://savannah.gnu.org/bugs/?53933.
2018-05-27 16:09:53 +02:00
Benno Schulenberg d7fe5a7db3 justification: recognize indented paragraphs also without --autoindent
Pico does not require any option to do this, so nano should neither.

This fixes point 1) of https://savannah.gnu.org/bugs/?53933.
2018-05-27 16:09:53 +02:00
Benno Schulenberg a832f33291 justification: when leading whitespace exceeds fill width, wrap anyway
Pico wraps at the last blank character before or on the target column;
if there is no such blank, then it will wrap at the first blank *after*
the target column -- when it can wrap, it will wrap.  Nano should do
the same (and judging from the comments, it intended to do the same),
instead of turning the paragraph into a single unwrapped line.

This fixes https://savannah.gnu.org/bugs/?53986.
2018-05-27 10:24:02 +02:00
Benno Schulenberg b9f533a69e tweaks: rename a function, for more aptness and extra contrast 2018-05-25 20:09:24 +02:00
Benno Schulenberg ac31669ec3 linter: don't try to access absent stat info, as that gives a crash
This fixes https://savannah.gnu.org/bugs/?53981.
2018-05-25 19:25:11 +02:00
Benno Schulenberg 86c08560ad linter: make sure that the margin is updated before displaying a buffer
This fixes https://savannah.gnu.org/bugs/?53977.
Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2018-05-25 17:58:25 +02:00
Benno Schulenberg 3757683e3f build: fix compilation when configured with --disable-multibuffer 2018-05-24 21:09:14 +02:00
Benno Schulenberg 3e9ef3032f tweaks: use a more meaningful variable name, and avoid a distant 'else'
Also, indent a continuation line better.
2018-05-24 19:40:52 +02:00
Benno Schulenberg 6fb1509817 tweaks: condense two statements into one, and elide a 'break' 2018-05-24 18:17:58 +02:00
Benno Schulenberg 07ddf25cc0 tweaks: exclude an unneeded 'if' from the single-buffer version 2018-05-24 18:14:35 +02:00
Marco Diego Aurélio Mesquita 73d397c64b linter: check all open buffers, instead of just the next one
First step to the next buffer, and then iterate until we either
find a match or are back at the buffer where we started.

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

Signed-off-by: Marco Diego Aurélio Mesquita <address@hidden>
2018-05-24 18:10:52 +02:00
Benno Schulenberg e0c7ff2a7e linter: make sure the shortcuts bar will redrawn when exiting early
The two help lines will be redrawn in main() only when the current
menu is not MMAIN.  So, set it to MLINTER as soon as the help lines
are cleared, just before preparing to invoke the linter.

This fixes https://savannah.gnu.org/bugs/?53967.
Reported-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2018-05-24 11:37:14 +02:00
Benno Schulenberg 5d02ee64b6 filtering: pair the cut and the insert, so they can be undone together
When executing a command in the current buffer and piping this buffer
(or marked region) to that command, then the cutting of the existing
text and the insertion of the new text should be undone and redone
together, as to the user they appear as a single operation.

With-help-from: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2018-05-22 19:36:21 +02:00
Benno Schulenberg 5ffd8d96ae tweaks: rename a variable, for contrast, and improve two comments 2018-05-22 19:36:21 +02:00
Marco Diego Aurélio Mesquita f304b9aee1 new feature: allow piping (selected) text to an external command
When executing a command, it is now possible to pipe the entire buffer
(or the marked region, if anything is marked) to the external command.
The output from the command replaces the buffer (or the marked region),
or goes to a new buffer.

This fulfills https://savannah.gnu.org/bugs/?28993,
and fulfills https://savannah.gnu.org/bugs/?53041.

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-05-22 19:36:21 +02:00
Benno Schulenberg 9d6621afd0 tweaks: remove two superfluous checks, after making one of them so 2018-05-21 09:44:06 +02:00
Benno Schulenberg 4d232a4aef tweaks: frob some comments, and rename two parameters to make sense 2018-05-18 13:24:07 +02:00
Mark-Weston 858663444e new feature: an option to make the 'nextword' function stop at word ends
When 'afterends' is set and Ctrl+Right or Shift+Ctrl+Right is pressed,
nano will stop at the ends of words instead of their beginnings.

Signed-off-by: Mark-Weston <markweston@cock.li>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2018-05-10 11:32:01 +02:00
Benno Schulenberg 553940760e tweaks: set the correct flags just once for each spell-fixing session 2018-04-25 17:27:15 +02:00
Benno Schulenberg faa0eb991e speller: don't add an extra newline when saving the text to a tempfile
Set the NO_NEWLINES flag to achieve this.  And move the saving and
restoring of the global flags to the main speller routine, so the
flags aren't saved and restored for each internal spell fix.

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

Acked-by: David Lawrence Ramsey <pooka109@gmail.com>
2018-04-25 17:26:14 +02:00
Benno Schulenberg 4872f42cd2 tweaks: rename a function, to be more distinct from its caller 2018-04-25 12:21:40 +02:00
Benno Schulenberg 1ae90e205a command-execution: do not crash when opening the pipe would fail
This fixes https://savannah.gnu.org/bugs/?53723.
2018-04-23 18:04:25 +02:00
Benno Schulenberg d53086d38d completion: correctly do a signed comparison, to avoid a segfault
Bug existed since commit 30fc197b (a month ago) which changed the
type of 'i' from int to size_t, causing the comparison to do the
wrong thing when 'threshold' is negative.

This fixes https://savannah.gnu.org/bugs/?53722.
Reported-by: Devin Hussey <husseydevin@gmail.com>
2018-04-23 17:09:54 +02:00
Benno Schulenberg 0b6bb37c56 tweaks: improve some comments, and exit with nonzero status upon error 2018-04-23 14:04:08 +02:00
Benno Schulenberg c43a6fdcc1 tweaks: rename a variable, to match another and to be more visible 2018-04-23 13:04:31 +02:00