Commit Graph

4870 Commits (ffa0a9ef645fda4a7b3daa8d89ebdfb5202645c8)

Author SHA1 Message Date
Benno Schulenberg ffa0a9ef64 tweaks: calculate the length of a completion word in a more direct way 2019-01-02 17:44:15 +01:00
David Lawrence Ramsey eef6b2b442 tweaks: use proper variable types in the word-completion functions
Use 'size_t' for character indexes, and 'ssize_t' for the threshold.
2019-01-01 17:48:23 +01:00
Benno Schulenberg 16c20ad873 tweaks: move the character/word-deletion functions to a better location
Having all the cutting and deleting functions together in one file
kind of makes sense.
2019-01-01 17:48:02 +01:00
Benno Schulenberg f9bb5382aa tweaks: reshuffle and frob a couple of comments, and reindent two lines 2019-01-01 17:33:10 +01:00
Benno Schulenberg 329b82d284 undo: set the correct file size for a redo of a character deletion
The reduced file size should be stored not just when joining two lines
but also when simply a character in the middle of a line is deleted.

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

Bug existed since version 2.5.0, commit 66e21416.
2019-01-01 12:35:53 +01:00
Benno Schulenberg b596639f95 options: actually rename --rebindkeypad to --rawsequences (-K) 2018-12-31 18:35:46 +01:00
David Lawrence Ramsey d0982536a7 undo: after undoing a cut, don't remove the magicline if we're on it
This fixes https://savannah.gnu.org/bugs/?55332.
2018-12-31 14:10:02 +01:00
Benno Schulenberg 798695ff1e utils: retire the fixbounds() function -- it is no longer needed
All tested systems (FreeBSD, NetBSD, OpenBSD, Alpine, and Ubuntu)
support the GNU-style word boundaries (\< and \>), either natively
or through using the regex module from gnulib.

If this change breaks regexes containing \< or \> on your system,
please report a bug: https://savannah.gnu.org/bugs/?group=nano

