--- rxvt-unicode/src/command.C 2005/12/18 00:59:42 1.208 +++ rxvt-unicode/src/command.C 2005/12/31 18:27:57 1.221 @@ -137,32 +137,29 @@ x = Pixel2Col (x); y = Pixel2Row (y); - if (x < 0 || x >= ncol - || y < 0 || y >= nrow) + if (!IN_RANGE_EXC (x, 0, ncol) + || !IN_RANGE_EXC (y, 0, nrow)) return; for (;;) { - const line_t &l = save[y + saveLines - view_start]; + const line_t &l = ROW(y - view_start); text_t t = l.t[x]; if (t != NOCHAR || !x) { - iso14755_51 (l.t[x], l.r[x]); + iso14755_51 (l.t[x], l.r[x], x, y); iso14755buf = ISO_14755_54; break; } x--; } - } -#endif -#if ENABLE_OVERLAY void -rxvt_term::iso14755_51 (unicode_t ch, rend_t r) +rxvt_term::iso14755_51 (unicode_t ch, rend_t r, int x, int y) { rxvt_fontset *fs = FONTSET (r); rxvt_font *f = (*fs)[fs->find_font (ch)]; @@ -171,7 +168,7 @@ fname = rxvt_utf8towcs (f->name); -#if ENABLE_COMBINING +# if ENABLE_COMBINING if (IS_COMPOSE (ch)) { len = rxvt_composite.expand (ch, 0); @@ -179,7 +176,7 @@ rxvt_composite.expand (ch, chr); } else -#endif +# endif { ch2 = ch; @@ -188,9 +185,30 @@ len = 1; } + char attr[80]; // plenty + + sprintf (attr, "%08x = fg %d bg %d%s%s%s%s%s%s", + (int)r, + fgcolor_of (r), bgcolor_of (r), + r & RS_Bold ? " bold" : "", + r & RS_Italic ? " italic" : "", + r & RS_Blink ? " blink" : "", + r & RS_RVid ? " rvid" : "", + r & RS_Uline ? " uline" : "", + r & RS_Careful ? " careful" : ""); + int width = wcswidth (fname, wcslen (fname)); - scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); + max_it (width, 8+5); // for char + hey + max_it (width, strlen (attr)); + + if (y >= 0) + { + y = (y >= nrow - len - 4 && x < width + 2) ? 0 : -1; + x = 0; + } + + scr_overlay_new (x, y, width, len + 2); r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); @@ -203,22 +221,23 @@ sprintf (buf, "%8x", ch); scr_overlay_set (0, y, buf); scr_overlay_set (9, y, '='); -#if !UNICODE3 +# if !UNICODE3 if (ch >= 0x10000) ch = 0xfffd; -#endif +# endif scr_overlay_set (11, y, ch, r); scr_overlay_set (12, y, NOCHAR, r); } - scr_overlay_set (0, len, fname); + scr_overlay_set (0, len , attr); + scr_overlay_set (0, len + 1, fname); free (fname); -#if ENABLE_COMBINING +# if ENABLE_COMBINING if (alloc) delete [] alloc; -#endif +# endif } #endif @@ -847,7 +866,7 @@ if (len <= 0) return; /* not mapped */ - if (options & Opt_scrollTtyKeypress) + if (OPTION (Opt_scrollTtyKeypress)) if (view_start) { view_start = 0; @@ -1037,7 +1056,7 @@ || mouse_slip_wheel_speed < 0 ? scr_page (DN, -mouse_slip_wheel_speed) : scr_page (UP, mouse_slip_wheel_speed)) { - if (view_start == nscrolled || + if (view_start == nsaved || view_start == 0) mouse_slip_wheel_speed = 0; @@ -1070,8 +1089,13 @@ cmdbuf_endp += n; return true; } - else if (n < 0 && errno != EAGAIN) - destroy (); + else if ((n < 0 && errno != EAGAIN && errno != EINTR) || n == 0) + { + pty_ev.stop (); + + if (!OPTION (Opt_hold)) + destroy (); + } return false; } @@ -1101,7 +1125,7 @@ #ifdef POINTER_BLANK hidden_pointer = 0; - if (options & Opt_pointerBlank) + if (OPTION (Opt_pointerBlank)) pointer_ev.start (NOW + pointerBlankDelay); #endif } @@ -1110,7 +1134,7 @@ void rxvt_term::pointer_blank () { - if (! (options & Opt_pointerBlank)) + if (! OPTION (Opt_pointerBlank)) return; XDefineCursor (display->display, vt, display->blank_cursor); @@ -1218,7 +1242,7 @@ SET_LOCALE (locale); #if defined(CURSOR_BLINK) - if ((options & Opt_cursorBlink) && ev.type == KeyPress) + if (OPTION (Opt_cursorBlink) && ev.type == KeyPress) { if (hidden_cursor) { @@ -1231,7 +1255,7 @@ #endif #if defined(POINTER_BLANK) - if ((options & Opt_pointerBlank) && pointerBlankDelay > 0) + if (OPTION (Opt_pointerBlank) && pointerBlankDelay > 0) { if (ev.type == MotionNotify || ev.type == ButtonPress @@ -1437,7 +1461,7 @@ } #ifdef TRANSPARENT /* XXX: maybe not needed - leave in for now */ - if (options & Opt_transparent) + if (OPTION (Opt_transparent)) check_our_parents (); #endif } @@ -1603,7 +1627,7 @@ scroll_selection_lines = Pixel2Height (dist) / SELECTION_SCROLL_LINE_SPEEDUP + 1; - MIN_IT (scroll_selection_lines, + min_it (scroll_selection_lines, SELECTION_SCROLL_MAX_LINES); } else @@ -1656,7 +1680,7 @@ } #endif #if CURSOR_BLINK - if (options & Opt_cursorBlink) + if (OPTION (Opt_cursorBlink)) cursor_blink_ev.start (NOW + BLINK_INTERVAL); #endif #if OFF_FOCUS_FADING @@ -1688,7 +1712,7 @@ XUnsetICFocus (Input_Context); #endif #if CURSOR_BLINK - if (options & Opt_cursorBlink) + if (OPTION (Opt_cursorBlink)) cursor_blink_ev.stop (); hidden_cursor = 0; #endif @@ -1722,7 +1746,7 @@ /* FALLTHROUGH */ case ReparentNotify: - if ((options & Opt_transparent) && check_our_parents () && am_transparent) + if (OPTION (Opt_transparent) && check_our_parents () && am_transparent) want_refresh = want_full_refresh = 1; break; } @@ -2074,7 +2098,7 @@ if (ev.state & ShiftMask) i = 1; - else if (options & Opt_mouseWheelScrollPage) + else if (OPTION (Opt_mouseWheelScrollPage)) i = nrow - 1; else i = 5; @@ -2370,7 +2394,7 @@ pchanged = 0; - if (!(options & Opt_transparent)) + if (!OPTION (Opt_transparent)) return pchanged; /* Don't try any more */ XGetWindowAttributes (disp, display->root, &wrootattr); @@ -2454,8 +2478,8 @@ sy = 0; } - MIN_IT (nw, (unsigned int) (wrootattr.width - sx)); - MIN_IT (nh, (unsigned int) (wrootattr.height - sy)); + min_it (nw, (unsigned int) (wrootattr.width - sx)); + min_it (nh, (unsigned int) (wrootattr.height - sy)); XSync (disp, False); allowedxerror = -1; @@ -2658,7 +2682,7 @@ refresh_count++; - if (!(options & Opt_jumpScroll) + if (!OPTION (Opt_jumpScroll) || (refresh_count >= refresh_limit * (nrow - 1))) { refreshnow = true; @@ -2702,7 +2726,7 @@ */ if (refreshnow) { - if ((options & Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) + if (OPTION (Opt_jumpScroll) && refresh_limit < REFRESH_PERIOD) refresh_limit++; else { @@ -3354,7 +3378,7 @@ arg[0] = -arg[0]; /* FALLTHROUGH */ case CSI_SU: /* 8.3.148: (1) SCROLL UP */ - scr_scroll_text (screen.tscroll, screen.bscroll, arg[0], 0); + scr_scroll_text (screen.tscroll, screen.bscroll, arg[0]); break; case CSI_DA: /* 8.3.24: (0) DEVICE ATTRIBUTES */ @@ -3376,7 +3400,7 @@ scr_report_position (); break; case 7: /* unofficial extension */ - if (options & Opt_insecure) + if (OPTION (Opt_insecure)) tt_printf ("%-.250s\012", rs[Rs_display_name]); break; case 8: /* unofficial extension */ @@ -3550,7 +3574,7 @@ { char *s; XGetIconName (disp, parent[0], &s); - tt_printf ("\033]L%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ + tt_printf ("\033]L%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ XFree (s); } break; @@ -3558,7 +3582,7 @@ { char *s; XFetchName (disp, parent[0], &s); - tt_printf ("\033]l%-.250s\234", (options & Opt_insecure) && s ? s : ""); /* 8bit ST */ + tt_printf ("\033]l%-.250s\234", OPTION (Opt_insecure) && s ? s : ""); /* 8bit ST */ XFree (s); } break; @@ -3844,7 +3868,7 @@ #ifdef MENUBAR case URxvt_Menu: - if (options & Opt_insecure) + if (OPTION (Opt_insecure)) menubar_dispatch (const_cast(str)); // casting away constness is checked break; #endif @@ -3870,7 +3894,7 @@ #endif if (query) tt_printf ("\33]%d;%-.250s%c", saveop, - (options & Opt_insecure) && fontset[op - URxvt_font]->fontdesc + OPTION (Opt_insecure) && fontset[op - URxvt_font]->fontdesc ? fontset[op - URxvt_font]->fontdesc : "", resp); else @@ -3886,7 +3910,7 @@ #if ENABLE_FRILLS case URxvt_locale: if (query) - tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp); + tt_printf ("\33]%d;%-.250s%c", URxvt_locale, OPTION (Opt_insecure) ? locale : "", resp); else { set_locale (str); @@ -4024,9 +4048,16 @@ /* extra handling for values with state unkept */ switch (arg[i]) { +#if ENABLE_STYLES + case 1021: + if (mode) + SET_OPTION (Opt_intensityStyles); + else + CLR_OPTION (Opt_intensityStyles); +#endif case 1048: /* alternative cursor save */ case 1049: - if (options & Opt_secondaryScreen) + if (OPTION (Opt_secondaryScreen)) if (mode == 0) scr_cursor (RESTORE); else if (mode == 1) @@ -4051,10 +4082,10 @@ set_widthheight (((state ? 132 : 80) * fwidth), height); break; case 4: /* smooth scrolling */ - if (state) - options &= ~Opt_jumpScroll; + if (!state) + SET_OPTION (Opt_jumpScroll); else - options |= Opt_jumpScroll; + CLR_OPTION (Opt_jumpScroll); break; case 5: /* reverse video */ scr_rvideo_mode (state); @@ -4105,26 +4136,26 @@ break; /* X11 mouse highlighting */ #endif case 1010: /* scroll to bottom on TTY output inhibit */ - if (state) - options &= ~Opt_scrollTtyOutput; + if (!state) + SET_OPTION (Opt_scrollTtyOutput); else - options |= Opt_scrollTtyOutput; + CLR_OPTION (Opt_scrollTtyOutput); break; case 1011: /* scroll to bottom on key press */ if (state) - options |= Opt_scrollTtyKeypress; + SET_OPTION (Opt_scrollTtyKeypress); else - options &= ~Opt_scrollTtyKeypress; + CLR_OPTION (Opt_scrollTtyKeypress); break; case 1047: /* secondary screen w/ clearing last */ - if (options & Opt_secondaryScreen) + if (OPTION (Opt_secondaryScreen)) if (current_screen != PRIMARY) scr_erase_screen (2); scr_change_screen (state); break; case 1049: /* secondary screen w/ clearing first */ scr_change_screen (state); - if (options & Opt_secondaryScreen) + if (OPTION (Opt_secondaryScreen)) if (current_screen != PRIMARY) scr_erase_screen (2); break; @@ -4284,7 +4315,6 @@ scr_color ((unsigned int) (minBrightCOLOR + (arg[i] - 100)), Color_bg); break; #endif - } } } @@ -4375,8 +4405,7 @@ memmove (v_buffer, v_buffer + written, v_buflen); } else if (written != -1 || (errno != EAGAIN && errno != EINTR)) - // original code just ignores this... - destroy (); + pty_ev.set (EVENT_READ); } /*----------------------- end-of-file (C source) -----------------------*/