From: root Date: Fri, 6 Jan 2006 18:33:30 +0000 (+0000) Subject: *** empty log message *** X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=931c5783b6195269f19c1d54df19845f6317e5e5;p=dana%2Furxvt.git *** empty log message *** --- diff --git a/src/command.C b/src/command.C index 55e086da..a5819175 100644 --- a/src/command.C +++ b/src/command.C @@ -2892,7 +2892,7 @@ uint32_t rxvt_term::next_octet () { return cmdbuf_ptr < cmdbuf_endp - ? *cmdbuf_ptr++ + ? (unsigned char)*cmdbuf_ptr++ : NOCHAR; } diff --git a/src/rxvt.h b/src/rxvt.h index 92811b8e..ca199e5a 100644 --- a/src/rxvt.h +++ b/src/rxvt.h @@ -1296,10 +1296,10 @@ struct rxvt_term : zero_initialized, rxvt_vars { void lookup_key (XKeyEvent &ev); unsigned int cmd_write (const char *str, unsigned int count); - unicode_t next_char (); - unicode_t cmd_getc (); - unicode_t next_octet (); - unicode_t cmd_get8 (); + wchar_t next_char (); + wchar_t cmd_getc (); + uint32_t next_octet (); + uint32_t cmd_get8 (); bool cmd_parse (); void mouse_report (XButtonEvent &ev); @@ -1463,7 +1463,7 @@ struct rxvt_term : zero_initialized, rxvt_vars { int scr_change_screen (int scrn); void scr_color (unsigned int color, int fgbg); void scr_rendition (int set, int style); - void scr_add_lines (const unicode_t *str, int nlines, int len); + void scr_add_lines (const wchar_t *str, int len, int minlines = 0); void scr_backspace (); void scr_tab (int count, bool ht = false); void scr_gotorc (int row, int col, int relative); diff --git a/src/rxvtperl.h b/src/rxvtperl.h index e76de58a..ba52c127 100644 --- a/src/rxvtperl.h +++ b/src/rxvtperl.h @@ -15,9 +15,9 @@ enum data_type { DT_END, DT_INT, DT_LONG, - DT_STRING, - DT_STRING_LEN, - DT_USTRING_LEN, + DT_STR, + DT_STR_LEN, + DT_WCS_LEN, DT_XEVENT, }; diff --git a/src/rxvtperl.xs b/src/rxvtperl.xs index afd55ff4..efd63c5c 100644 --- a/src/rxvtperl.xs +++ b/src/rxvtperl.xs @@ -467,11 +467,11 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) XPUSHs (sv_2mortal (newSViv (va_arg (ap, long)))); break; - case DT_STRING: + case DT_STR: XPUSHs (sv_2mortal (newSVpv (va_arg (ap, char *), 0))); break; - case DT_STRING_LEN: + case DT_STR_LEN: { char *str = va_arg (ap, char *); int len = va_arg (ap, int); @@ -480,6 +480,14 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) } break; + case DT_WCS_LEN: + { + wchar_t *wstr = va_arg (ap, wchar_t *); + int wlen = va_arg (ap, int); + + XPUSHs (sv_2mortal (wcs2sv (wstr, wlen))); + } + case DT_XEVENT: { XEvent *xe = va_arg (ap, XEvent *); @@ -532,20 +540,6 @@ rxvt_perl_interp::invoke (rxvt_term *term, hook_type htype, ...) } break; - case DT_USTRING_LEN: - { - unicode_t *ustr = va_arg (ap, unicode_t *); - int ulen = va_arg (ap, int); - wchar_t *wstr = new wchar_t [ulen]; - - for (int i = ulen; i--; ) - wstr [i] = ustr [i]; - - XPUSHs (sv_2mortal (wcs2sv (wstr, ulen))); - - delete [] wstr; - } - case DT_END: { va_end (ap); @@ -1063,20 +1057,8 @@ rxvt_term::scr_add_lines (SV *string) CODE: { wchar_t *wstr = sv2wcs (string); - int wlen = wcslen (wstr); - unicode_t *ustr = new unicode_t [wlen]; - int nlines = 0; - - for (int i = wlen; i--; ) - { - ustr [i] = wstr [i]; - nlines += ustr [i] == '\012'; - } - - THIS->scr_add_lines (ustr, nlines, wlen); - + THIS->scr_add_lines (wstr, wcslen (wstr)); free (wstr); - delete [] ustr; } void diff --git a/src/screen.C b/src/screen.C index 60caa77a..98db4acd 100644 --- a/src/screen.C +++ b/src/screen.C @@ -702,7 +702,7 @@ rxvt_term::scr_scroll_text (int row1, int row2, int count) * Add text given in of length to screen struct */ void -rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len) +rxvt_term::scr_add_lines (const wchar_t *str, int len, int minlines) { if (len <= 0) /* sanity */ return; @@ -710,22 +710,22 @@ rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len) unsigned char checksel; unicode_t c; int ncol = this->ncol; - const unicode_t *strend = str + len; + const wchar_t *strend = str + len; want_refresh = 1; ZERO_SCROLLBACK (); - if (nlines > 0) + if (minlines > 0) { - nlines += screen.cur.row - screen.bscroll; + minlines += screen.cur.row - screen.bscroll; - if (nlines > 0 + if (minlines > 0 && screen.tscroll == 0 && screen.bscroll == nrow - 1) { /* _at least_ this many lines need to be scrolled */ - scr_scroll_text (screen.tscroll, screen.bscroll, nlines); - screen.cur.row -= nlines; + scr_scroll_text (screen.tscroll, screen.bscroll, minlines); + screen.cur.row -= minlines; } } @@ -742,7 +742,7 @@ rxvt_term::scr_add_lines (const unicode_t *str, int nlines, int len) while (str < strend) { - c = *str++; + c = (unicode_t)*str++; // convert to rxvt-unicodes representation if (c < 0x20) if (c == C0_LF)