rxvt_term::next_octet ()
{
return cmdbuf_ptr < cmdbuf_endp
- ? *cmdbuf_ptr++
+ ? (unsigned char)*cmdbuf_ptr++
: NOCHAR;
}
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);
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);
DT_END,
DT_INT,
DT_LONG,
- DT_STRING,
- DT_STRING_LEN,
- DT_USTRING_LEN,
+ DT_STR,
+ DT_STR_LEN,
+ DT_WCS_LEN,
DT_XEVENT,
};
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);
}
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 *);
}
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);
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
* Add text given in <str> of length <len> 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;
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;
}
}
while (str < strend)
{
- c = *str++;
+ c = (unicode_t)*str++; // convert to rxvt-unicodes representation
if (c < 0x20)
if (c == C0_LF)