Commit Graph

8811 Commits

Author SHA1 Message Date
Benno Schulenberg
e86180119e tweaks: implement the anchor routines in a different way 2020-04-13 11:35:40 +02:00
Benno Schulenberg
40053593a8 general: rename "bookmark" to "anchor", to sound less permanent 2020-04-13 11:25:29 +02:00
Benno Schulenberg
732cf88786 text: retain a bookmark when two lines are joined or something is cut
Also, do not copy the bookmark into the cutbuffer, so it will not get
pasted elsewhere.
2020-04-13 11:10:23 +02:00
Marco Diego Aurélio Mesquita
9fb0beca1d bindings: hard-bind the bookmark functions to M-Ins and M-PgUp/M-PgDn
Bind the toggling of a bookmark to <Alt+Insert>, and the jumping to the
previous and next bookmark to <Alt+PageUp> and <Alt+PageDown>, so that
these functions are available by default.

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
2020-04-13 10:51:40 +02:00
Marco Diego Aurélio Mesquita
f091c34bac new feature: bindable functions for toggling and jumping to "bookmarks"
With the 'bookmark' function, the user can place a bookmark on any
line in the buffer.  Multiple lines can be bookmarked in this way.
With 'prevbookmark' and 'nextbookmark', the user can then easily
return to the bookmarked lines.  The search for a bookmark wraps
around, as if start and end of buffer are connected.

[However, in this implementation, when a bookmarked line is deleted,
the bookmark is deleted too.  This is undesirable.  Also, when such
a deleted line is pasted elsewhere, the bookmark reappears with it,
and when pasted multiple times, the bookmark will be there as many
times.  This is thoroughly undesirable.  These behaviors will be
changed in a later commit.]

A bookmark is not yet visible in any way.

This fulfills https://savannah.gnu.org/bugs/?57577.
Requested-by: Ken Tyler <kent@werple.net.au>

Signed-off-by: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2020-04-13 10:51:40 +02:00
Benno Schulenberg
fd9f6e4619 syntax: mgp: drop the almost-empty MagicPoint file and syntax
It colored any word after a % sign.  But a good syntax would color
only the valid commands, and also the ones after a comma.
2020-04-12 10:40:29 +02:00
Benno Schulenberg
4f9bebddec syntax: email: rename file and syntax, away from the mistaken 'mutt'
Also, colorize lines that are multiply quoted, and email addresses,
and URLs.
2020-04-10 13:01:57 +02:00
Benno Schulenberg
edf2d8d68f docs: mention that the dedicated cursor-moving keys are not rebindable 2020-04-10 12:25:02 +02:00
Benno Schulenberg
654d694e39 tweaks: simplify the counting of characters in a section
The line after the given section is always NULL (or when it is not,
it is intended to be NULL), so always subtract 1 at the end.
2020-04-09 12:58:41 +02:00
Benno Schulenberg
19a6120dc8 tweaks: rename a function, to be more general and clearer 2020-04-09 12:27:07 +02:00
Benno Schulenberg
f4a33b868a tweaks: delete the now-unused partitioning and unpartitioning routines 2020-04-09 12:12:04 +02:00
Benno Schulenberg
cd3db5fcc4 cutting: change the implementation of cutting to not use partitioning
This has the pleasing effect of not changing the linestruct of the
succeeding line when a line is cut.

This addresses https://savannah.gnu.org/bugs/?56226.
2020-04-09 11:45:10 +02:00
Benno Schulenberg
ae5a4ecee2 cutting: overhaul the pasting routine, to not make use of partitioning
This has the pleasing effect of not changing the linestructs of the
current line nor of the line after it (if any).
2020-04-09 11:29:44 +02:00
Benno Schulenberg
fd4a5fc473 files: write out a marked region without partitioning the buffer
Use the same mechanism as when copying a marked region: temporarily
clipping the buffer.
2020-04-09 11:07:05 +02:00
Benno Schulenberg
66e64dd2d2 docs: in the sample nanorc file, refer instead of duplicating
Instead of duplicating information, just refer to 'man nanorc'.

Also reshuffle a paragraph, and add a suggestion to just select
the syntax files that will actually get used.
2020-04-09 10:27:39 +02:00
Benno Schulenberg
a0119b83ca tweaks: add two comments, and improve another 2020-04-08 11:25:02 +02:00
Benno Schulenberg
dba7a8a70a copying: do not forget to update the screen when M-6 is pressed
This fixes https://savannah.gnu.org/bugs/?58140.

