Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
emacs
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
emacs
emacs
Commits
fd503d99
Commit
fd503d99
authored
Jul 01, 2009
by
Kenichi Handa
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(decode_keyboard_code): New function.
(tty_read_avail_input): Decode the input bytes if necessary.
parent
624bda09
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
81 additions
and
0 deletions
+81
-0
src/ChangeLog
src/ChangeLog
+10
-0
src/keyboard.c
src/keyboard.c
+71
-0
No files found.
src/ChangeLog
View file @
fd503d99
2009-07-01 Kenichi Handa <handa@m17n.org>
* keyboard.c (decode_keyboard_code): New function.
(tty_read_avail_input): Decode the input bytes if necessary.
* coding.c (setup_coding_system): Initialize
coding->carryover_bytes to 0.
(Fset_keyboard_coding_system_internal): If CODING-SYSTEM is nil,
use Qno_conversion.
2009-07-01 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
* Makefile.in (SOME_MACHINE_LISP): Add ../lisp/term/common-win.elc.
...
...
src/keyboard.c
View file @
fd503d99
...
...
@@ -7137,6 +7137,47 @@ read_avail_input (expected)
return nread;
}
static void
decode_keyboard_code (struct tty_display_info *tty,
struct coding_system *coding,
unsigned char *buf, int nbytes)
{
unsigned char *src = buf;
const unsigned char *p;
int i;
if (nbytes == 0)
return;
if (tty->meta_key != 2)
for (i = 0; i < nbytes; i++)
buf[i] &= ~0x80;
if (coding->carryover_bytes > 0)
{
src = alloca (coding->carryover_bytes + nbytes);
memcpy (src, coding->carryover, coding->carryover_bytes);
memcpy (src + coding->carryover_bytes, buf, nbytes);
nbytes += coding->carryover_bytes;
}
coding->destination = alloca (nbytes * 4);
coding->dst_bytes = nbytes * 4;
decode_coding_c_string (coding, src, nbytes, Qnil);
if (coding->produced_char == 0)
return;
for (i = 0, p = coding->destination; i < coding->produced_char; i++)
{
struct input_event buf;
EVENT_INIT (buf);
buf.code = STRING_CHAR_ADVANCE (p);
buf.kind = (ASCII_CHAR_P (buf.code)
? ASCII_KEYSTROKE_EVENT : MULTIBYTE_CHAR_KEYSTROKE_EVENT);
/* See the comment in tty_read_avail_input. */
buf.frame_or_window = tty->top_frame;
buf.arg = Qnil;
kbd_buffer_store_event (&buf);
}
}
/* This is the tty way of reading available input.
Note that each terminal device has its own `struct terminal' object,
...
...
@@ -7288,6 +7329,36 @@ tty_read_avail_input (struct terminal *terminal,
#endif /* not MSDOS */
#endif /* not WINDOWSNT */
if (TERMINAL_KEYBOARD_CODING (terminal)->common_flags
& CODING_REQUIRE_DECODING_MASK)
{
struct coding_system *coding = TERMINAL_KEYBOARD_CODING (terminal);
int from;
/* Decode the key sequence except for those with meta
modifiers. */
for (i = from = 0; ; i++)
if (i == nread || (tty->meta_key == 1 && (cbuf[i] & 0x80)))
{
struct input_event buf;
decode_keyboard_code (tty, coding, cbuf + from, i - from);
if (i == nread)
break;
EVENT_INIT (buf);
buf.kind = ASCII_KEYSTROKE_EVENT;
buf.modifiers = meta_modifier;
buf.code = cbuf[i] & ~0x80;
/* See the comment below. */
buf.frame_or_window = tty->top_frame;
buf.arg = Qnil;
kbd_buffer_store_event (&buf);
from = i + 1;
}
return nread;
}
for (i = 0; i < nread; i++)
{
struct input_event buf;
...
...
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