Partial fix of issues when using unicode sequence with describe-key, search-forward, query-replace-string.

This commit is contained in:
Renaud 2016-04-09 11:46:40 +08:00
parent f83ab08609
commit 1b2307e056
10 changed files with 28 additions and 23 deletions

View File

@ -139,7 +139,7 @@ bindable.o: bindable.c bindable.h defines.h buffer.h line.h retcode.h \
terminal.h
buffer.o: buffer.c buffer.h line.h retcode.h utf8.h defines.h estruct.h \
file.h input.h bind.h mlout.h window.h
display.o: display.c display.h estruct.h buffer.h line.h retcode.h utf8.h \
display.o: display.c display.h estruct.h utf8.h buffer.h line.h retcode.h \
input.h bind.h termio.h terminal.h defines.h version.h wrapper.h \
window.h
ebind.o: ebind.c ebind.h basic.h bind.h estruct.h bindable.h buffer.h \
@ -151,15 +151,15 @@ eval.o: eval.c eval.h basic.h bind.h buffer.h line.h retcode.h utf8.h \
exec.o: exec.c exec.h retcode.h buffer.h line.h utf8.h bind.h display.h \
estruct.h eval.h file.h flook.h input.h random.h window.h defines.h
execute.o: execute.c execute.h estruct.h bind.h random.h retcode.h \
display.h file.h buffer.h line.h utf8.h input.h mlout.h search.h \
display.h utf8.h file.h buffer.h line.h input.h mlout.h search.h \
terminal.h defines.h window.h
file.o: file.c file.h buffer.h line.h retcode.h utf8.h defines.h \
display.h estruct.h execute.h fileio.h input.h bind.h lock.h mlout.h \
window.h
fileio.o: fileio.c fileio.h defines.h retcode.h utf8.h
flook.o: flook.c flook.h retcode.h defines.h fileio.h
input.o: input.c input.h bind.h estruct.h bindable.h display.h exec.h \
retcode.h names.h terminal.h defines.h utf8.h wrapper.h
input.o: input.c input.h bind.h estruct.h bindable.h display.h utf8.h \
exec.h retcode.h names.h terminal.h defines.h wrapper.h
isearch.o: isearch.c isearch.h basic.h buffer.h line.h retcode.h utf8.h \
display.h estruct.h exec.h input.h bind.h search.h terminal.h defines.h \
window.h
@ -186,9 +186,9 @@ search.o: search.c search.h line.h retcode.h utf8.h basic.h buffer.h \
spawn.o: spawn.c spawn.h defines.h buffer.h line.h retcode.h utf8.h \
display.h estruct.h exec.h file.h flook.h input.h bind.h terminal.h \
window.h
tcap.o: tcap.c terminal.h defines.h retcode.h display.h estruct.h \
tcap.o: tcap.c terminal.h defines.h retcode.h utf8.h display.h estruct.h \
termio.h
termio.o: termio.c termio.h estruct.h retcode.h utf8.h
termio.o: termio.c termio.h utf8.h estruct.h retcode.h
utf8.o: utf8.c utf8.h
window.o: window.c window.h defines.h buffer.h line.h retcode.h utf8.h \
basic.h display.h estruct.h execute.h terminal.h wrapper.h

View File

@ -15,10 +15,10 @@
#define NSTRING 128 /* # of bytes, string buffers */
#define CONTROL 0x10000000 /* Control flag, or'ed in */
#define META 0x20000000 /* Meta flag, or'ed in */
#define CTLX 0x40000000 /* ^X flag, or'ed in */
#define SPEC 0x80000000 /* special key (function keys) */
#define CONTROL 0x01000000 /* Control flag, or'ed in */
#define META 0x02000000 /* Meta flag, or'ed in */
#define CTLX 0x04000000 /* ^X flag, or'ed in */
#define SPEC 0x08000000 /* special key (function keys) */
/* Actual 380x134 on a 1920x1080 screen in landscape,
if smaller font or portrait orientation limit to 400x150 */

View File