Bug existed since commit f52b6cf1 from one week ago.
2020-04-08 11:04:35 +02:00
Benno Schulenberg
5c3a22dbd6 tweaks: rename a function, to be more precise, and reshuffle some things 2020-04-07 19:19:26 +02:00
Benno Schulenberg
b70510f4be docs: copy the 4.9.2 news item from the release branch 2020-04-07 14:35:42 +02:00
Benno Schulenberg
2d4bacf61d docs: stop mentioning that --wordchars overrides --wordbounds
Since the previous commit, it no longer does.  Instead, the two
interfere, and the user probably wants to use just one of them.
2020-04-06 19:07:02 +02:00
Benno Schulenberg
547de4a7bb counting: count words correctly also when --wordchars is used
It should give the same result as 'wc -w' as long as the content
of 'wordchars' does not affect the counting.

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

Bug existed since version 2.6.2, since the --wordchars option was
introduced in commit 6f12992c.
2020-04-06 11:17:43 +02:00
Benno Schulenberg
845a5973c9 counting: count words and characters without partitioning the file 2020-04-05 17:29:54 +02:00
Benno Schulenberg
6e5195f650 tweaks: invert a condition, to have two clauses in a more logical order
First the clause for the intro text and the normal lines, and then the
clause for the continuation lines (that are narrower and indented).

Also, avoid blanking the status bar when initializing the subwindows
anyway, and avoid an unneeded resfreshing call -- the bottombars()
function will take care of that.
2020-04-03 17:19:15 +02:00
Benno Schulenberg
f3624b1b87 build: fix compilation when configured with --enable-tiny 2020-04-03 17:12:28 +02:00
Benno Schulenberg
1a2c9044d7 display: blank the status bar for a copy operation, like for cut & paste
This way an earlier "Copied nothing" or other message cannot confuse
the user.
2020-04-03 16:34:27 +02:00
Benno Schulenberg
9a67d7958f undo: choose the proper x positions to place the cursor and rejoin lines
Normally, when undoing an <Enter> that created automatic indentation,
the created whitespace should be skipped when rejoining the two lines.
In other words: take the data starting from tail_x in the second line.
But when the <Enter> occurred at the end of leading whitespace, then
that whitespace has disappeared from the original line and it should
be copied back in from the second line.  That is: from x is zero.

This fixes https://savannah.gnu.org/bugs/?58108.
Reported-by: Liu Hao <lh_mouse@126.com>

Bug existed since version 4.9, commit 1961c052.
2020-04-03 11:21:24 +02:00
Benno Schulenberg
23f73cb8b3 tweaks: exit from the writing loop as soon as the last line is reached
Avoid having to decrement the count in order to offset the increment
at the end of the loop.

Also, declare a variable on a separate line, and rename it.
2020-04-01 16:05:45 +02:00
Benno Schulenberg
9f6962f3f1 tweaks: condense a comment, and express a condition in a different way 2020-04-01 15:54:08 +02:00
Benno Schulenberg
958e3ec201 feedback: show a message also when trying to copy an empty region 2020-03-31 19:44:32 +02:00
Benno Schulenberg
ce9cfdaa45 tweaks: normalize the indentation after the previous change
Also improve a comment.
2020-03-31 19:44:32 +02:00
Benno Schulenberg
56a111afa3 tweaks: fold two blocks into each other, to elide three overlapping cases 2020-03-31 19:42:22 +02:00
Benno Schulenberg
38bbdf8fc3 tweaks: change a helping variable, to make two blocks still more similar 2020-03-31 19:27:07 +02:00
Benno Schulenberg
a0e523cd4b tweaks: add a helping variable, to slightly condense the code
And to prepare for folding two blocks together.
2020-03-31 19:21:38 +02:00
Benno Schulenberg
7660849b8f tweaks: invert a condition, to see the similarity between the two modes
The two modes being: the normal full-line cutting, and --cutfromcursor.
2020-03-31 19:17:17 +02:00
Benno Schulenberg
4b814698bd copying: with --nonewlines, don't add a final newline to the cutbuffer
This fixes https://savannah.gnu.org/bugs/?58086.

