+=head1 NAME
+
+RXVT TECHNICAL REFERENCE - command sequences and background information
+
+=head1 SYNOPSIS
+
+ # set a new font set
+ printf '\33]50;%s\007' 9x15,xft:Kochi" Mincho"
+
+ # change the locale and tell rxvt-unicode about it
+ export LC_CTYPE=ja_JP.EUC-JP; printf "\33]701;$LC_CTYPE\007"
+
+ # set window title
+ printf '\33]2;%s\007' "new window title"
+
+=head1 DESCRIPTION
+
+The rest of this document describes various technical aspects of
+B<rxvt-unicode>. First the description of supported command sequences,
+followed by menu and pixmap support and last by a description of all
+features selectable at C<configure> time.
+
=head1 RXVT TECHNICAL REFERENCE
=head1 Definitions
Invoke the G3 Character Set (LS3)
-=item B<< C<ESC>(C<C> >>
+=item B<< C<ESC> ( C> >>
Designate G0 Character Set (ISO 2022), see below for values of C<C>.
-=item B<< C<ESC>)C<C> >>
+=item B<< C<ESC> ) C> >>
Designate G1 Character Set (ISO 2022), see below for values of C<C>.
=end table
+=item B<< C<ESC [ Pm h> >>
+
+Set Mode (SM). See B<< C<ESC [ Pm l> >> sequence for description of C<Pm>.
+
=item B<< C<ESC [ Ps i> >>
-Printing
+Printing. See also the C<print-pipe> resource.
=begin table
+ B<< C<Ps = 0> >> print screen (MC0)
B<< C<Ps = 4> >> disable transparent print mode (MC4)
- B<< C<Ps = 5> >> enable transparent print mode (MC5) I<unimplemented>
+ B<< C<Ps = 5> >> enable transparent print mode (MC5)
=end table
-=item B<< C<ESC [ Pm h> >>
-
-Set Mode (SM). See next sequence for description of C<Pm>.
-
=item B<< C<ESC [ Pm l> >>
Reset Mode (RM)
B<< C<Ps = 0> >> Normal (default)
B<< C<Ps = 1 / 21> >> On / Off Bold (bright fg)
- B<< C<Ps = 3 / 23> >> On / Off Italic (NYI)
+ B<< C<Ps = 3 / 23> >> On / Off Italic
B<< C<Ps = 4 / 24> >> On / Off Underline
B<< C<Ps = 5 / 25> >> On / Off Slow Blink (bright bg)
B<< C<Ps = 6 / 26> >> On / Off Rapid Blink (bright bg)
- B<< C<Ps = 7 / 27> >> On / Off Invisible (NYI)
- B<< C<Ps = 8 / 27> >> On / Off Inverse
+ B<< C<Ps = 7 / 27> >> On / Off Inverse
+ B<< C<Ps = 8 / 27> >> On / Off Invisible (NYI)
B<< C<Ps = 30 / 40> >> fg/bg Black
B<< C<Ps = 31 / 41> >> fg/bg Red
B<< C<Ps = 32 / 42> >> fg/bg Green
B<< C<Ps = 34 / 44> >> fg/bg Blue
B<< C<Ps = 35 / 45> >> fg/bg Magenta
B<< C<Ps = 36 / 46> >> fg/bg Cyan
+ B<< C<Ps = 38;5 / 48;5> >> set fg/bg to color #m (ISO 8613-6)
B<< C<Ps = 37 / 47> >> fg/bg White
B<< C<Ps = 39 / 49> >> fg/bg Default
B<< C<Ps = 90 / 100> >> fg/bg Bright Black
B<< C<Ps = 50> >> Set fontset to B<< C<Pt> >>, with the following special values of B<< C<Pt> >> (B<rxvt>) B<< C<#+n> >> change up B<< C<n> >> B<< C<#-n> >> change down B<< C<n> >> if B<< C<n> >> is missing of 0, a value of 1 is used I<empty> change to font0 B<< C<n> >> change to font B<< C<n> >>
B<< C<Ps = 55> >> Log all scrollback buffer and all of screen to B<< C<Pt> >>
B<< C<Ps = 701> >> Change current locale to B<< C<Pt> >>, or, if B<< C<Pt> >> is B<< C<?> >>, return the current locale (@@RXVT_NAME@@ extension)
- B<< C<Ps = 702> >> find font for character, used for debugging (@@RXVT_NAME@@ extension)
- B<< C<Ps = 703> >> menubar command B<< C<Pt> >> I<rxvt compile-time option> (@@RXVT_NAME@@ extension)
+ B<< C<Ps = 703> >> Menubar command B<< C<Pt> >> I<rxvt compile-time option> (rxvt-unicode extension)
+ B<< C<Ps = 704> >> Change colour of italic characters to B<< C<Pt> >>
+ B<< C<Ps = 705> >> Change background pixmap tint colour to B<< C<Pt> >>
+ B<< C<Ps = 710> >> Set normal fontset to B<< C<Pt> >>. Same as C<Ps = 50>.
+ B<< C<Ps = 711> >> Set bold fontset to B<< C<Pt> >>. Similar to C<Ps = 50>.
+ B<< C<Ps = 712> >> Set italic fontset to B<< C<Pt> >>. Similar to C<Ps = 50>.
+ B<< C<Ps = 713> >> Set bold-italic fontset to B<< C<Pt> >>. Similar to C<Ps = 50>.
=end table
slower and require lots of memory, but as long as you don't use them, you
don't pay for them.
+=item --enable-font-styles
+
+Add support for B<bold>, I<italic> and B<< I<bold italic> >> font
+styles. The fonts can be set manually or automatically.
+
=item --with-codesets=NAME,...
-Compile in support for additional codeset (encoding) groups. These codeset
-tables are currently only used for driving X11 core fonts, they are not
-required for Xft fonts. Compiling them in will make your binary bigger
-(together about 700kB), but it doesn't increase memory usage unless you
-use an X11 font requiring one of these encodings.
+Compile in support for additional codeset (encoding) groups (eu, vn are
+always compiled in, which includes most 8-bit character sets). These
+codeset tables are currently only used for driving X11 core fonts, they
+are not required for Xft fonts. Compiling them in will make your binary
+bigger (together about 700kB), but it doesn't increase memory usage unless
+you use an X11 font requiring one of these encodings.
=begin table
keys. This should keep in a fixed position the rxvt corner which is
closest to a corner of the screen.
-=item --enable-256-color
-
-Add support for 256 colours rather than the base 16 colours.
-
-This option will likely go away in the future. Speak up if you don't want
-this.
-
=item --enable-cursor-blink
Add support for a blinking cursor.
if (t != NOCHAR || !x)
{
- iso14755_51 (screen.text[y + TermWin.saveLines - TermWin.view_start][x]);
+ iso14755_51 (screen.text[y + TermWin.saveLines - TermWin.view_start][x],
+ screen.rend[y + TermWin.saveLines - TermWin.view_start][x]);
iso14755buf = ISO_14755_54;
break;
}
#if ENABLE_OVERLAY
void
-rxvt_term::iso14755_51 (wchar_t ch)
+rxvt_term::iso14755_51 (unicode_t ch, rend_t r)
{
- wchar_t *chr, *alloc;
+ rxvt_fontset *fs = FONTSET (r);
+ rxvt_font *f = (*fs)[fs->find_font (ch)];
+ wchar_t *chr, *alloc, ch2;
int len;
#if ENABLE_COMBINING
else
#endif
{
+ ch2 = ch;
+
alloc = 0;
- chr = &ch;
+ chr = &ch2;
len = 1;
}
- scr_overlay_new (0, -1, 8 + 5, len);
+ int width = strlen (f->name);
+
+ scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1);
+
+ r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
for (int y = 0; y < len; y++)
{
if (ch >= 0x10000)
ch = 0xfffd;
#endif
- scr_overlay_set (11, y, ch);
- scr_overlay_set (12, y, NOCHAR);
+ scr_overlay_set (11, y, ch, r);
+ scr_overlay_set (12, y, NOCHAR, r);
}
+ scr_overlay_set (0, len, f->name);
+
#if ENABLE_COMBINING
if (alloc)
delete [] alloc;
#ifdef MOUSE_REPORT_DOUBLECLICK
key_state += ((MEvent.clicks > 1) ? 32 : 0);
#endif
-
}
-#ifdef DEBUG_MOUSEREPORT
+#if DEBUG_MOUSEREPORT
fprintf (stderr, "Mouse [");
if (key_state & 16)
fputc ('C', stderr);
button_number,
x + 1,
y + 1);
-#else
+#endif
+
tt_printf ("\033[M%c%c%c",
(32 + button_number + key_state),
(32 + x + 1),
(32 + y + 1));
-#endif
}
#ifdef USING_W11LIB
case KeyRelease:
{
-#if (defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)) || defined (ENABLE_FRILLS)
+#if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ISO_14755
KeySym ks;
ks = XLookupKeysym (&ev.xkey, ev.xkey.state & ShiftMask ? 1 : 0); // sorry, only shift supported :/
if (rs[Rs_fade])
{
pix_colors = pix_colors_focused;
- set_colorfgbg ();
- scr_clear ();
- scr_touch (true);
+ scr_recolour ();
}
#endif
{
TermWin.focus = 0;
want_refresh = 1;
+
+#if ENABLE_FRILLS || ISO_14755
+ iso14755buf = 0;
+#endif
+#if ENABLE_OVERLAY
+ scr_overlay_off ();
+#endif
#ifdef USE_XIM
if (Input_Context != NULL)
XUnsetICFocus (Input_Context);
if (rs[Rs_fade])
{
pix_colors = pix_colors_unfocused;
- set_colorfgbg ();
- scr_clear ();
- scr_touch (true);
+ scr_recolour ();
}
#endif
-
}
break;
while (XCheckTypedWindowEvent (display->display, ev.xconfigure.window, ConfigureNotify, &ev));
if (szHint.width != width || szHint.height != height)
- resize_all_windows (width, height, 1);
+ {
+ seen_resize = 1;
+ resize_all_windows (width, height, 1);
+ }
#ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */
if (options & Opt_transparent)
TermWin.parent[i] = None;
}
- // this is experimental
if (scrollBar.win)
{
XSetWindowBackgroundPixmap (display->display, scrollBar.win, ParentRelative);
- XClearWindow (display->display, scrollBar.win);
scrollBar.setIdle ();
scrollbar_show (0);
}
// they first read the screensize and then install a SIGWINCH handler.
// some window managers resize the window early, and these programs
// then sometimes get the size wrong.
- kill (-cmd_pid, SIGWINCH);
+ // unfortunately other programs are even more buggy and dislike
+ // being sent SIGWINCH, so only do it when we were in fact being
+ // resized.
+ if (seen_resize)
+ kill (-cmd_pid, SIGWINCH);
}
/* Read a text string from the input buffer */
unsigned char *
rxvt_term::get_to_st (unicode_t &ends_how)
{
- unicode_t prev = 0, ch;
+ unicode_t seen_esc = 0, ch;
unsigned int n = 0;
unsigned char *s;
unsigned char string[STRING_MAX];
while ((ch = cmd_getc ()) != NOCHAR)
{
- if (prev == C0_ESC)
+ if (seen_esc)
{
if (ch == 0x5c) /* 7bit ST */
break;
else
return NULL;
}
+ else if (ch == C0_ESC)
+ {
+ seen_esc = 1;
+ continue;
+ }
else if (ch == C0_BEL || ch == CHAR_ST)
break;
else if (ch < 0x20)
return NULL; /* other control character - exit */
+ seen_esc = 0;
+
if (n >= sizeof (string) - 1)
// stop at some sane length
return NULL;
if (ch == C0_SYN)
- {
- string[n++] = cmd_get8 ();
- prev = 0;
- }
+ string[n++] = cmd_get8 ();
else
- string[n++] = prev = ch;
+ string[n++] = ch;
}
string[n++] = '\0';
int color;
char *buf, *name;
bool query = str[0] == '?' && !str[1];
+ int saveop = op;
assert (str != NULL);
switch (op)
case XTerm_Color_BD:
process_color_seq (XTerm_Color_BD, Color_BD, str, resp);
break;
+ case XTerm_Color_IT:
+ process_color_seq (XTerm_Color_IT, Color_IT, str, resp);
+ break;
case XTerm_Color_UL:
process_color_seq (XTerm_Color_UL, Color_UL, str, resp);
break;
process_color_seq (XTerm_Color_RV, Color_RV, str, resp);
break;
#endif
+#if TRANSPARENT || TINTING
+ case XTerm_Color_tint:
+ process_color_seq (XTerm_Color_tint, Color_tint, str, resp);
+ check_our_parents ();
+ if (am_transparent)
+ want_full_refresh = want_refresh = 1;
+ break;
+#endif
case XTerm_Pixmap:
if (*str != ';')
break;
case XTerm_font:
+ op = URxvt_font;
+ case URxvt_font:
+#if ENABLE_STYLES
+ case URxvt_boldFont:
+ case URxvt_italicFont:
+ case URxvt_boldItalicFont:
+#endif
if (query)
- tt_printf ("\33]%d;%-.250s%c", XTerm_font,
- (options & Opt_insecure) && TermWin.fontset->fontdesc
- ? TermWin.fontset->fontdesc : "",
+ tt_printf ("\33]%d;%-.250s%c", saveop,
+ (options & Opt_insecure) && TermWin.fontset[op - URxvt_font]->fontdesc
+ ? TermWin.fontset[op - URxvt_font]->fontdesc : "",
resp);
else
- change_font (str);
+ {
+ const char *&res = rs[Rs_font + (op - URxvt_font)];
+
+ res = strdup (str);
+ allocated.push_back ((void *)res);
+ set_fonts ();
+ }
break;
#if ENABLE_FRILLS
# endif
}
break;
-
- case XTerm_findfont:
- {
- int fid = TermWin.fontset->find_font (atoi (str));
- tt_printf ("\33]%d;%d;%-.250s%c", XTerm_findfont,
- fid,
- (options & Opt_insecure) ? (*TermWin.fontset)[fid]->name : "",
- resp);
- }
- break;
#endif
#ifdef MENUBAR
switch (arg[i])
{
case 1048: /* alternative cursor save */
+ case 1049:
if (options & Opt_secondaryScreen)
if (mode == 0)
scr_cursor (RESTORE);
case 1:
rendset = 1, rendstyle = RS_Bold;
break;
- //case 2: // faint or second colour
- //case 3: // italic
+ //case 2: // low intensity
+ case 3:
+ rendset = 1, rendstyle = RS_Italic;
+ break;
case 4:
rendset = 1, rendstyle = RS_Uline;
break;
//...
//case 19: // ninth alt font
//case 20: // gothic
- case 21: // disable bold, faint
+ case 21: // disable bold, faint, sometimes doubly underlined (iso 8613)
rendset = 0, rendstyle = RS_Bold;
break;
- case 22:
+ case 22: // normal intensity
rendset = 0, rendstyle = RS_Bold;
break;
- //case 23: disable italic
+ case 23: // disable italic
+ rendset = 0, rendstyle = RS_Italic;
+ break;
case 24:
rendset = 0, rendstyle = RS_Uline;
break;
case 25:
rendset = 0, rendstyle = RS_Blink;
break;
- case 26:
+ case 26: // variable spacing (iso 8613)
rendset = 0, rendstyle = RS_Blink;
break;
case 27:
case 37:
scr_color ((unsigned int) (minCOLOR + (arg[i] - 30)), Color_fg);
break;
-#ifdef TTY_256COLOR
- case 38:
+ case 38: // set fg color, ISO 8613-6
if (nargs > i + 2 && arg[i + 1] == 5)
{
scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_fg);
i += 2;
}
break;
-#endif
case 39: /* default fg */
scr_color (Color_fg, Color_fg);
break;
case 47:
scr_color ((unsigned int) (minCOLOR + (arg[i] - 40)), Color_bg);
break;
-#ifdef TTY_256COLOR
- case 48:
+ case 48: // set bg color, ISO 8613-6
if (nargs > i + 2 && arg[i + 1] == 5)
{
scr_color ((unsigned int) (minCOLOR + arg[i + 2]), Color_bg);
i += 2;
}
break;
-#endif
case 49: /* default bg */
scr_color (Color_bg, Color_bg);
break;
+ //case 50: // not variable spacing
+
#ifndef NO_BRIGHTCOLOR
case 90:
case 91: /* set bright fg color */
case 95:
case 96:
case 97:
- scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 90)),
- Color_fg);
+ scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 90)), Color_fg);
break;
case 100:
case 101: /* set bright bg color */
case 105:
case 106:
case 107:
- scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)),
- Color_bg);
+ scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg);
break;
#endif
void
rxvt_term::tt_write (const unsigned char *data, unsigned int len)
{
- enum { MAX_PTY_WRITE = 255 }; // minimum MAX_INPUT
+ const unsigned int MAX_PTY_WRITE = 255; // minimum MAX_INPUT
if (len)
{
for (;;)
{
- int written = write (pty.pty, v_buffer, min (MAX_PTY_WRITE, v_buflen));
+ int written = write (pty.pty, v_buffer, min (v_buflen, MAX_PTY_WRITE));
if (written > 0)
{
"Magenta", /* 5/13: bright magenta (#FF00FF) */
"Cyan", /* 6/14: bright cyan (#00FFFF) */
"White", /* 7/15: bright white (#FFFFFF) */
-#ifdef TTY_256COLOR
- "rgbi:0/0/0", /* default 16-255 color table */
- "rgbi:0/0/.2", /* consists of 6 6x6 colour cubes */
- "rgbi:0/0/.4", /* and a 24 greyscale ramp w/o */
- "rgbi:0/0/.6", /* black or white */
- "rgbi:0/0/.8",
- "rgbi:0/0/1",
- "rgbi:0/.2/0",
- "rgbi:0/.2/.2",
- "rgbi:0/.2/.4",
- "rgbi:0/.2/.6",
- "rgbi:0/.2/.8",
- "rgbi:0/.2/1",
- "rgbi:0/.4/0",
- "rgbi:0/.4/.2",
- "rgbi:0/.4/.4",
- "rgbi:0/.4/.6",
- "rgbi:0/.4/.8",
- "rgbi:0/.4/1",
- "rgbi:0/.6/0",
- "rgbi:0/.6/.2",
- "rgbi:0/.6/.4",
- "rgbi:0/.6/.6",
- "rgbi:0/.6/.8",
- "rgbi:0/.6/1",
- "rgbi:0/.8/0",
- "rgbi:0/.8/.2",
- "rgbi:0/.8/.4",
- "rgbi:0/.8/.6",
- "rgbi:0/.8/.8",
- "rgbi:0/.8/1",
- "rgbi:0/1/0",
- "rgbi:0/1/.2",
- "rgbi:0/1/.4",
- "rgbi:0/1/.6",
- "rgbi:0/1/.8",
- "rgbi:0/1/1",
- "rgbi:.2/0/0",
- "rgbi:.2/0/.2",
- "rgbi:.2/0/.4",
- "rgbi:.2/0/.6",
- "rgbi:.2/0/.8",
- "rgbi:.2/0/1",
- "rgbi:.2/.2/0",
- "rgbi:.2/.2/.2",
- "rgbi:.2/.2/.4",
- "rgbi:.2/.2/.6",
- "rgbi:.2/.2/.8",
- "rgbi:.2/.2/1",
- "rgbi:.2/.4/0",
- "rgbi:.2/.4/.2",
- "rgbi:.2/.4/.4",
- "rgbi:.2/.4/.6",
- "rgbi:.2/.4/.8",
- "rgbi:.2/.4/1",
- "rgbi:.2/.6/0",
- "rgbi:.2/.6/.2",
- "rgbi:.2/.6/.4",
- "rgbi:.2/.6/.6",
- "rgbi:.2/.6/.8",
- "rgbi:.2/.6/1",
- "rgbi:.2/.8/0",
- "rgbi:.2/.8/.2",
- "rgbi:.2/.8/.4",
- "rgbi:.2/.8/.6",
- "rgbi:.2/.8/.8",
- "rgbi:.2/.8/1",
- "rgbi:.2/1/0",
- "rgbi:.2/1/.2",
- "rgbi:.2/1/.4",
- "rgbi:.2/1/.6",
- "rgbi:.2/1/.8",
- "rgbi:.2/1/1",
- "rgbi:.4/0/0",
- "rgbi:.4/0/.2",
- "rgbi:.4/0/.4",
- "rgbi:.4/0/.6",
- "rgbi:.4/0/.8",
- "rgbi:.4/0/1",
- "rgbi:.4/.2/0",
- "rgbi:.4/.2/.2",
- "rgbi:.4/.2/.4",
- "rgbi:.4/.2/.6",
- "rgbi:.4/.2/.8",
- "rgbi:.4/.2/1",
- "rgbi:.4/.4/0",
- "rgbi:.4/.4/.2",
- "rgbi:.4/.4/.4",
- "rgbi:.4/.4/.6",
- "rgbi:.4/.4/.8",
- "rgbi:.4/.4/1",
- "rgbi:.4/.6/0",
- "rgbi:.4/.6/.2",
- "rgbi:.4/.6/.4",
- "rgbi:.4/.6/.6",
- "rgbi:.4/.6/.8",
- "rgbi:.4/.6/1",
- "rgbi:.4/.8/0",
- "rgbi:.4/.8/.2",
- "rgbi:.4/.8/.4",
- "rgbi:.4/.8/.6",
- "rgbi:.4/.8/.8",
- "rgbi:.4/.8/1",
- "rgbi:.4/1/0",
- "rgbi:.4/1/.2",
- "rgbi:.4/1/.4",
- "rgbi:.4/1/.6",
- "rgbi:.4/1/.8",
- "rgbi:.4/1/1",
- "rgbi:.6/0/0",
- "rgbi:.6/0/.2",
- "rgbi:.6/0/.4",
- "rgbi:.6/0/.6",
- "rgbi:.6/0/.8",
- "rgbi:.6/0/1",
- "rgbi:.6/.2/0",
- "rgbi:.6/.2/.2",
- "rgbi:.6/.2/.4",
- "rgbi:.6/.2/.6",
- "rgbi:.6/.2/.8",
- "rgbi:.6/.2/1",
- "rgbi:.6/.4/0",
- "rgbi:.6/.4/.2",
- "rgbi:.6/.4/.4",
- "rgbi:.6/.4/.6",
- "rgbi:.6/.4/.8",
- "rgbi:.6/.4/1",
- "rgbi:.6/.6/0",
- "rgbi:.6/.6/.2",
- "rgbi:.6/.6/.4",
- "rgbi:.6/.6/.6",
- "rgbi:.6/.6/.8",
- "rgbi:.6/.6/1",
- "rgbi:.6/.8/0",
- "rgbi:.6/.8/.2",
- "rgbi:.6/.8/.4",
- "rgbi:.6/.8/.6",
- "rgbi:.6/.8/.8",
- "rgbi:.6/.8/1",
- "rgbi:.6/1/0",
- "rgbi:.6/1/.2",
- "rgbi:.6/1/.4",
- "rgbi:.6/1/.6",
- "rgbi:.6/1/.8",
- "rgbi:.6/1/1",
- "rgbi:.8/0/0",
- "rgbi:.8/0/.2",
- "rgbi:.8/0/.4",
- "rgbi:.8/0/.6",
- "rgbi:.8/0/.8",
- "rgbi:.8/0/1",
- "rgbi:.8/.2/0",
- "rgbi:.8/.2/.2",
- "rgbi:.8/.2/.4",
- "rgbi:.8/.2/.6",
- "rgbi:.8/.2/.8",
- "rgbi:.8/.2/1",
- "rgbi:.8/.4/0",
- "rgbi:.8/.4/.2",
- "rgbi:.8/.4/.4",
- "rgbi:.8/.4/.6",
- "rgbi:.8/.4/.8",
- "rgbi:.8/.4/1",
- "rgbi:.8/.6/0",
- "rgbi:.8/.6/.2",
- "rgbi:.8/.6/.4",
- "rgbi:.8/.6/.6",
- "rgbi:.8/.6/.8",
- "rgbi:.8/.6/1",
- "rgbi:.8/.8/0",
- "rgbi:.8/.8/.2",
- "rgbi:.8/.8/.4",
- "rgbi:.8/.8/.6",
- "rgbi:.8/.8/.8",
- "rgbi:.8/.8/1",
- "rgbi:.8/1/0",
- "rgbi:.8/1/.2",
- "rgbi:.8/1/.4",
- "rgbi:.8/1/.6",
- "rgbi:.8/1/.8",
- "rgbi:.8/1/1",
- "rgbi:1/0/0",
- "rgbi:1/0/.2",
- "rgbi:1/0/.4",
- "rgbi:1/0/.6",
- "rgbi:1/0/.8",
- "rgbi:1/0/1",
- "rgbi:1/.2/0",
- "rgbi:1/.2/.2",
- "rgbi:1/.2/.4",
- "rgbi:1/.2/.6",
- "rgbi:1/.2/.8",
- "rgbi:1/.2/1",
- "rgbi:1/.4/0",
- "rgbi:1/.4/.2",
- "rgbi:1/.4/.4",
- "rgbi:1/.4/.6",
- "rgbi:1/.4/.8",
- "rgbi:1/.4/1",
- "rgbi:1/.6/0",
- "rgbi:1/.6/.2",
- "rgbi:1/.6/.4",
- "rgbi:1/.6/.6",
- "rgbi:1/.6/.8",
- "rgbi:1/.6/1",
- "rgbi:1/.8/0",
- "rgbi:1/.8/.2",
- "rgbi:1/.8/.4",
- "rgbi:1/.8/.6",
- "rgbi:1/.8/.8",
- "rgbi:1/.8/1",
- "rgbi:1/1/0",
- "rgbi:1/1/.2",
- "rgbi:1/1/.4",
- "rgbi:1/1/.6",
- "rgbi:1/1/.8",
- "rgbi:1/1/1",
- "rgb:08/08/08",
- "rgb:12/12/12",
- "rgb:1c/1c/1c",
- "rgb:26/26/26",
- "rgb:30/30/30",
- "rgb:3a/3a/3a",
- "rgb:44/44/44",
- "rgb:4e/4e/4e",
- "rgb:58/58/58",
- "rgb:62/62/62",
- "rgb:6c/6c/6c",
- "rgb:76/76/76",
- "rgb:80/80/80",
- "rgb:8a/8a/8a",
- "rgb:94/94/94",
- "rgb:9e/9e/9e",
- "rgb:a8/a8/a8",
- "rgb:b2/b2/b2",
- "rgb:bc/bc/bc",
- "rgb:c6/c6/c6",
+
+ // 88 xterm colours
+ "rgb:00/00/00",
+ "rgb:00/00/8b",
+ "rgb:00/00/cd",
+ "rgb:00/00/ff",
+ "rgb:00/8b/00",
+ "rgb:00/8b/8b",
+ "rgb:00/8b/cd",
+ "rgb:00/8b/ff",
+ "rgb:00/cd/00",
+ "rgb:00/cd/8b",
+ "rgb:00/cd/cd",
+ "rgb:00/cd/ff",
+ "rgb:00/ff/00",
+ "rgb:00/ff/8b",
+ "rgb:00/ff/cd",
+ "rgb:00/ff/ff",
+ "rgb:8b/00/00",
+ "rgb:8b/00/8b",
+ "rgb:8b/00/cd",
+ "rgb:8b/00/ff",
+ "rgb:8b/8b/00",
+ "rgb:8b/8b/8b",
+ "rgb:8b/8b/cd",
+ "rgb:8b/8b/ff",
+ "rgb:8b/cd/00",
+ "rgb:8b/cd/8b",
+ "rgb:8b/cd/cd",
+ "rgb:8b/cd/ff",
+ "rgb:8b/ff/00",
+ "rgb:8b/ff/8b",
+ "rgb:8b/ff/cd",
+ "rgb:8b/ff/ff",
+ "rgb:cd/00/00",
+ "rgb:cd/00/8b",
+ "rgb:cd/00/cd",
+ "rgb:cd/00/ff",
+ "rgb:cd/8b/00",
+ "rgb:cd/8b/8b",
+ "rgb:cd/8b/cd",
+ "rgb:cd/8b/ff",
+ "rgb:cd/cd/00",
+ "rgb:cd/cd/8b",
+ "rgb:cd/cd/cd",
+ "rgb:cd/cd/ff",
+ "rgb:cd/ff/00",
+ "rgb:cd/ff/8b",
+ "rgb:cd/ff/cd",
+ "rgb:cd/ff/ff",
+ "rgb:ff/00/00",
+ "rgb:ff/00/8b",
+ "rgb:ff/00/cd",
+ "rgb:ff/00/ff",
+ "rgb:ff/8b/00",
+ "rgb:ff/8b/8b",
+ "rgb:ff/8b/cd",
+ "rgb:ff/8b/ff",
+ "rgb:ff/cd/00",
+ "rgb:ff/cd/8b",
+ "rgb:ff/cd/cd",
+ "rgb:ff/cd/ff",
+ "rgb:ff/ff/00",
+ "rgb:ff/ff/8b",
+ "rgb:ff/ff/cd",
+ "rgb:ff/ff/ff",
+ "rgb:2e/2e/2e",
+ "rgb:5c/5c/5c",
+ "rgb:73/73/73",
+ "rgb:8b/8b/8b",
+ "rgb:a2/a2/a2",
+ "rgb:b9/b9/b9",
"rgb:d0/d0/d0",
- "rgb:da/da/da",
- "rgb:e4/e4/e4",
- "rgb:ee/ee/ee",
-#endif
+ "rgb:e7/e7/e7",
+
#ifndef NO_CURSORCOLOR
COLOR_CURSOR_BACKGROUND,
COLOR_CURSOR_FOREGROUND,
NULL, /* Color_border */
#ifndef NO_BOLD_UNDERLINE_REVERSE
NULL, /* Color_BD */
+ NULL, /* Color_IT */
NULL, /* Color_UL */
NULL, /* Color_RV */
#endif /* ! NO_BOLD_UNDERLINE_REVERSE */
TermWin.saveLines = SAVELINES;
numpix_colors = TOTAL_COLORS;
-#ifndef NO_BRIGHTCOLOR
- colorfgbg = DEFAULT_RSTYLE;
-#endif
-
refresh_limit = 1;
refresh_type = SLOW_REFRESH;
prev_nrow = prev_ncol = 0;
}
#ifdef HAVE_SCROLLBARS
- setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle],
- rs[Rs_scrollBar_thickness]);
+ setup_scrollbar (rs[Rs_scrollBar_align], rs[Rs_scrollstyle], rs[Rs_scrollBar_thickness]);
#endif
#ifdef XTERM_REVERSE_VIDEO
color_aliases (Color_RV);
#endif /* ! NO_BOLD_UNDERLINE_REVERSE */
+ if (!rs[Rs_color + Color_border])
+ rs[Rs_color + Color_border] = rs[Rs_color + Color_bg];
+
return cmd_argv;
}
rs[Rs_color + idx] = rs[Rs_color + minBrightCOLOR + i];
return;
#endif
-
}
if (i >= 0 && i <= 7) /* normal colors */
/* grab colors before netscape does */
Get_Colours ();
- if (!change_font (rs[Rs_font]))
- {
- fprintf (stderr, "unable to load a base font, please provide one using -fn fontname\n");
- destroy ();
- return;
- }
+ if (!set_fonts ())
+ rxvt_fatal ("unable to load base fontset, please specify one using -fn, aborting.\n");
window_calc (0, 0);
old_width = szHint.width;
/* sub-window placement & size in rxvt_resize_subwindows () */
#ifdef PREFER_24BIT
- attributes.background_pixel = pix_colors[Color_bg];
- attributes.border_pixel = pix_colors[Color_border];
+ attributes.background_pixel = pix_colors_focused[Color_border];
+ attributes.border_pixel = pix_colors_focused[Color_border];
attributes.colormap = display->cmap;
TermWin.parent[0] = XCreateWindow (display->display, DefaultRootWindow (display->display),
szHint.x, szHint.y,
szHint.x, szHint.y,
szHint.width, szHint.height,
TermWin.ext_bwidth,
- pix_colors[Color_border],
- pix_colors[Color_bg]);
+ pix_colors_focused[Color_border],
+ pix_colors_focused[Color_border]);
#endif
process_xterm_seq (XTerm_title, rs[Rs_title], CHAR_ST);
XSelectInput (display->display, TermWin.parent[0],
KeyPressMask
-#if defined(MOUSE_WHEEL) && defined(MOUSE_SLIP_WHEELING)
+#if (MOUSE_WHEEL && MOUSE_SLIP_WHEELING) || ENABLE_FRILLS || ISO_14755
| KeyReleaseMask
#endif
| FocusChangeMask | VisibilityChangeMask
#if ENABLE_FRILLS
if (mwmhints.flags)
{
- prop = XInternAtom(display->display, "_MOTIF_WM_HINTS", False);
- XChangeProperty(display->display, TermWin.parent[0], prop, prop, 32, PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS);
+ prop = XInternAtom (display->display, "_MOTIF_WM_HINTS", False);
+ XChangeProperty (display->display, TermWin.parent[0], prop, prop, 32, PropModeReplace, (unsigned char *) &mwmhints, PROP_MWM_HINTS_ELEMENTS);
}
#endif
TermWin_TotalWidth (),
TermWin_TotalHeight (),
0,
- pix_colors[Color_fg],
- pix_colors[Color_bg]);
+ pix_colors_focused[Color_fg],
+ pix_colors_focused[Color_bg]);
#ifdef DEBUG_X
XStoreName (display->display, TermWin.vt, "vt window");
#endif
TermWin_TotalWidth (),
menuBar_TotalHeight (),
0,
- pix_colors[Color_fg],
- pix_colors[Color_scroll]);
+ pix_colors_focused[Color_fg],
+ pix_colors_focused[Color_scroll]);
#ifdef DEBUG_X
XStoreName (display->display, menuBar.win, "menubar");
p++;
scale_pixmap (p);
}
+
set_bgPixmap (rs[Rs_backgroundPixmap]);
- scr_touch (True);
+ scr_touch (true);
}
#endif
if (rs[Rs_fade])
pix_colors = pix_colors_unfocused;
#endif
+
+ scr_recolour ();
}
/* ------------------------------------------------------------------------- *
/* If we're using either the rxvt scrollbar or menu bars, keep the
* scrollColor resource.
*/
-#if defined(RXVT_SCROLLBAR) || defined(MENUBAR)
+#if defined(RXVT_SCROLLBAR) || defined(MENUBAR) || defined(PLAIN_SCROLLBAR)
# define KEEP_SCROLLCOLOR 1
#else
# undef KEEP_SCROLLCOLOR
# define COLORTERMENVFULL COLORTERMENV
#endif
#ifndef TERMENV
-# define TERMENV "rxvt"
+# define TERMENV "rxvt-unicode"
#endif
#if defined (NO_MOUSE_REPORT) && !defined (NO_MOUSE_REPORT_SCROLLBAR)
#define RS_None 0 /* Normal */
-#define RS_fgMask 0x000001FFUL /* 512 colors */
-#define RS_bgMask 0x0003FE00UL /* 512 colors */
-#define RS_Bold 0x00040000UL /* bold */
-#define RS_Italic 0x00080000UL
-#define RS_Blink 0x00100000UL /* blink */
-#define RS_RVid 0x00200000UL /* reverse video */
-#define RS_Uline 0x00400000UL /* underline */
+#define RS_fgMask 0x0000007fUL /* 128 colors */
+#define RS_bgMask 0x00003f80UL /* 128 colors */
-#define RS_fontCount 512
-#define RS_fontMask 0xff800000UL /* plenty(?) of fonts */
-#define RS_fontShift 23
+// font styles
+#define RS_Bold 0x00004000UL // value 1
+#define RS_Italic 0x00008000UL // value 2
-#define RS_baseattrMask (RS_Bold|RS_Blink|RS_RVid|RS_Uline)
-#define RS_attrMask (RS_baseattrMask|RS_fontMask)
+// fake styles
+#define RS_Blink 0x00010000UL /* blink */
+#define RS_RVid 0x00020000UL /* reverse video */
+#define RS_Uline 0x00040000UL /* underline */
+
+// 5 bits still to go
+
+// other flags
+#define RS_Careful 0x80000000UL /* be careful when drawing these */
+
+#define RS_styleCount 4
+#define RS_styleMask (RS_Bold | RS_Italic)
+#define RS_styleShift 14
+
+#define RS_baseattrMask (RS_Italic | RS_Bold | RS_Blink | RS_RVid | RS_Uline)
+#define RS_attrMask (RS_baseattrMask | RS_fontMask)
+
+#define RS_fontCount 127 // not 127 or 256, see rxvtfont.h
+#define RS_fontMask 0xff000000UL // plenty(?) of fonts, includes RS_Careful
+#define RS_fontShift 24
+
+#define DEFAULT_RSTYLE (RS_None | Color_fg | (Color_bg << Color_Bits))
+#define OVERLAY_RSTYLE (RS_None | Color_Black | (Color_Yellow << Color_Bits))
#define Sel_none 0 /* Not waiting */
#define Sel_normal 0x01 /* normal selection */
XTerm_restoreBG = 49, // change default bg color
XTerm_dumpscreen = 55, // dump scrollback and all of screen
XTerm_locale = 701, // change locale
- XTerm_findfont = 702, // find font of given character (in decimal)
XTerm_Menu = 703, // set menu item
+ XTerm_Color_IT = 704, // change actual 'Italic' colour
+ XTerm_Color_tint = 705, // change actual tint colour
+
+ URxvt_font = 710,
+ URxvt_boldFont = 711,
+ URxvt_italicFont = 712,
+ URxvt_boldItalicFont = 713,
};
/* Words starting with `Color_' are colours. Others are counts */
#else
Color_White = maxCOLOR,
#endif
-#ifdef TTY_256COLOR
- min256COLOR = Color_White + 1,
- max256COLOR = minCOLOR + 255,
-#endif
+ minTermCOLOR = Color_White + 1,
+ maxTermCOLOR = Color_White + 72,
#ifndef NO_CURSORCOLOR
Color_cursor,
Color_cursor2,
Color_border,
#ifndef NO_BOLD_UNDERLINE_REVERSE
Color_BD,
+ Color_IT,
Color_UL,
Color_RV,
#endif
#ifdef KEEP_SCROLLCOLOR
Color_topShadow = NRS_COLORS,
Color_bottomShadow,
- TOTAL_COLORS /* upto 30 */
+ TOTAL_COLORS
#else
- TOTAL_COLORS = NRS_COLORS /* */
+ TOTAL_COLORS = NRS_COLORS
#endif
};
-#define Color_Bits 9
+#define Color_Bits 7 // 0 .. maxTermCOLOR
+
#define NPIXCLR_SETS ((TOTAL_COLORS + 31) / 32)
#define NPIXCLR_BITS 32
-#define DEFAULT_RSTYLE (RS_None | (Color_fg) | (Color_bg<<Color_Bits))
-
/*
* Resource list
*/
Rs_color,
_Rs_color = Rs_color + NRS_COLORS - 1,
Rs_font,
+#if ENABLE_STYLES
+ Rs_boldFont,
+ Rs_italicFont,
+ Rs_boldItalicFont,
+#endif
Rs_name,
Rs_title,
#if defined (XPM_BACKGROUND) || (MENUBAR_MAX)
Rs_secondaryScreen,
Rs_secondaryScroll,
#endif
-#ifndef NO_BOLD_UNDERLINE_REVERSE
- Rs_realBold,
-#endif
#ifdef OFF_FOCUS_FADING
Rs_fade,
#endif
#endif
#define GET_FONT(x) (((x) & RS_fontMask) >> RS_fontShift)
-#define SET_FONT(x,fid) ((x) & ~RS_fontMask) | ((fid) << RS_fontShift)
+#define SET_FONT(x,fid) (((x) & ~RS_fontMask) | ((fid) << RS_fontShift))
+
+#define GET_STYLE(x) (((x) & RS_styleMask) >> RS_styleShift)
+#define SET_STYLE(x,style) (((x) & ~RS_styleMask) | ((style) << RS_styleShift))
#define GET_ATTR(x) (((x) & RS_attrMask))
#define GET_BGATTR(x) \
(((x) & RS_RVid) ? (((x) & (RS_attrMask & ~RS_RVid)) \
| (((x) & RS_fgMask)<<Color_Bits)) \
: ((x) & (RS_attrMask | RS_bgMask)))
-#define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | (fg))
-#define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg)<<Color_Bits))
-#define SET_ATTR(x,a) (((x) & ~RS_attrMask)| (a))
+#define SET_FGCOLOR(x,fg) (((x) & ~RS_fgMask) | (fg))
+#define SET_BGCOLOR(x,bg) (((x) & ~RS_bgMask) | ((bg)<<Color_Bits))
+#define SET_ATTR(x,a) (((x) & ~RS_attrMask) | (a))
+
+#define RS_SAME(a,b) (!(((a) ^ (b)) & ~RS_Careful))
#define SET_PIXCOLOR(x) (pixcolor_set[(x) / NPIXCLR_BITS] |= (1 << ((x) % NPIXCLR_BITS)))
#define ISSET_PIXCOLOR(x) (pixcolor_set[(x) / NPIXCLR_BITS] & (1 << ((x) % NPIXCLR_BITS)))
+#if ENABLE_STYLES
+# define FONTSET(style) TermWin.fontset[GET_STYLE (style)]
+#else
+# define FONTSET(style) TermWin.fontset[0]
+#endif
+
#ifdef HAVE_SCROLLBARS
# define scrollbar_TotalWidth() (scrollBar.width + sb_shadow * 2)
#else
#endif
-struct rxvt_term : rxvt_vars {
+struct rxvt_term : zero_initialized, rxvt_vars {
log_callback *log_hook; // log error messages through this hook, if != 0
struct mbstate mbstate; // current input multibyte state
#endif
// enc_utf8:1, /* wether terminal reads/writes utf-8 */
seen_input:1, /* wether we have seen some program output yet */
+ seen_resize:1, /* wether we had a resize event */
parsed_geometry:1;
unsigned char refresh_type,
/* ---------- */
unsigned int ModMetaMask,
ModNumLockMask,
-#ifndef NO_BRIGHTCOLOR
- colorfgbg,
-#endif
old_width, /* last used width in screen resize */
old_height; /* last used height in screen resize */
unsigned long priv_modes,
void scr_overlay_off ();
void scr_overlay_set (int x, int y,
text_t text,
- rend_t rend = SET_BGCOLOR (SET_FGCOLOR (RS_None, Color_bg), Color_fg));
+ rend_t rend = OVERLAY_RSTYLE);
void scr_overlay_set (int x, int y, const char *s);
#endif
void commit_iso14755 ();
int hex_keyval (XKeyEvent &ev);
# if ISO_14755
- void iso14755_51 (wchar_t ch);
+ void iso14755_51 (unicode_t ch, rend_t r = DEFAULT_RSTYLE);
void iso14755_54 (int x, int y);
# endif
#endif
bool pty_fill ();
- void *operator new (size_t s);
- void operator delete (void *p, size_t s);
-
void init_secondary ();
const char **init_resources (int argc, const char *const *argv);
void init_env ();
void cleanutent ();
// main.C
void privileged_utmp (rxvt_privaction action);
- bool change_font (const char *fontname);
- bool font_up_down (int n, int direction);
+ bool set_fonts ();
void set_title (const char *str);
void set_icon_name (const char *str);
void set_window_color (int idx, const char *color);
void scr_erase_screen (int mode);
void scr_touch (bool refresh);
void scr_expose (int x, int y, int width, int height, bool refresh);
+ rxvt_fontset *scr_find_fontset (rend_t r = DEFAULT_RSTYLE);
+ void scr_recolour ();
void scr_remap_chars ();
void scr_remap_chars (text_t *tp, rend_t *rp);
void scr_rendition (int set, int style);
void scr_add_lines (const unicode_t *str, int nlines, int len);
void scr_backspace ();
- void scr_tab (int count);
+ void scr_tab (int count, bool ht = false);
void scr_backindex ();
void scr_forwardindex ();
void scr_gotorc (int row, int col, int relative);
void scr_charset_set (int set, unsigned int ch);
int scr_move_to (int y, int len);
int scr_page (enum page_dirn direction, int nlines);
- int scr_changeview (uint16_t oldviewstart);
+ int scr_changeview (unsigned int oldviewstart);
void scr_bell ();
void scr_printscreen (int fullhist);
void scr_reverse_selection ();
*/
typedef struct {
- uint16_t width; /* window width [pixels] */
- uint16_t height; /* window height [pixels] */
- uint16_t fwidth; /* font width [pixels] */
- uint16_t fheight; /* font height [pixels] */
- uint16_t fbase; /* font ascent (baseline) [pixels] */
- uint16_t propfont; /* font proportional flags */
- uint16_t ncol; /* window columns [characters] */
- uint16_t nrow; /* window rows [characters] */
- uint16_t focus; /* window has focus */
- uint16_t mapped; /* window state mapped? */
- uint16_t int_bwidth; /* internal border width */
- uint16_t ext_bwidth; /* external border width */
- uint16_t lineSpace; /* number of extra pixels between rows */
- uint16_t saveLines; /* number of lines that fit in scrollback */
- uint16_t nscrolled; /* number of line actually scrolled */
- uint16_t view_start; /* scrollback view starts here */
+ unsigned int width; /* window width [pixels] */
+ unsigned int height; /* window height [pixels] */
+ unsigned int fwidth; /* font width [pixels] */
+ unsigned int fheight; /* font height [pixels] */
+ unsigned int fweight, fslant;
+ unsigned int fbase; /* font ascent (baseline) [pixels] */
+ unsigned int ncol; /* window columns [characters] */
+ unsigned int nrow; /* window rows [characters] */
+ unsigned int focus; /* window has focus */
+ unsigned int mapped; /* window state mapped? */
+ unsigned int int_bwidth; /* internal border width */
+ unsigned int ext_bwidth; /* external border width */
+ unsigned int lineSpace; /* number of extra pixels between rows */
+ unsigned int saveLines; /* number of lines that fit in scrollback */
+ unsigned int nscrolled; /* number of line actually scrolled */
+ unsigned int view_start; /* scrollback view starts here */
Window parent[6]; /* parent identifiers - we're parent[0] */
Window vt; /* vt100 window */
GC gc; /* GC for drawing */
Pixmap pixmap;
- rxvt_fontset *fontset;
rxvt_drawable *drawable;
- uint16_t ascii_map[0x7f - 0x20]; // map ascii chars to fonts for speed
+ rxvt_fontset *fontset[4];
} TermWin_t;
/*
text_t **text; /* _all_ the text */
rend_t **rend; /* rendition, uses RS_ flags */
row_col_t cur; /* cursor position on the screen */
- uint16_t tscroll; /* top of settable scroll region */
- uint16_t bscroll; /* bottom of settable scroll region */
- uint16_t charset; /* character set number [0..3] */
+ unsigned int tscroll; /* top of settable scroll region */
+ unsigned int bscroll; /* bottom of settable scroll region */
+ unsigned int charset; /* character set number [0..3] */
unsigned int flags; /* see below */
row_col_t s_cur; /* saved cursor position */
- uint16_t s_charset; /* saved character set number [0..3] */
+ unsigned int s_charset; /* saved character set number [0..3] */
char s_charset_char;
rend_t s_rstyle; /* saved rendition style */
} screen_t;
typedef struct {
wchar_t *text; /* selected text */
- uint32_t len; /* length of selected text */
- short screen; /* screen being used */
- short clicks; /* number of clicks */
+ unsigned int len; /* length of selected text */
+ unsigned int screen; /* screen being used */
+ unsigned int clicks; /* number of clicks */
selection_op_t op; /* current operation */
row_col_t beg; /* beginning of selection <= mark */
row_col_t mark; /* point of initial click <= end */
#define Opt_scrollTtyKeypress (1UL<<12)
#define Opt_transparent (1UL<<13)
#define Opt_transparent_all (1UL<<14)
-#define Opt_realBold (1UL<<15)
-#define Opt_tripleclickwords (1UL<<16)
-#define Opt_scrollWithBuffer (1UL<<17)
-#define Opt_jumpScroll (1UL<<18)
-#define Opt_mouseWheelScrollPage (1UL<<19)
-#define Opt_pointerBlank (1UL<<20)
-#define Opt_cursorBlink (1UL<<21)
-#define Opt_secondaryScreen (1UL<<22)
-#define Opt_secondaryScroll (1UL<<23)
+#define Opt_tripleclickwords (1UL<<15)
+#define Opt_scrollWithBuffer (1UL<<16)
+#define Opt_jumpScroll (1UL<<17)
+#define Opt_mouseWheelScrollPage (1UL<<18)
+#define Opt_pointerBlank (1UL<<19)
+#define Opt_cursorBlink (1UL<<20)
+#define Opt_secondaryScreen (1UL<<21)
+#define Opt_secondaryScroll (1UL<<22)
#if ENABLE_FRILLS
-# define Opt_insecure (1UL<<24) // insecure esc sequences
-# define Opt_borderLess (1UL<<25) // mem borderless hints
+# define Opt_insecure (1UL<<23) // insecure esc sequences
+# define Opt_borderLess (1UL<<24) // mem borderless hints
#else
# define Opt_insecure 0
# define Opt_borderLess 0
typedef struct {
char state; /* scrollbar state */
char init; /* scrollbar has been initialised */
- short beg; /* slider sub-window begin height */
- short end; /* slider sub-window end height */
- short top; /* slider top position */
- short bot; /* slider bottom position */
- short style; /* style: rxvt, xterm, next */
- short width; /* scrollbar width */
+ unsigned int beg; /* slider sub-window begin height */
+ unsigned int end; /* slider sub-window end height */
+ unsigned int top; /* slider top position */
+ unsigned int bot; /* slider bottom position */
+ unsigned int style; /* style: rxvt, xterm, next */
+ unsigned int width; /* scrollbar width */
Window win;
int (rxvt_term::*update)(int, int, int, int);
*/
#include "../config.h" /* NECESSARY */
-#define INTERN_SCREEN
#include "rxvt.h" /* NECESSARY */
#include <X11/Xmd.h> /* get the typedef for CARD32 */
/* ------------------------------------------------------------------------- *
* SCREEN `COMMON' ROUTINES *
* ------------------------------------------------------------------------- */
+
/* Fill part/all of a line with blanks. */
void
rxvt_term::scr_blank_line (text_t *et, rend_t *er, unsigned int width, rend_t efs)
{
efs &= ~RS_baseattrMask;
- efs = SET_FONT (efs, TermWin.ascii_map [' ' - 0x20]);
+ efs = SET_FONT (efs, FONTSET (efs)->find_font (' '));
while (width--)
{
void
rxvt_term::scr_reset_realloc ()
{
- uint16_t total_rows, nrow;
+ unsigned int total_rows, nrow;
nrow = TermWin.nrow;
total_rows = nrow + TermWin.saveLines;
void
rxvt_term::scr_release ()
{
- uint16_t total_rows;
+ unsigned int total_rows;
int i;
total_rows = TermWin.nrow + TermWin.saveLines;
switch (mode)
{
case SAVE:
- s->s_cur.row = s->cur.row;
- s->s_cur.col = s->cur.col;
+ s->s_cur.row = screen.cur.row;
+ s->s_cur.col = screen.cur.col;
s->s_rstyle = rstyle;
- s->s_charset = s->charset;
- s->s_charset_char = charsets[s->charset];
+ s->s_charset = screen.charset;
+ s->s_charset_char = charsets[screen.charset];
break;
case RESTORE:
want_refresh = 1;
- s->cur.row = s->s_cur.row;
- s->cur.col = s->s_cur.col;
- s->flags &= ~Screen_WrapNext;
+ screen.cur.row = s->s_cur.row;
+ screen.cur.col = s->s_cur.col;
+ screen.flags &= ~Screen_WrapNext;
rstyle = s->s_rstyle;
- s->charset = s->s_charset;
- charsets[s->charset] = s->s_charset_char;
+ screen.charset = s->s_charset;
+ charsets[screen.charset] = s->s_charset_char;
set_font_style ();
break;
}
void
rxvt_term::scr_color (unsigned int color, int fgbg)
{
- color &= RS_fgMask;
+ if (color > maxTermCOLOR)
+ color = fgbg;
+
if (fgbg == Color_fg)
rstyle = SET_FGCOLOR (rstyle, color);
else
if (nscrolled > (long)TermWin.saveLines)
TermWin.nscrolled = TermWin.saveLines;
else
- TermWin.nscrolled = (uint16_t)nscrolled;
+ TermWin.nscrolled = (unsigned int)nscrolled;
if ((options & Opt_scrollWithBuffer)
&& TermWin.view_start != 0
switch (c)
{
case C0_HT:
- scr_tab (1);
+ scr_tab (1, true);
continue;
case C0_LF:
if (charsets[screen.charset] == '0') // DEC SPECIAL
{
// vt100 special graphics and line drawing
- static uint16_t vt100_0[32] = { // 5f .. 7e
- 0x0020, 0x25c6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0,
- 0x00b1, 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c,
- 0x23ba, 0x23bb, 0x2500, 0x23bc, 0x23bd, 0x251c, 0x2524, 0x2534,
- 0x252c, 0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, 0x00b7,
+ // 5f-7e standard vt100
+ // 40-5e rxvt extension for extra curses acs chars
+ static uint16_t vt100_0[63] = { // 5f .. 7e
+ 0x0000, 0x2191, 0x2193, 0x2192, 0x2190, 0x2588, 0x259a, 0x2603, // 40-47 hi mr. snowman!
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 48-4f
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, // 50-57
+ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0020, // 58-5f
+ 0x25c6, 0x2592, 0x2409, 0x240c, 0x240d, 0x240a, 0x00b0, 0x00b1, // 60-67
+ 0x2424, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x23ba, // 68-6f
+ 0x23bb, 0x2500, 0x23bc, 0x23bd, 0x251c, 0x2524, 0x2534, 0x252c, // 70-77
+ 0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, 0x00b7, // 78-7e
};
- if (c >= 0x5f && c <= 0x7e)
+ if (c >= 0x40 && c <= 0x7e && vt100_0[c - 0x40])
{
- c = vt100_0[c - 0x5f];
+ c = vt100_0[c - 0x40];
width = 1;
}
}
if (width != 0)
{
+ // some utf-8 decoders decode surrogate characters.
+ if (0xd800 <= c && c <= 0xdfff)
+ c = 0xfffd;
+
#if !UNICODE_3
// trim characters we can't store directly :(
if (c >= 0x10000)
c = 0xfffd;
# endif
#endif
- bool bold = (options & Opt_realBold) && ((rstyle & RS_Bold) != 0);
- rend_t rend = SET_FONT (rstyle,
- c > 0x7f || bold || c < 0x20
- ? TermWin.fontset->find_font (c, bold)
- : TermWin.ascii_map [c - 0x20]);
+
+ // nuke the character at this position, if required
+ if (stp[screen.cur.col] == NOCHAR
+ || (screen.cur.col < TermWin.ncol - 1
+ && stp[screen.cur.col + 1] == NOCHAR))
+ {
+ int col = screen.cur.col;
+
+ // find begin
+ while (col > 0 && stp[col] == NOCHAR)
+ col--;
+
+ rend_t rend = SET_FONT (srp[col], FONTSET (srp[col])->find_font (' '));
+
+ // found begin, nuke
+ do {
+ stp[col] = ' ';
+ srp[col] = rend;
+ col++;
+ } while (col < TermWin.ncol && stp[col] == NOCHAR);
+ }
+
+ rend_t rend = SET_FONT (rstyle, FONTSET (rstyle)->find_font (c));
do
{
// handle double-width-chars by making them look extremely ugly
if (*tp == NOCHAR)
- *tp = ' '; // hack //D //TODO //--tp, --rp;
+ {
+ // hack //D //TODO //--tp, --rp;
+ *tp = ' ';
+ *rp &= ~RS_baseattrMask;
+ *rp = SET_FONT (*rp, FONTSET (*rp)->find_font (*tp));
+ }
// first try to find a precomposed character
unicode_t n = rxvt_compose (*tp, c);
n = rxvt_composite.compose (*tp, c);
*tp = n;
- *rp = SET_FONT (*rp, TermWin.fontset->find_font (*tp));
+ *rp = SET_FONT (*rp, FONTSET (*rp)->find_font (*tp));
#endif
}
}
* XTERM_SEQ: CTRL-I
*/
void
-rxvt_term::scr_tab (int count)
+rxvt_term::scr_tab (int count, bool ht)
{
int i, x;
return;
else if (count > 0)
{
+ int row = TermWin.saveLines + screen.cur.row;
+ text_t *tp = screen.text[row];
+ rend_t *rp = screen.rend[row];
+ rend_t base_rend = rp[i];
+ ht &= tp[i] == ' ';
+
for (; ++i < TermWin.ncol; )
if (tabs[i])
{
if (!--count)
break;
}
+ else
+ ht &= tp[i] == ' '
+ && RS_SAME (rp[i], base_rend);
if (count)
x = TermWin.ncol - 1;
+
+ // store horizontal tab commands as characters inside the text
+ // buffer so they can be selected and pasted.
+ if (ht)
+ {
+ base_rend = SET_FONT (base_rend, 0);
+
+ if (screen.tlen[row] != -1) /* XXX: think about this */
+ MAX_IT (screen.tlen[row], x);
+
+ i = screen.cur.col;
+
+ tp[i] = '\t';
+ rp[i] = base_rend;
+
+ while (++i < x)
+ {
+ tp[i] = NOCHAR;
+ rp[i] = base_rend;
+ }
+ }
}
else /* if (count < 0) */
{
num_scr_allow = 0;
selection_check (3);
- fs = SET_FONT (rstyle, TermWin.fontset->find_font ('E'));
+ fs = SET_FONT (rstyle, FONTSET (rstyle)->find_font ('E'));
for (k = TermWin.saveLines, i = TermWin.nrow; i--; k++)
{
screen.tlen[k] = TermWin.ncol; /* make the `E's selectable */
screen.flags |= Screen_Relative;
else
screen.flags &= ~Screen_Relative;
+
scr_gotorc (0, 0, 0);
}
{
rvideo = mode;
SWAP_IT (pix_colors[Color_fg], pix_colors[Color_bg], rxvt_color);
-#if defined(XPM_BACKGROUND)
+#if XPM_BACKGROUND
if (bgPixmap.pixmap == None)
#endif
-#if defined(TRANSPARENT)
+#if TRANSPARENT
if (! (options & Opt_transparent) || am_transparent == 0)
#endif
XSetWindowBackground (display->display, TermWin.vt,
rxvt_term::scr_move_to (int y, int len)
{
long p = 0;
- uint16_t oldviewstart;
+ unsigned int oldviewstart;
oldviewstart = TermWin.view_start;
p = max (p, 0);
}
- TermWin.view_start = (uint16_t)min (p, TermWin.nscrolled);
+ TermWin.view_start = (unsigned int)min (p, TermWin.nscrolled);
return scr_changeview (oldviewstart);
}
rxvt_term::scr_page (enum page_dirn direction, int nlines)
{
int n;
- uint16_t oldviewstart;
+ unsigned int oldviewstart;
#ifdef DEBUG_STRICT
assert ((nlines >= 0) && (nlines <= TermWin.nrow));
}
int
-rxvt_term::scr_changeview (uint16_t oldviewstart)
+rxvt_term::scr_changeview (unsigned int oldviewstart)
{
if (TermWin.view_start != oldviewstart)
{
rxvt_term::scr_refresh (unsigned char refresh_type)
{
unsigned char must_clear, /* use draw_string not draw_image_string */
- rvid, /* reverse video this position */
showcursor; /* show the cursor */
int16_t col, row, /* column/row we're processing */
ocrow; /* old cursor row */
row_offset = TermWin.saveLines - TermWin.view_start;
-#ifdef XPM_BACKGROUND
+#if XPM_BACKGROUND
must_clear |= (bgPixmap.pixmap != None);
#endif
-#ifdef TRANSPARENT
+#if TRANSPARENT
must_clear |= ((options & Opt_transparent) && am_transparent);
#endif
ocrow = oldcursor.row; /* is there an old outline cursor on screen? */
* B: reverse any characters which are selected
*/
scr_reverse_selection ();
-#if ENABLE_OVERLAY
- scr_swap_overlay ();
-#endif
/*
* C: set the cursor character (s)
}
}
+#if ENABLE_OVERLAY
+ scr_swap_overlay ();
+#endif
+
rend_t *drp, *srp; /* drawn-rend-pointer, screen-rend-pointer */
text_t *dtp, *stp; /* drawn-text-pointer, screen-text-pointer */
+
#ifndef NO_SLOW_LINK_SUPPORT
/*
* D: CopyArea pass - very useful for slower links
{
/* compare new text with old - if exactly the same then continue */
if (stp[col] == dtp[col] /* Must match characters to skip. */
- && (srp[col] == drp[col] /* Either rendition the same or */
+ && (RS_SAME (srp[col], drp[col]) /* Either rendition the same or */
|| (stp[col] == ' ' /* space w/ no background change */
&& GET_BGATTR (srp[col]) == GET_BGATTR (drp[col]))))
continue;
int xpixel = Col2Pixel (col);
- // this loop looks very messy, it can probably be optimized
- // and cleaned a bit by you?
for (i = 0; ++col < TermWin.ncol; )
{
if (stp[col] == NOCHAR)
continue;
}
- if (rend != srp[col])
+ if (!RS_SAME (rend, srp[col]))
break;
count++;
if (stp[col] != dtp[col]
- || srp[col] != drp[col])
+ || !RS_SAME (srp[col], drp[col]))
{
if (must_clear && (i++ > count / 2))
break;
while (i && text[count] == NOCHAR)
count++, i--;
+#if ENABLE_STYLES
+ // force redraw after "careful" characters to avoid pixel droppings
+ if (srp[col] & RS_Careful && col < TermWin.ncol - 1 && 0)
+ drp[col + 1] = ~srp[col + 1];
+
+ // include previous careful character(s) if possible, looks nicer (best effort...)
+ while (text > stp
+ && srp[text - stp - 1] & RS_Careful
+ && RS_SAME (rend, srp[text - stp - 1]))
+ text--, count++, xpixel -= TermWin.fwidth;
+#endif
+
/*
* Determine the attributes for the string
*/
- int fid = GET_FONT (rend);
int fore = GET_FGCOLOR (rend); // desired foreground
int back = GET_BGCOLOR (rend); // desired background
- rend = GET_ATTR (rend);
-
- rvid = !!(rend & RS_RVid);
+ // only do special processing if ana attributes are set, which is rare
+ if (rend & (RS_Bold | RS_Italic | RS_Uline | RS_RVid | RS_Blink))
+ {
+ bool invert = rend & RS_RVid;
#ifndef NO_BOLD_UNDERLINE_REVERSE
- if (rend & RS_Bold && fore == Color_fg && !(options & Opt_realBold))
- {
- if (ISSET_PIXCOLOR (Color_BD))
- fore = Color_BD;
- else
- rvid = !rvid;
- }
+ if (rend & RS_Bold
+ && fore == Color_fg)
+ {
+ if (ISSET_PIXCOLOR (Color_BD))
+ fore = Color_BD;
+# if !ENABLE_STYLES
+ else
+ invert = !invert;
+# endif
+ }
+
+ if (rend & RS_Italic
+ && fore == Color_fg)
+ {
+ if (ISSET_PIXCOLOR (Color_IT))
+ fore = Color_IT;
+# if !ENABLE_STYLES
+ else
+ invert = !invert;
+# endif
+ }
- if (rend & RS_Uline)
- if (ISSET_PIXCOLOR (Color_UL))
- fore = Color_UL;
+ if (rend & RS_Uline && ISSET_PIXCOLOR (Color_UL))
+ fore = Color_UL;
#endif
- if (rvid)
- {
- SWAP_IT (fore, back, int);
+ if (invert)
+ {
+ SWAP_IT (fore, back, int);
#ifndef NO_BOLD_UNDERLINE_REVERSE
- if (ISSET_PIXCOLOR (Color_RV)
-# ifndef NO_CURSORCOLOR
- && !ISSET_PIXCOLOR (Color_cursor)
-# endif
- )
- back = Color_RV;
+ if (ISSET_PIXCOLOR (Color_RV))
+ back = Color_RV;
#endif
- }
+ }
#ifdef TEXT_BLINK
- if (rend & RS_Blink && (back == Color_bg || fore == Color_bg))
- {
- if (!text_blink_ev.active)
+ if (rend & RS_Blink && (back == Color_bg || fore == Color_bg))
{
- text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL);
- hidden_text = 0;
+ if (!text_blink_ev.active)
+ {
+ text_blink_ev.start (NOW + TEXT_BLINK_INTERVAL);
+ hidden_text = 0;
+ }
+ else if (hidden_text)
+ fore = back;
}
- else if (hidden_text)
- fore = back;
- }
#endif
+ }
/*
* Actually do the drawing of the string here
*/
- rxvt_font *font = (*TermWin.fontset)[fid];
+ rxvt_font *font = (*TermWin.fontset[GET_STYLE (rend)])[GET_FONT (rend)];
if (back == fore)
font->clear_rect (*TermWin.drawable, xpixel, ypixel,
} /* for (col....) */
} /* for (row....) */
+#if ENABLE_OVERLAY
+ scr_swap_overlay ();
+#endif
+
/*
* G: cleanup cursor and display outline cursor if necessary
*/
/*
* H: cleanup selection
*/
-#if ENABLE_OVERLAY
- scr_swap_overlay ();
-#endif
scr_reverse_selection ();
if (refresh_type & SMOOTH_REFRESH)
return;
for (int i = TermWin.ncol; i; i--, rp++, tp++)
- *rp = SET_FONT (*rp, TermWin.fontset->find_font (*tp));
+ *rp = SET_FONT (*rp, FONTSET (*rp)->find_font (*tp));
}
void
}
}
+void
+rxvt_term::scr_recolour ()
+{
+ if (1
+#if TRANSPARENT
+ && !am_transparent
+#endif
+#if XPM_BACKGROUND
+ && !bgPixmap.pixmap
+#endif
+ )
+ {
+ XSetWindowBackground (display->display, TermWin.parent[0], pix_colors[Color_border]);
+ XClearWindow (display->display, TermWin.parent[0]);
+ XSetWindowBackground (display->display, TermWin.vt, pix_colors[Color_bg]);
+#if HAVE_SCROLLBARS
+ if (scrollBar.win)
+ {
+ XSetWindowBackground (display->display, scrollBar.win, pix_colors[Color_border]);
+ scrollBar.setIdle ();
+ scrollbar_show (0);
+ }
+#endif
+ }
+
+ scr_clear ();
+ scr_touch (true);
+ want_refresh = 1;
+}
+
/* ------------------------------------------------------------------------- */
void
rxvt_term::scr_clear (bool really)
num_scr_allow = 0;
want_refresh = 1;
-#ifdef TRANSPARENT
+#if TRANSPARENT
if ((options & Opt_transparent) && (am_pixmap_trans == 0))
{
int i;
- if (! (options & Opt_transparent_all))
+ if (!(options & Opt_transparent_all))
i = 0;
else
i = (int) (sizeof (TermWin.parent) / sizeof (Window));
rend_t *rp = ov_rend[y] = new rend_t[w];
text_t t0, t1, t2;
- rend_t r = SET_BGCOLOR (SET_FGCOLOR (RS_None, Color_bg), Color_fg);
+ rend_t r = OVERLAY_RSTYLE;
if (y == 0)
t0 = 0x2554, t1 = 0x2550, t2 = 0x2557;
void
rxvt_term::scr_overlay_set (int x, int y, text_t text, rend_t rend)
{
- if (!ov_text || x >= ov_w - 2 || y >= ov_h)
+ if (!ov_text || x >= ov_w - 2 || y >= ov_h - 2)
return;
x++, y++;
for (int x = ov_w; x--; )
{
text_t t = *t1; *t1++ = *t2; *t2++ = t;
- rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, TermWin.fontset->find_font (t, false));
+ rend_t r = *r1; *r1++ = *r2; *r2++ = SET_FONT (r, FONTSET (r)->find_font (t));
}
}
}
-#define VERSION "3.7"
-#define VSTRING "30700"
-#define DATE "2004-08-17"
-#define LSMDATE "17AUG04"
-#define LIBVERSION "3:7:0"
+#define VERSION "3.8"
+#define VSTRING "30800"
+#define DATE "2004-08-25"
+#define LSMDATE "25AUG04"
+#define LIBVERSION "3:8:0"