This addresses https://savannah.gnu.org/bugs/?55207.
2018-12-31 13:49:07 +01:00
Benno Schulenberg 15320d3b96 tweaks: word some comments more concisely 2018-12-30 21:30:26 +01:00
Benno Schulenberg 0e9fb6a0da tweaks: rename two variables, to be more descriptive 2018-12-30 20:18:29 +01:00
Benno Schulenberg 34b8d58871 rcfile: reject an attempt to bind ^[
Also, for <Esc> <Esc> [, report that it is unbindable.

This fixes https://savannah.gnu.org/bugs/?55336.
2018-12-30 19:47:43 +01:00
Benno Schulenberg fb4ce71cfc tweaks: correct a comment typo, and trim a few other comments 2018-12-30 18:00:28 +01:00
Benno Schulenberg 7a2c851dfc tweaks: reorder some ifs, to reduce the average number of comparisons 2018-12-30 17:50:10 +01:00
Benno Schulenberg 4d55748999 tweaks: reduce a bunch of repetitious comments to their essence
And in the bargain add two missing equivalences.
2018-12-30 17:31:36 +01:00
Benno Schulenberg e7198f49a4 tweaks: elide an unneeded intermediate variable 2018-12-30 16:48:48 +01:00
Benno Schulenberg 125cc0cd74 tweaks: elide a tiny function by making a variable global
And in the bargain it makes things clearer, because the name
cutbuffer_reset() is misleading.
2018-12-30 13:36:29 +01:00
Benno Schulenberg afab65e8a8 tweaks: elide a parameter that is always TRUE
The parameter was made redundant by David's overhaul of the
justification code.
2018-12-30 12:48:26 +01:00
David Lawrence Ramsey 7e152f2a48 undo: when undoing a cut, remove also the magicline if it added one
Reuse the WAS_FINAL_LINE flag to signal a cut that added a magicline,
for both a marked cut and cut-to-eof.

This fixes https://savannah.gnu.org/bugs/?55305.
2018-12-30 11:37:46 +01:00
David Lawrence Ramsey 8854ddb728 undo: set and check 'xflags' in a bitwise manner
This allows multiple flags to be set, which will be needed for the
next commit.
2018-12-30 11:36:49 +01:00
Benno Schulenberg d3c0fe3923 options: make --rawsequences disable --mouse, to prevent entering junk
When using --raw, ncurses does not catch and convert any mouse event,
and thus the coordinates of a mouse click would get inserted into the
buffer as seemingly random characters.  So, let --rawsequences override
and disable --mouse, to prevent the accidental entering of junk.

This fixes https://savannah.gnu.org/bugs/?55303.
2018-12-28 19:15:20 +01:00
Benno Schulenberg 997826d794 tweaks: rename a symbol, to match its corresponding option 2018-12-28 17:47:03 +01:00
Benno Schulenberg 72a49dbbb4 browser, help: make <Bsp> page up also when terminfo mismatches terminal 2018-12-28 17:20:24 +01:00
Benno Schulenberg 0946153b47 tweaks: hard-bind ASCII DEL in a slightly more economical way
And in the bargain get rid of a duplicate help-text entry for
either "Del" or "Bsp".
2018-12-28 17:20:18 +01:00
Benno Schulenberg 9b2c2697cb options: make -d (--rebinddelete) work without -K (--rebindkeypad)
When the terminfo selected by TERM does not match the terminal and
the <Delete> key behaves the same as <Backspace> (deleting leftward)
or the <Backspace> key behaves the same as <Delete> (deleting without
moving the cursor), then using just -d or --rebinddelete should make
the deviant key behave correctly again without affecting the other.
2018-12-28 17:19:09 +01:00
Benno Schulenberg a57c6a6763 tweaks: elide a one-line function that is used just twice 2018-12-27 21:19:47 +01:00
Benno Schulenberg 597d90207e startup: improve two error messages by mentioning the invalid operand
This addresses https://savannah.gnu.org/bugs/?55304.
2018-12-27 21:08:57 +01:00
Benno Schulenberg b1b2369541 tweaks: rewrap a line and improve a few comments 2018-12-26 15:11:20 +01:00
Benno Schulenberg 8a88cea256 tweaks: elide a variable that is a copy of another 2018-12-26 14:56:29 +01:00
Benno Schulenberg 6f23d9c18c tweaks: rename a variable, because it also serves as "last line" 2018-12-26 14:37:36 +01:00
Benno Schulenberg dfbffff4b0 tweaks: remove a superfluous incrementing and decrementing of a variable 2018-12-26 14:28:54 +01:00
Benno Schulenberg ea73d7fd70 tweaks: condense a couple of comments and rewrap a few lines 2018-12-26 14:26:54 +01:00
Benno Schulenberg 55c52c50d0 bindings: hard-bind ASCII code 0x08 (BS) to the backspace function
ASCII code BS should always do a backspace, also on systems where the
"^H" string gets redirected (for rebinding purposes) to KEY_BACKSPACE.

This fixes https://savannah.gnu.org/bugs/?55247.
Reported-by: Norton Warner <nortonwarner@gmail.com>
2018-12-23 18:45:12 +01:00
David Lawrence Ramsey 77bd8c2630 tweaks: swap the names of the variables 'wrap_at' and 'fill'
Now 'fill' contains the original specified value,
and 'wrap_at' the column that 'fill' translates to.
2018-12-18 19:50:59 +01:00
Benno Schulenberg 3121ee4b2e options: stop recognizing and mentioning --quiet and 'set quiet'
Those options have been a no-op and obsolete for over a year.

Just continue to accept and ignore -q, for some "compatibility"
with Pico.
2018-12-18 19:29:40 +01:00
Benno Schulenberg 762cee242a tweaks: reshuffle a bit of code, to have the exit point near the end 2018-12-18 19:27:17 +01:00
Benno Schulenberg 3a170d2c3e rcfile: when rebound, DO unbind a keystroke from its earlier function
When not unbinding it from its earlier function (in the same menu),
it would result in showing the keystroke twice in the help text.

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

Bug was introduced a month ago, by commit f81d174f.
2018-12-18 19:25:33 +01:00
Benno Schulenberg e8751d1d5c bindings: make the normal scrolling keystrokes work also in help viewer
There is no reason why they shouldn't work.
2018-12-17 17:05:56 +01:00
Benno Schulenberg 38ca2a41f4 tweaks: reduce the scope of two variables, and rename one of them
Also, swap the order of the 'if', and don't bother setting a freed
string pointer to NULL as it will never be used again.
2018-12-11 10:59:12 +01:00
David Lawrence Ramsey 6e3b9ac058 options: exit on a bad quoting regex, instead of crashing later
The paragraph-jumping functions used the regex unverified...

This fixes https://savannah.gnu.org/bugs/?55169.
2018-12-11 10:29:29 +01:00
Benno Schulenberg 41c561c5cf tweaks: schedule a call of edit_refresh() instead calling it directly
The direct call was a leftover of the old unjustify mechanism.

Also, move two statements to the end of the do_justify() routine,
since that is their place in comparable routines.

Suggested-by: David Lawrence Ramsey <pooka109@gmail.com>
2018-12-10 17:38:39 +01:00
Benno Schulenberg 55537dc218 display: show it in title bar when starting up in restricted mode 2018-12-03 12:33:00 +01:00
Benno Schulenberg 3a79766da6 rcfile, docs: remove deprecated forms of two options and five bindables
This addresses https://savannah.gnu.org/bugs/?53785.
2018-12-03 10:25:55 +01:00
Benno Schulenberg 0f79a42333 browser: say "Close" instead of "Exit" for the ^X shortcut
When multiple buffers are open, the edit window says "Close" for ^X
instead of "Exit" (when one buffer is open).  In the help viewer ^X
says "Close".  Apparently the idea is that ^X should say "Exit" only
when pressing ^X leads to exiting from nano.  Pressing ^X in the file
browser does not exit from nano, so make it say "Close" instead.

(The help viewer says "Close" since version 2.8.6, commit 934a2192.)
2018-12-03 10:07:42 +01:00
Benno Schulenberg 3b79c7168e help: don't advertise ^S and ^Q when --preserve is used
When using --preserve, ^S and ^Q are "eaten" by the terminal and
do not reach nano: they have no effect in nano, so the help lines
and the help texts should not mention these shortcuts.

Also, to keep the help lines in the help viewer neatly arranged,
^L is not bound there when --preserve is used.
2018-12-03 09:50:00 +01:00
Benno Schulenberg 6bead051d2 justify: move the check for a bad quoting regex to a better place
So that the cursor will not move when a justification is attempted.
2018-11-26 10:56:20 +01:00
Benno Schulenberg ac8bd2a227 tweaks: elide a parameter -- do the NULL checks in the caller
Determine more directly: the length of the last paragraph line,
and the exit condition for a full justify.
2018-11-26 10:38:04 +01:00
Benno Schulenberg 0d96df7a91 tweaks: condense and improve a couple of comments 2018-11-26 09:38:02 +01:00
Benno Schulenberg e2c61d83ef tweaks: change do_para_end() to not step beyond end of paragraph
Not stepping beyond the last line of the paragraph means that the
length of the paragraph is always the difference in line numbers
(between first and last line of the paragraph) plus one.
2018-11-26 09:16:09 +01:00
Benno Schulenberg 9a77c997e2 tweaks: remove two tag definitions that are no longer needed 2018-11-26 09:13:22 +01:00
Benno Schulenberg 2cee79fbbf tweaks: remove a variable that is no longer used
It was made superfluous by David's overhaul of the justify mechanism.
2018-11-26 09:07:22 +01:00