@ -1284,7 +1284,7 @@ void mlerase( void) {
TTflush() ;
}
static void mlputc( char c) {
static void mlputc( unicode_t c) {
if( ttcol < term.t_ncol) {
TTputc( c) ;
++ttcol ;
@ -1297,9 +1297,11 @@ static void mlputc( char c) {
* char *s; string to output
*/
void ostring( char *s) {
unsigned char c ;
if( discmd)
while( *s)
mlputc( *s++ & 0xFF) ;
while( (c = *s++) != 0)
mlputc( c) ;
}
@ -1552,7 +1554,7 @@ static int newscreensize(int h, int w)
*
* char c ; character to output
*/
void echoc( char c) {
void echoc( unicode_t c) {
if( disinp)
TTputc( c) ;
}

View File

@ -4,6 +4,7 @@
#include <stdarg.h>
#include "estruct.h"
#include "utf8.h"
extern int mpresf ; /* Stuff in message line */
extern int scrollcount ; /* number of lines to scroll */
@ -28,7 +29,7 @@ void mlerase( void) ;
void vmlwrite( const char *fmt, va_list ap) ;
void mlwrite( const char *fmt, ...) ;
void ostring( char *s) ;
void echoc( char c) ;
void echoc( unicode_t c) ;
void echos( char *s) ;
void getscreensize( int *widthp, int *heightp) ;

View File

@ -724,7 +724,7 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
for (n = 0; n < cpos; n++) {
c = buf[n];
if ((c < ' ') && (c != '\n')) {
echos("^");
echoc( '^') ;
++ttcol;
c ^= 0x40;
}
@ -751,7 +751,7 @@ int getstring( const char *prompt, char *buf, int nbuf, int eolchar)
buf[cpos++] = c;
if ((c < ' ') && (c != '\n')) {
echos("^");
echoc( '^') ;
++ttcol;
c ^= 0x40;
}

View File

@ -119,8 +119,7 @@ void ttclose(void)
* On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
* MS-DOS (use the very very raw console output routine).
*/
int ttputc(int c)
{
int ttputc( unicode_t c) {
char utf8[6];
int bytes;

2
tcap.c
View File

@ -370,6 +370,6 @@ static void tcapbeep(void)
static void putpad(char *str)
{
tputs(str, 1, ttputc);
tputs( str, 1, (int (*)( int)) ttputc) ;
}
#endif /* TERMCAP */

View File

@ -4,6 +4,7 @@
#include "defines.h" /* COLOR, SCROLLCODE */
#include "retcode.h"
#include "utf8.h"
/*
* The editor communicates with the display using a high level interface. A
@ -27,7 +28,7 @@ struct terminal {
void (*t_kopen)(void); /* Open keyboard */
void (*t_kclose)(void); /* close keyboard */
int (*t_getchar)(void); /* Get character from keyboard. */
int (*t_putchar)(int); /* Put character to display. */
int (*t_putchar)( unicode_t) ; /* Put character to display. */
void (*t_flush) (void); /* Flush output buffers. */
void (*t_move)(int, int);/* Move the cursor, origin 0. */
void (*t_eeol)(void); /* Erase to end of line. */

View File

@ -281,7 +281,7 @@ void ttclose(void)
* On CPM terminal I/O unbuffered, so we just write the byte out. Ditto on
* MS-DOS (use the very very raw console output routine).
*/
int ttputc( int c) {
int ttputc( unicode_t c) {
#if VMS
if (nobuf >= NOBUF)
ttflush();

View File

@ -1,6 +1,8 @@
#ifndef _TERMIO_H_
#define _TERMIO_H_
#include "utf8.h"
#define TYPEAH 1 /* type ahead causes update to be skipped */
#define HUGE 1000 /* Huge number (for row/col) */
@ -10,7 +12,7 @@ extern int ttcol ; /* Column location of HW cursor */
void ttopen( void) ;
void ttclose( void) ;
int ttputc( int c) ;
int ttputc( unicode_t c) ;
void ttflush( void) ;
int ttgetc( void) ;
int typahead( void) ;