Commit Graph

7695 Commits (902b4674f990e2b5171f78e4e73e0c6c90fc3b6f)

Author SHA1 Message Date
Benno Schulenberg 902b4674f9 display: account for horizontal scrolling when drawing the guide stripe
That is, draw the stripe relative to the column at which the current
"chunk" starts.

This fixes https://savannah.gnu.org/bugs/?55920.
2019-03-14 17:01:48 +01:00
David Lawrence Ramsey 37be9b54ca justify: initialize a variable before making use of its value
When the mark is off, initialize not just 'bot_x' but also 'top_x'.

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

Bug existed since the justifying of a marked region was introduced,
four days ago, with commit f7f5514e.
2019-03-14 11:48:07 +01:00
Benno Schulenberg 19a833c94e startup: check again for a Linux console after reading all files
When there is a dash among the files on the command line, nano will read
data from standard input, which means that the latter is not connected to
a terminal and thus cannot be recognized as a Linux VT until nano has
finished reading the input and has reconnected the input source to the
terminal.

The first probe for a Linux VT is kept in place for now, so that nano
can stop when there are errors in an rcfile while running on a VT.
(This stopping will not work when data is read from standard input,
of course, but that is a smaller fish.)

This fixes https://savannah.gnu.org/bugs/?55912.
Reported-by: Enrico Mioso <mrkiko.rs@gmail.com>

Bug existed since the recognition of modified cursor keys on a Linux
console was introduced, in version 2.6.3, commit 290d278f.
2019-03-13 19:31:11 +01:00
Benno Schulenberg 169da8aec0 docs: mention three features in their proper place
They were introduced in version 2.5.0.
2019-03-11 11:21:57 +01:00
Benno Schulenberg 20514eca19 feedback: make two error messages better match the option
And keep them identical.
2019-03-11 09:07:08 +01:00
Benno Schulenberg f54f122637 gnulib: update to its current upstream state 2019-03-11 08:29:50 +01:00
Benno Schulenberg d5b21d7bd0 copyright: update the years for the FSF in the documentation too 2019-03-11 08:27:19 +01:00
Benno Schulenberg 4240423b9c help: in the tiny version, don't list an option that is the default
And don't recognize it either.
2019-03-10 19:19:31 +01:00
Benno Schulenberg 74752686f4 help: don't list the obsoleted -O and -S options in the --help output
And don't bother to recognize them either.
2019-03-10 19:19:17 +01:00
Benno Schulenberg 4205567bb1 tweaks: add deprecation comments to the four superseded options 2019-03-10 17:05:19 +01:00
Benno Schulenberg a20340b5a8 copyright: update the years for significantly changed files 2019-03-10 17:03:42 +01:00
David Lawrence Ramsey 932a35c072 tweaks: normalize the indentation, and remove unneeded braces 2019-03-10 09:22:02 +01:00
David Lawrence Ramsey 877a649819 justify: when justifying a marked region, strip whitespace after the lead
This matches Pico's behavior.
2019-03-10 09:22:02 +01:00
David Lawrence Ramsey 5d7b723c16 justify: put a mid-line marked region onto separate lines
This matches Pico's behavior.  However, Pico doesn't add the quoting +
indentation to the line in which the selection ends, but this is wrong,
so nano does add it.  Also, Pico doesn't account for partial quoting +
indentation at the start or end of a selection, but this is wrong, so
nano does.
2019-03-10 09:22:02 +01:00
David Lawrence Ramsey 053244db70 justify: handle the leading part when justifying a marked region
Unlike a regular paragraph, marked text may have different quotes and
more than two types of indentation.  Handle this by replacing deviant
quotes with the quote of the first line, and deviant indentation with
the indentation of the second line.
2019-03-10 09:22:02 +01:00
David Lawrence Ramsey f7f5514eef new feature: marked text gets justified into a single, new paragraph
This is modelled after Pico's behavior.  However, Pico won't do anything
if you do a full-justify while the mark is on.  But this is unnecessarily
limiting, so, when the mark is on, nano will handle a full-justify and a
plain justify the same.

This currently does not handle the lead (quoting + indentation) in
justified selections, does not put mid-line justified selections onto
separate lines, and does not strip whitespace after the lead in justified
selections, the latter two of which Pico does.  These behaviors are
forthcoming.
2019-03-10 09:22:02 +01:00
David Lawrence Ramsey afa0097ceb tweaks: rename a variable, to prepare for its new role 2019-03-10 09:22:02 +01:00
David Lawrence Ramsey 6e960012c2 tweaks: split justify_paragraph() into three separate functions
concat_paragraph() concatenates a paragraph into a single line, and
rewrap_paragraph() rewraps that line into multiple lines again.

