Commit Graph

851 Commits (6d6f5bd4a700f1cb3b8a56a2ddf2e7b1f4bce788)

Author SHA1 Message Date
Benno Schulenberg 6d6f5bd4a7 tweaks: check earlier on for sufficient length of the sequence 2016-07-29 09:33:28 +02:00
Benno Schulenberg e3dbffc9f7 input: be more strict in recognizing certain escape sequences
Accept the "Esc [ 1 n ~" and "Esc [ 2 n ~" sequences only when they
end with the "~" character, not with any character.
2016-07-29 09:33:28 +02:00
Benno Schulenberg 2225d54126 input: don't use a function call when a literal value will do 2016-07-29 09:33:28 +02:00
Benno Schulenberg 9115828e76 input: fix a pasto from eight years ago, from commit e347efb 2016-07-29 09:33:16 +02:00
Benno Schulenberg f3e8991206 credits: don't bother blanking the second line nor the help lines
Those lines don't exist in that mode -- the relevant subwindows are
smaller, or have been made smaller just before.
2016-07-27 12:40:11 +02:00
Benno Schulenberg 68cfb08888 tweaks: fix compilation with --enable-tiny 2016-07-25 17:29:24 +02:00
Benno Schulenberg a472f480a7 tweaks: trim some comments, and simplify a condition 2016-07-24 13:44:16 +02:00
Benno Schulenberg 4416d9c941 tweaks: shuffle the resetting of a counter to the tail of the routine 2016-07-24 13:15:45 +02:00
Benno Schulenberg c073c5ae54 tweaks: don't bother resetting the Unicode code holder
It will be initialized when a new code is started.
2016-07-24 13:09:24 +02:00
David Lawrence Ramsey fc0ddab349 input: provide feedback on the Unicode digits typed so far
This fulfills https://savannah.gnu.org/bugs/?48154.
2016-07-24 12:19:42 +02:00
Benno Schulenberg c6dbcf91c3 new feature: functions to jump to previous or following block of text
And hard-bind the keys Ctrl+Up and Ctrl+Down to these functions.

Unlike the paragraph-jumping code, these new functions disregard
any indentation, treating only blank lines as separators.  They
also do an automatic smart home when that option is set.

This fulfills https://savannah.gnu.org/bugs/?48291.
2016-07-24 12:00:00 +02:00
Benno Schulenberg 8c7a38596d screen: include a workaround only when compiling against older ncurses
The bug with a leading wide character has been fixed since ncurses-5.9.

See https://savannah.gnu.org/bugs/?31743 for reference.
2016-07-24 10:38:31 +02:00
Benno Schulenberg 1c2d2a4027 tweaks: adjust a comment for removed definitions 2016-07-22 15:57:20 +02:00
Rishabh Dave 4c566c7903 tweaks: reduce the number of wattron/wattrof calls
Also, compose the coloring attributes during initialization
instead of every time when painting something.

Signed-off-by: Rishabh Dave <rishabhddave@gmail.com>
Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
2016-07-21 10:10:59 +02:00
Benno Schulenberg 73a07215cc debug: remove duplicate information 2016-07-21 09:54:07 +02:00
Benno Schulenberg 103dd06347 input: don't crash when the window is resized during verbatim input
Instead of referring to a window that might have been deleted by a
resize, just turn the keypad back on for the two windows from which
input might have been requested.

Also: don't insert KEY_WINCH as the verbatim keystroke.

This fixes https://savannah.gnu.org/bugs/?48532.
2016-07-17 12:18:12 +02:00
Benno Schulenberg 1d4c1e0bfc input: plug a memory leak
This fixes https://savannah.gnu.org/bugs/?48538.
2016-07-17 12:00:33 +02:00
Benno Schulenberg a37cd9f0ef tweaks: rename a variable, to clarify it refers to columns, not to bytes 2016-07-14 14:28:15 +02:00
Benno Schulenberg b4babc2036 input: accept only the four iTerm sequences that actually get handled
This fixes https://savannah.gnu.org/bugs/?48455.
2016-07-13 13:01:46 +02:00
Benno Schulenberg f2150d3f98 input: treat Ctrl+Alt+key different from Esc followed by Ctrl+key
When the user changes her mind after having pressed Esc, she cannot
unpress Esc, so do that for her by ignoring the escape code when
the subsequent keycode is outside of the normal printable range.

This restores the behavior from before nano-2.3.5 -- except that
Ctrl+Alt+key continues to report an unbound key.

This fixes https://savannah.gnu.org/bugs/?48459.
2016-07-13 10:01:07 +02:00
Benno Schulenberg 033376aec0 input: consider only O, o and [ as starters of multi-character sequences
This prevents many keycode sequences from being misconstrued when a
command key plus other keystrokes accumulate in the input buffer.

This fixes https://savannah.gnu.org/bugs/?48395.
2016-07-13 09:56:24 +02:00
Benno Schulenberg e33a0b6dbe screen: avoid converting each character twice from multibyte to wide 2016-07-12 19:41:13 +02:00
Benno Schulenberg 0894587305 screen: elide another intermediate buffer for every visible character 2016-07-12 19:30:50 +02:00
Benno Schulenberg 960e848cc7 tweaks: elide a typedef, as it now has just one element 2016-07-12 09:35:48 +02:00
Benno Schulenberg 8507dd4bd0 color: integrate the hilite attribute into the pair number
Color-pair numbers and attributes can be OR'd together -- do so,
to save an attron() call whenever the hilite is on.
2016-07-12 09:20:09 +02:00
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
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 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 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 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 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
Jordi Mallach c2b199e926 docs: use https for nano-editor.org, and drop the www
Switch to https and drop the www. prefix for all occurrences of the
website URL.
2016-06-23 19:51:01 +02:00
Benno Schulenberg 95f417fa9a tweaks: rewrap a bunch of lines and some comments 2016-06-20 13:05:45 +02:00
Benno Schulenberg 21d9bd1107 tweaks: rename some variables to be more readable 2016-06-01 13:04:32 +02:00
Benno Schulenberg 5864d97590 tweaks: harmonize the routine for tabs with the one for spaces 2016-06-01 13:04:22 +02:00
Benno Schulenberg 3ac37642c8 screen: check for the most frequent character first: a space 2016-06-01 13:04:08 +02:00
Benno Schulenberg a9f79a6130 tweaks: reindent and rewrap a few lines, and shorten a comment 2016-06-01 13:03:26 +02:00
Benno Schulenberg 17cf833b9c tweaks: normalize some whitespace 2016-05-30 09:09:36 +02:00
Benno Schulenberg e0e788e218 tweaks: reshuffle a few things 2016-05-23 21:34:02 +02:00
Benno Schulenberg c8f530af93 statusbar: add a non-beeping message type that does not get overwritten
Error messages about lock files should not get overwritten by purely
informational messages, only by alerting ones.

This fixes https://savannah.gnu.org/bugs/?47963.
2016-05-21 13:58:09 +02:00