Commit Graph

5989 Commits

Author SHA1 Message Date
Benno Schulenberg
d2b25120f0 tweaks: fuse two handlings of a delete key, and fix a comment 2016-07-10 21:36:25 +02:00
Benno Schulenberg
0c319f8b4b tweaks: put the case labels (the keycodes) in a more sensible order 2016-07-10 20:49:52 +02:00
Benno Schulenberg
4fcc760158 tweaks: put some case labels closer to their statements
Also condense some comments, and group keys with the same result together.
2016-07-10 20:38:08 +02:00
Benno Schulenberg
0d5f918453 input: add some missing keycodes to the parsing routine
Add them so that <Esc> followed by <Home> will simply do "Home" instead of
reporting an unbound key.  The same for <End>, <PageUp> and <PageDown>.

This restores the behavior from before nano-2.3.5.
2016-07-10 20:21:11 +02:00
Rishabh Dave
9c7940b599 utils: accept mistypings and common separators between line and column
It is easy to type beside the comma key and hit instead "m" or ".", so
accept also these as a separator between line and column number.  And
when being generous anyway, also accept space, slash and semicolon.

This fulfills https://savannah.gnu.org/bugs/?48305.

Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-07-04 22:04:24 +02:00
Benno Schulenberg
ccfb1eb0f1 tweaks: rearrange a function in my style, and rename a variable 2016-07-04 21:50:12 +02:00
Benno Schulenberg
7e3a9c3aa6 utils: don't bother to check line and column for NULL
When parsing a line and a column number, of course the found values
need to be passed back, otherwise it would be pointless to parse them.
2016-07-04 21:42:04 +02:00
Benno Schulenberg
a730b25ef9 browser: elide another call of opendir()
And in the bargain show an error message when doing ^R unreadabledir ^T.
2016-07-04 21:18:09 +02:00
Benno Schulenberg
500fef8314 tweaks: rename a variable -- to match others and to be more concise 2016-07-04 13:43:19 +02:00
Benno Schulenberg
29986e95a0 input: don't drop the first byte when user starts typing during loading
Precalculation of the multiline color data can be cut short when the
user is impatient and starts typing.  But this would drop the first
byte of whatever was typed -- not nice when it was just plain text,
but surprising and worse when the first keystroke was a command.

This fixes https://savannah.gnu.org/bugs/?48388.
2016-07-04 09:27:35 +02:00
Benno Schulenberg
4af1da7d95 color: push the resets further when start and end match are equal
When for a multiline syntax-coloring rule the starting regex matches at
the exact same spot as the ending regex, do a second round of resets, so
that reevaluation starts further back and gets a few more things right.

This mildly fixes https://savannah.gnu.org/bugs/?47420.
2016-07-03 16:23:54 +02:00
Benno Schulenberg
528b79b5f3 tweaks: rename a variable to be more accurate
When we get a ^J as verbatim input, it is not possible to include it
into the file buffer or the prompt answer, because this would mean
adding an encoded null to the buffer or answer, and that is not what
the user intended.  One option would have been to simply ignore a ^J
in verbatim input.  But the choice has been made to act the same way
as when the ^J (0x0A) is found in the file data: start a new line.

