summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
7a634f0)
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
Copyright © 2006 Pierre Habouzit
*/
Copyright © 2006 Pierre Habouzit
*/
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <assert.h>
#include <ctype.h>
#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
}
if (rt->elen + 1 >= (int)sizeof(rt->ebuf)) {
}
if (rt->elen + 1 >= (int)sizeof(rt->ebuf)) {
fprintf(stderr, "cancelled: \\033");
for (i = 0; i < rt->elen; i++) {
int c = rt->ebuf[i];
fprintf(stderr, "cancelled: \\033");
for (i = 0; i < rt->elen; i++) {
int c = rt->ebuf[i];
void madtty_putc(madtty_t *rt, wchar_t wc)
{
void madtty_putc(madtty_t *rt, wchar_t wc)
{
if (!rt->seen_input) {
rt->seen_input = 1;
kill(-rt->childpid, SIGWINCH);
if (!rt->seen_input) {
rt->seen_input = 1;
kill(-rt->childpid, SIGWINCH);
if (wc >= 0x41 && wc <= 0x7e && vt100_0[wc - 0x41]) {
wc = vt100_0[wc - 0x41];
if (wc >= 0x41 && wc <= 0x7e && vt100_0[wc - 0x41]) {
wc = vt100_0[wc - 0x41];
- // width = 1; // vt100 line drawing characters are always single-width
+ width = 1;
+ } else {
+ width = wcwidth(wc) ?: 1;
+ }
+
+ if (width == 2 && rt->curs_col == rt->cols - 1) {
+ tmp = rt->curs_row;
+ tmp->dirty = true;
+ tmp->text[rt->curs_col] = 0;
+ tmp->attr[rt->curs_col] = build_attrs(rt->curattrs);
+ rt->curs_col++;
}
if (rt->curs_col >= rt->cols) {
}
if (rt->curs_col >= rt->cols) {
- wmemmove(tmp->text + rt->curs_col + 1, tmp->text + rt->curs_col,
- (rt->cols - rt->curs_col - 1));
- memmove(tmp->attr + rt->curs_col + 1, tmp->attr + rt->curs_col,
- (rt->cols - rt->curs_col - 1) * sizeof(tmp->attr[0]));
+ wmemmove(tmp->text + rt->curs_col + width, tmp->text + rt->curs_col,
+ (rt->cols - rt->curs_col - width));
+ memmove(tmp->attr + rt->curs_col + width, tmp->attr + rt->curs_col,
+ (rt->cols - rt->curs_col - width) * sizeof(tmp->attr[0]));
}
tmp->text[rt->curs_col] = wc;
tmp->attr[rt->curs_col] = build_attrs(rt->curattrs);
}
tmp->text[rt->curs_col] = wc;
tmp->attr[rt->curs_col] = build_attrs(rt->curattrs);
+ if (width == 2) {
+ tmp->text[rt->curs_col] = 0;
+ tmp->attr[rt->curs_col] = build_attrs(rt->curattrs);
+ rt->curs_col++;
+ }
len = wcrtomb(buf, row->text[j], NULL);
waddnstr(win, buf, len);
len = wcrtomb(buf, row->text[j], NULL);
waddnstr(win, buf, len);
+ if (wcwidth(row->text[j]) > 1)
+ j++;
} else {
waddch(win, row->text[j] > ' ' ? row->text[j] : ' ');
}
} else {
waddch(win, row->text[j] > ' ' ? row->text[j] : ' ');
}
raw();
nodelay(stdscr, TRUE);
keypad(stdscr, TRUE);
raw();
nodelay(stdscr, TRUE);
keypad(stdscr, TRUE);
for (int i = -1; i < 8; i++) {
for (int j = -1; j < 8; j++) {
for (int i = -1; i < 8; i++) {
for (int j = -1; j < 8; j++) {