Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
cs24-19fa
git_rec_nano
Commits
fc0ddab3
Commit
fc0ddab3
authored
8 years ago
by
David Lawrence Ramsey
Committed by
Benno Schulenberg
8 years ago
Browse files
Options
Download
Email Patches
Plain Diff
input: provide feedback on the Unicode digits typed so far
This fulfills
https://savannah.gnu.org/bugs/?48154
.
parent
c6dbcf91
master
feature/match-parens
refactor/readbility
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/proto.h
+1
-1
src/proto.h
src/winio.c
+16
-9
src/winio.c
with
17 additions
and
10 deletions
+17
-10
src/proto.h
View file @
fc0ddab3
...
...
@@ -775,7 +775,7 @@ int parse_escape_sequence(WINDOW *win, int kbinput);
int
get_byte_kbinput
(
int
kbinput
);
#ifdef ENABLE_UTF8
long
add_unicode_digit
(
int
kbinput
,
long
factor
,
long
*
uni
);
long
get_unicode_kbinput
(
int
kbinput
);
long
get_unicode_kbinput
(
WINDOW
*
win
,
int
kbinput
);
#endif
int
get_control_kbinput
(
int
kbinput
);
void
unparse_kbinput
(
char
*
output
,
size_t
output_len
);
...
...
This diff is collapsed.
Click to expand it.
src/winio.c
View file @
fc0ddab3
...
...
@@ -1230,7 +1230,7 @@ long add_unicode_digit(int kbinput, long factor, long *uni)
/* Translate a Unicode sequence: turn a six-digit hexadecimal number
* (from 000000 to 10FFFF, case-insensitive) into its corresponding
* multibyte value. */
long
get_unicode_kbinput
(
int
kbinput
)
long
get_unicode_kbinput
(
WINDOW
*
win
,
int
kbinput
)
{
static
int
uni_digits
=
0
;
static
long
uni
=
0
;
...
...
@@ -1290,12 +1290,24 @@ long get_unicode_kbinput(int kbinput)
break
;
}
/* If we have a result, reset the Unicode digit counter and the
/* If we have a
full
result, reset the Unicode digit counter and the
* Unicode sequence holder. */
if
(
retval
!=
ERR
)
{
uni_digits
=
0
;
uni
=
0
;
}
/* Show feedback only when editing, not when at a prompt. */
else
if
(
win
==
edit
)
{
char
partial
[
7
]
=
"......"
;
/* Construct the partial result, right-padding it with dots. */
snprintf
(
partial
,
uni_digits
+
1
,
"%06lX"
,
uni
);
partial
[
uni_digits
]
=
'.'
;
/* TRANSLATORS: This is shown while a six-digit hexadecimal
* Unicode character code (%s) is being typed in. */
statusline
(
HUSH
,
_
(
"Unicode Input: %s"
),
partial
);
}
#ifdef DEBUG
fprintf
(
stderr
,
"get_unicode_kbinput(): kbinput = %d, uni_digits = %d, uni = %ld, retval = %ld
\n
"
,
kbinput
,
uni_digits
,
uni
,
retval
);
...
...
@@ -1413,7 +1425,7 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
if
(
using_utf8
())
{
/* Check whether the first keystroke is a valid hexadecimal
* digit. */
long
uni
=
get_unicode_kbinput
(
*
kbinput
);
long
uni
=
get_unicode_kbinput
(
win
,
*
kbinput
);
/* If the first keystroke isn't a valid hexadecimal digit, put
* back the first keystroke. */
...
...
@@ -1427,16 +1439,11 @@ int *parse_verbatim_kbinput(WINDOW *win, size_t *kbinput_len)
char
*
uni_mb
;
int
uni_mb_len
,
*
seq
,
i
;
if
(
win
==
edit
)
/* TRANSLATORS: This is displayed during the input of a
* six-digit hexadecimal Unicode character code. */
statusbar
(
_
(
"Unicode Input"
));
while
(
uni
==
ERR
)
{
free
(
kbinput
);
while
((
kbinput
=
get_input
(
win
,
1
))
==
NULL
)
;
uni
=
get_unicode_kbinput
(
*
kbinput
);
uni
=
get_unicode_kbinput
(
win
,
*
kbinput
);
}
/* Put back the multibyte equivalent of the Unicode
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help