Bug existed since commit f52b6cf1 from yesterday.
2020-03-31 19:12:46 +02:00
Benno Schulenberg
96046f1e82 copying: when using M-6, copy the final line in the buffer just once
When using --nonewlines and the cursor has arrived at the end of the
final line, each press of M-6 would add another copy of that line to
the cutbuffer.  That is clearly not the right behavior.

Also, give feedback when a press of M-6 does not actually copy anything.

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

The bug was old -- it existed since before version 2.2.0.
2020-03-31 17:59:21 +02:00
Benno Schulenberg
387be713c8 docs: copy the 4.9.1 news item from the release branch 2020-03-31 14:09:08 +02:00
Benno Schulenberg
d9943120ed tweaks: move two functions, to have them in a more logical order
The logical order being: cut, copy, paste.
2020-03-30 19:20:18 +02:00
Benno Schulenberg
a1907d77f8 tweaks: add a helping variable, in order to unwrap three lines
Also, move an administrative thing to after the actual operations.
2020-03-30 19:13:50 +02:00
Benno Schulenberg
f25a3f8a36 tweaks: elide three functions that are called just once
The function that they were called from has shrunk a lot,
so there is now room to write their content out in full.
2020-03-30 19:05:57 +02:00
Benno Schulenberg
9f1c3c8513 memory: plug a leak, by freeing the cutbuffer after a bracketed paste
Also, remove an unneeded assignment -- the 'cutbottom' variable is
needed only when consecutives cuts (^K) or copies (M-6) are made.
2020-03-30 16:55:38 +02:00
Benno Schulenberg
d1521c584d tweaks: elide a now-unused parameter -- it is always FALSE 2020-03-30 16:55:30 +02:00
Benno Schulenberg
f52b6cf19f copying: change the implementation, away from cutting plus copying back
First cutting the text to be copied (before copying it back into the
buffer) had unwanted side effects: it moved the cursor, and changed
the linestructs of the current line and the line where the mark was.

[This takes thirty more lines, but the idea is to later get rid of
the partitioning routines entirely.]
2020-03-30 16:55:17 +02:00
Benno Schulenberg
59040169ed tweaks: get rid of a bunch of annoying casts, and thus condense the code 2020-03-29 20:17:32 +02:00
Benno Schulenberg
8f6559828d files: make filtering of the entire buffer into a new buffer work again
This fixes https://savannah.gnu.org/bugs/?58076.

Bug existed since version 4.9, commit 477a9b33.
2020-03-29 18:04:36 +02:00
Benno Schulenberg
619962ee18 undo: when undoing a line cut, place the cursor back where it was
This fixes https://savannah.gnu.org/bugs/?58074.

Bug existed since version 4.9, commit ac612545.
2020-03-29 14:25:15 +02:00
Benno Schulenberg
7ebe44ac25 tweaks: rename a symbol, to be more accurate, and reshuffle two lines 2020-03-29 14:24:16 +02:00
Benno Schulenberg
0cc2104257 tweaks: elide a parameter, by calling the relevant function beforehand
This means that in most cases mark_is_before_cursor() is called twice:
once before get_region() is called, and once by get_region() itself.
This small duplication of effort is acceptable: the affected functions
are not time critical, and it makes the code shorter.
2020-03-29 13:22:17 +02:00
Benno Schulenberg
9a6158cd94 input: stop recognizing the raw escape sequences for F13 to F16
It is very unlikely that anyone uses those keystrokes: 1) no keyboard
has such keys; 2) the default bindings for these keys were removed a
year and a half ago, and no one complained; 3) for several years nano
did not recognize the modern xterm escape sequences for F13 to F16,
and no one ssh'ing from a new machine to an old machine complained.

The only people who might be affected by this removal are Konsole users:
a Konsole claims to be an xterm, but sends its own peculiar "Esc O 2 X"
sequences for F13 to F16.  Using the data from terminfo, ncurses will
not recognize those sequences, and will pass them untranslated to nano.
When nano now stops recognizing them too...  Well, let's see if there
are any Konsole users that use F13 to F16.
2020-03-29 12:04:37 +02:00
Benno Schulenberg
7d3aad403d options: make -S the short synonym of --softwrap
The form -$ is still accepted, but is deprecated.
2020-03-27 17:02:55 +01:00