These two will be needed when the justifying of marked text is added.
2019-03-10 09:22:02 +01:00
David Lawrence Ramsey 311a7138b2 tweaks: adapt find_paragraph()/justify_paragraph() for multiple quotes
Instead of passing 'quote_len' to these functions, calculate it directly
in them.

This will be needed when the justifying of marked text is added.  When
unmarked text is justified, it is a single paragraph and by definition
has a uniform quoting part.  But marked text may be a jumble of lines
that have different quoting parts.
2019-03-10 09:22:02 +01:00
David Lawrence Ramsey 0ac04347d5 tweaks: remove unnecessary variable initializations 2019-03-10 09:22:02 +01:00
Benno Schulenberg 610be482fa docs: suggest a setting for 'stripecolor' in the sample nanorc 2019-03-09 09:54:27 +01:00
Benno Schulenberg 9ad3a17954 syntax: nanorc: stop coloring 'unset fill ...' as if it were valid
The same for 'unset tabsize ...'.

Also, color 'set guidestripe' plus a following number as valid.
2019-03-09 09:27:08 +01:00
Benno Schulenberg 6e04d697a1 docs: describe the new options -J, --guidestripe, and 'set stripecolor' 2019-03-09 09:27:08 +01:00
Benno Schulenberg 916b4d81d0 rcfile: add 'stripecolor' for changing the color of the guiding stripe
The default is now simply reverse video, which works better than a
"loud" colored bar in an interface that for the rest is monochrome.
2019-03-09 09:27:08 +01:00
Benno Schulenberg 66c6eb5166 new feature: option --guidestripe that shows a vertical guiding bar
Option -J (--guidestripe) takes a column number as argument and then
shows a vertical, colored bar over the entire height of the buffer,
to aid the user in regulating the width of the text when the terminal
is wider than this desired width.

This fulfills https://bugs.debian.org/916392.
Requested-by: Arturo Borrero González <arturo@debian.org>
And fulfills https://savannah.gnu.org/bugs/?55315.
Requested-by: Bryan Christ <bryan.christ@gmail.com>
2019-03-09 09:27:08 +01:00
David Lawrence Ramsey 43b42246d3 display: properly handle double-width characters when spotlighting
When the right half of a two-column character gets overwritten by the
">" continuation character, then represent its left half as "[" also
when spotlighting a replacement candidate.  Achieve this by calling
display_string() in the overshooting case with 'isprompt' set to TRUE,
which also makes this function reserve space for the ">" continuation
character so spotlight() doesn't need to do this any more.

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

Improved-by: Benno Schulenberg <bensberg@telfort.nl>
2019-03-08 19:56:52 +01:00
David Lawrence Ramsey 40a74e46e6 display: correct the logic for making room for the ">" character
The change in commit edc0d628 was flawed.  The old logic covered
every case but one: having reached the end of 'buf' but 'column'
still having overshot the screen width.  Now cover this latter
case too.

This fixes https://savannah.gnu.org/bugs/?55638 properly,
allowing the next commit to fix another buglet.

Condensed-by: Benno Schulenberg <bensberg@telfort.nl>
2019-03-08 19:52:33 +01:00
Benno Schulenberg c3cd0f3411 help: reword the description of ^U to avoid the impression of "Undo"
Instead of "Uncut" use the word "Paste", which is the common name for
this function.
2019-03-07 20:36:03 +01:00
Benno Schulenberg 85e895508b display: scroll horizontally one column earlier
In this way, for single-width characters, one can see what character is
ahead of the cursor before actually moving the cursor to that position,
and, for double-width characters, the cursor never sits on a placeholder
but always shows the character that is actually there.

This addresses https://savannah.gnu.org/bugs/?55716.
2019-03-07 20:34:31 +01:00
Benno Schulenberg 37c8232f4d bindings: provide usable shortcuts for prevword/nextword in tiny version
In the tiny version the feature toggles are absent, so most of the
Meta-key combinations do nothing, and when --with-slang was used, the
<Ctrl+Left/Right> keystrokes do not work (as they produce truncated
escape sequences under Slang), and the <Ctrl+Space> and <Alt+Space>
keystrokes are awkward to type and make no sense.  So... use some
of the free Meta combinations to jump a word to the left or right,
since these functions *are* present in the tiny version.
2019-03-03 14:25:51 +01:00
David Lawrence Ramsey f13dd140eb display: correctly trim an overshooting character from a prompt answer
Tell display_string() explicitly when we're at a prompt, instead of
letting it glean this from the current menu not being MMAIN, which
fails in some circumstances.