That is the same response as to the Enter key, yes -- but the code
for the Enter key is ^M (0x0D), not ^J.  So, to be more precise,
rename the relevant variable from 'got_enter' to 'got_newline'.
2016-07-03 16:19:27 +02:00
Benno Schulenberg
03a81aa9c5 browser: trim all trailing slashes (just in case there are more) 2016-07-03 16:18:26 +02:00
Rishabh Dave
4957c1121d browser: select an inaccessible directory also when tabbed
When the user tab-completed a name at the Go To Directory prompt, this
name will end in a slash.  Remove this slash, so the name can be found
in the file list (where directory names don't include the final slash).

This fixes http://savannah.gnu.org/bugs/?48353.

Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-07-02 12:26:42 +02:00
Benno Schulenberg
d9d8eb2480 tweaks: straighten out the flow of a loop 2016-07-01 13:11:23 +02:00
Benno Schulenberg
d9aad9212f tweaks: elide a bit of code duplication 2016-07-01 13:11:00 +02:00
Benno Schulenberg
8b636de1d3 tweaks: put all the movement functions together
And order them from smallest stride to biggest stride.
2016-07-01 12:42:58 +02:00
Benno Schulenberg
aeab800490 tweaks: improve a few comments 2016-07-01 12:34:33 +02:00
Benno Schulenberg
f8c33e8630 tweaks: reduce the scope of two variables 2016-07-01 12:22:44 +02:00
Benno Schulenberg
b6efea266e chars: invalid sequences are not blank, nor text, nor punctuation
So, slightly speed up the functions that check for those.
2016-06-30 14:34:34 +02:00
Benno Schulenberg
8686cb3d3d chars: measure invalid sequences and unassigned codepoints more quickly
Invalid multibyte sequences get depicted with the Replacement Character,
and unassigned codepoints are shown as if they were a space.  Both have
a width of one.
2016-06-30 14:33:25 +02:00
Benno Schulenberg
91fff2a2c8 screen: avoid looking up the width of whitespace and control codes
Spaces and tabs and control codes never are multi-column glyphs, so
only look up the width for "normal", visible characters.
2016-06-30 14:32:10 +02:00
Benno Schulenberg
d6f43bd156 screen: elide the intermediate buffer for every single character 2016-06-30 14:29:14 +02:00
Benno Schulenberg
ebbe546033 screen: again, look at the bytes in their context
This avoids having to null-terminate every single-byte character.
2016-06-30 14:28:29 +02:00
Benno Schulenberg
cf0eed6c36 screen: don't check for every character whether there is still enough space
Just allocate ample space up front and thus discard the delaying 'if' for
each and every character.  In most cases this will allocate far too much,
but that hardly matters: it is freed again as soon as the line is printed.
2016-06-30 14:27:00 +02:00
Benno Schulenberg
feacacc46d chars: look at bytes in their context, so only valid sequences are accepted
This fixes https://savannah.gnu.org/bugs/?48125.

(The fix is slightly wasteful; speeding things up will follow later.)
2016-06-29 20:56:50 +02:00
Benno Schulenberg
af53c56ec8 chars: speed up the determination whether something is a control character
Use knowledge of UTF-8 instead of converting to wide characters first.
2016-06-29 20:56:50 +02:00
Benno Schulenberg
019d7b34ca chars: delete a now-unused function 2016-06-29 20:56:50 +02:00
Benno Schulenberg
622995fb12 chars: the representation of a control character is always two bytes
Any control character is represented by a ^ plus an ASCII character.
2016-06-29 20:56:50 +02:00
Benno Schulenberg
03586c60da chars: represent the high-bit controls more intelligibly
Instead of showing the upper control codes like this:

   ^À ^Á ^Â ^Ã ^Ä ^Å ^Æ ^Ç ^È ^É ^Ê ^Ë ^Ì ^Í ^Î ^Ï
   ^Ð ^Ñ ^Ò ^Ó ^Ô ^Õ ^Ö ^× ^Ø ^Ù ^Ú ^Û ^Ü ^Ý ^Þ ^ß

show them like this:

   ^` ^a ^b ^c ^d ^e ^f ^g ^h ^i ^j ^k ^l ^m ^n ^o
   ^p ^q ^r ^s ^t ^u ^v ^w ^x ^y ^z ^{ ^| ^} ^~ ^=

The lower control codes continue to be shown like this:

   ^@ ^A ^B ^C ^D ^E ^F ^G ^H ^I ^J ^K ^L ^M ^N ^O
   ^P ^Q ^R ^S ^T ^U ^V ^W ^X ^Y ^Z ^[ ^\ ^] ^^ ^_

The representation of DEL (0x7F) continues as ^?.

Further, use knowledge of UTF-8 to avoid a roundtrip through
wide characters.
2016-06-29 20:56:50 +02:00
Benno Schulenberg
07a39e8e18 screen: don't simulate a sigwinch but directly reinitialize the screen
This fixes the second part of https://savannah.gnu.org/bugs/?48331.

Reported-by: Mike Frysinger <vapier@gentoo.org>
2016-06-29 15:55:38 +02:00
Benno Schulenberg
1d7c177606 input: don't drop a keystroke on the floor when the terminal resizes
This fixes the first part of https://savannah.gnu.org/bugs/?48331.

Reported-by: Mike Frysinger <vapier@gentoo.org>
2016-06-29 15:53:08 +02:00
Benno Schulenberg
2ae490cd8f build: refresh the git description whenever something is recompiled
This fixes https://savannah.gnu.org/bugs/?47962 reported by Cody Taylor.
2016-06-27 19:45:21 +02:00
Benno Schulenberg
6fda7a7057 chars: speed up two reverse-searching routines a bit
By removing from their main loops a condition that occurs just once.
2016-06-27 19:22:28 +02:00
Benno Schulenberg
1e2833e07b tweaks: elide two unneeded variables 2016-06-27 19:22:20 +02:00
Benno Schulenberg
067b0a3367 input: elide an extra buffer for inserting stuff into the text
Do the casting from integer to character rightaway in the first
intermediate buffer.
2016-06-27 19:18:40 +02:00
Benno Schulenberg
24b10179a1 files: beep whenever writing out a file fails
Just like when reading a file fails.  It needs the user's attention.
2016-06-27 19:17:53 +02:00
Benno Schulenberg
c14b581e0a po: update translations and regenerate POT file and PO files 2016-06-27 11:07:44 +02:00
Benno Schulenberg
bfcb4cd415 bump version numbers and add a news item for 2.6.1 2016-06-27 11:01:54 +02:00
Benno Schulenberg
8fef94cd7d po: make the linguas script regenerate the POT file
So we don't have to remember its awkward target name.
2016-06-27 10:58:47 +02:00
Benno Schulenberg
61d7ca4c41 docs: adjust the description of the verbatim function 2016-06-27 09:35:05 +02:00
Rishabh Dave
559858a3dd browser: don't seem to enter a directory when it is inaccessible
This fixes https://savannah.gnu.org/bugs/?48286.

Reviewed-by: Benno Schulenberg <bensberg@justemail.net>
Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
2016-06-26 10:14:12 +02:00
Benno Schulenberg
ddd9c7a022 tweaks: try to distinguish between keystrokes and characters
Keystrokes are single integers (aided by the flags meta_key and
func_key) but in the input stream they can be encoded as escape
sequences (a series of bytes).  Characters are values in byte
range, but in UTF-8 one character can consist of multiple bytes.

Also rename two variables, because the secondary input buffer
that they refer to contains only characters (mostly just one),
never any shortcuts; and there are too many "kbinput" already.
2016-06-25 20:34:09 +02:00
Benno Schulenberg
03c689c22c tweaks: normalize a type, and rewrap a line 2016-06-25 20:33:11 +02:00
Benno Schulenberg
5270dd8b32 tweaks: add a reporter's name 2016-06-25 20:03:25 +02:00
Benno Schulenberg
f33796bee1 tweaks: elide an impossible case
Typing a Unicode code is always finished after at most six characters:
either retval == uni or retval == kbinput, but it can't be ERR.
2016-06-25 16:52:36 +02:00
Benno Schulenberg
e679c518b1 tweaks: elide an unneeded variable 2016-06-25 16:52:36 +02:00
Luke Francl
ba9214c689 syntaxes: add highlighting rules for Rust
With tweaks from Andrea Canciani, Ben Young, Tennix, and Dirkjan Ochtman.

This fulfills https://savannah.gnu.org/bugs/?48163.
2016-06-25 09:56:11 +02:00
Benno Schulenberg
68acc1dfc5 tabs: compute the number of required spaces without iterating 2016-06-24 14:56:41 +02:00
Benno Schulenberg
1a4ec6c2d3 moving: allow specifying negative numbers in "Go To Line"
The negatives are taken to mean: from the end of the file,
and: from the end of the line.

This fulfills https://savannah.gnu.org/bugs/?48248.
2016-06-24 14:47:02 +02:00