This improves the fix for https://savannah.gnu.org/bugs/?55620,
fixes https://savannah.gnu.org/bugs/?55680 in a better way,
and fixes https://savannah.gnu.org/bugs/?55773.
2019-02-28 19:47:55 +01:00
Benno Schulenberg de47b58dc1 tweaks: move declaration of variable that does not need to be global
More importantly: searching in src/history.c will now not only find
the uses of 'position_history' but also its declaration.
2019-02-27 19:54:43 +01:00
Brand Huntsman a5ef013e82 history: use an unfreed 'position_history' to avoid a possible crash
The reload_positions_if_needed() routine can free the existing
'position_history' and allocate a new one.  Using the old one,
from before the reload, could lead to a crash.

This fixes https://savannah.gnu.org/bugs/?55792.
Reported-by: Enrico Mioso <mrkiko.rs@gmail.com>

Bug existed since the reloading of the position-history file was
introduced, a year and a half ago, in commit bfc53f30.

Signed-off-by: Brand Huntsman <alpha@qzx.com>
2019-02-27 18:03:08 +01:00
Benno Schulenberg 70da1889ee feedback: complete the removal of some superfluous words
This should have been part of commit 1053a3c4.
2019-02-25 10:04:10 +01:00
Benno Schulenberg 1eb639d55e display: show "[" for half of two-column character also when softwrapping
This should have been part of commit ad505e7f.
2019-02-24 21:45:53 +01:00
Benno Schulenberg 79ca3ceabf copyright: update the years for the FSF 2019-02-24 19:35:56 +01:00
Benno Schulenberg b5ca8a00af tweaks: rename three functions and two symbols, to match the new wording 2019-02-24 17:32:17 +01:00
Benno Schulenberg 2c7d336711 bindings: rename 'cutwordleft' to 'chopwordleft', and similar for right
These bindable functions should not connote cutting, as they don't put
anything into the cutbuffer.
2019-02-24 17:31:40 +01:00
Benno Schulenberg 15c3e924b8 help: reword the tags for deleting a word left and right
Don't use the word "Cut", as the words are discarded and
not added to the cutbuffer.
2019-02-24 16:49:44 +01:00
Benno Schulenberg 1053a3c440 feedback: remove some superfluous words from Undid/Redid messages
Also, change some words to nouns, to fit the scheme.
2019-02-24 16:27:47 +01:00
Benno Schulenberg 7c30d1fa69 display: account for zero-width characters when reserving space for '>'
That is: keep nibbling off characters until a character is eaten that
takes up at least one column.

This fixes https://savannah.gnu.org/bugs/?55759.
Reported-by: David Lawrence Ramsey <pooka109@gmail.com>

Bug existed since version 2.8.0, commit 5283acdc.
2019-02-24 11:28:52 +01:00
Benno Schulenberg 031166c34d help: don't list the unbound <Alt+Up> and <Alt+Down> in the tiny version 2019-02-24 11:27:10 +01:00
Benno Schulenberg 5e769686fb docs: mention that 'cutwordleft' is bound to <Shift+Ctrl+Delete>
The default binding was made in commit e6429e78, half a year ago,
but the documentation was not adjusted.
2019-02-24 11:25:35 +01:00
Benno Schulenberg df4d181987 help, docs: say "Delete" when things don't go into the cutbuffer
Reported-by: Božidar Putanec <bozidarp@yahoo.com>
2019-02-24 11:00:06 +01:00
Benno Schulenberg 7fcf6e6068 menus: don't show ^S and ^Q in the help lines in the tiny version
On small terminals (80 columns or so), ^S and ^Q would be in
the last position of the help lines.  But some terminals might
intercept ^S and stop all output (until ^Q is pressed), which
could be unexpected and frustrating.  So, rearrange things for
the tiny version so that ^S appears only on very wide terminals.

Also, having two keystrokes for saving the current buffer
(^O and ^S) in the two help lines is wasteful, more so as
in the tiny version there are no ^G help texts.

So, show the more useful M-Q and M-W instead.

This addresses https://bugs.debian.org/915017.
Reported-by: Steve McIntyre <steve@einval.com>
2019-02-21 17:42:51 +01:00
Benno Schulenberg 0f9d60a386 tweaks: split a variable into two, as they have different roles 2019-02-20 19:33:48 +01:00
Benno Schulenberg 11a66d74b8 tweaks: condense and correct a comment 2019-02-20 19:33:32 +01:00
Benno Schulenberg d3fdd20471 tweaks: rename an overlooked variable from a single letter to a word 2019-02-20 17:39:04 +01:00
Benno Schulenberg 82492ead47 tweaks: rename two variables, to be less confusing 2019-02-20 16:43:03 +01:00
Benno Schulenberg 00713a7c47 docs: deprecate the use of morespace, smooth, nonewlines, and nowrap 2019-02-20 16:34:29 +01:00