ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/rxvt-unicode/src/command.C
(Generate patch)

Comparing rxvt-unicode/src/command.C (file contents):
Revision 1.198 by root, Sat Feb 19 01:07:58 2005 UTC vs.
Revision 1.204 by root, Wed Jul 13 02:47:02 2005 UTC

163void 163void
164rxvt_term::iso14755_51 (unicode_t ch, rend_t r) 164rxvt_term::iso14755_51 (unicode_t ch, rend_t r)
165{ 165{
166 rxvt_fontset *fs = FONTSET (r); 166 rxvt_fontset *fs = FONTSET (r);
167 rxvt_font *f = (*fs)[fs->find_font (ch)]; 167 rxvt_font *f = (*fs)[fs->find_font (ch)];
168 wchar_t *chr, *alloc, ch2; 168 wchar_t *chr, *alloc, ch2, *fname;
169 int len; 169 int len;
170
171 fname = rxvt_utf8towcs (f->name);
170 172
171#if ENABLE_COMBINING 173#if ENABLE_COMBINING
172 if (IS_COMPOSE (ch)) 174 if (IS_COMPOSE (ch))
173 { 175 {
174 len = rxvt_composite.expand (ch, 0); 176 len = rxvt_composite.expand (ch, 0);
183 alloc = 0; 185 alloc = 0;
184 chr = &ch2; 186 chr = &ch2;
185 len = 1; 187 len = 1;
186 } 188 }
187 189
188 int width = strlen (f->name); 190 int width = wcswidth (fname, wcslen (fname));
189 191
190 scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1); 192 scr_overlay_new (0, -1, width < 8+5 ? 8+5 : width, len + 1);
191 193
192 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r)); 194 r = SET_STYLE (OVERLAY_RSTYLE, GET_STYLE (r));
193 195
206#endif 208#endif
207 scr_overlay_set (11, y, ch, r); 209 scr_overlay_set (11, y, ch, r);
208 scr_overlay_set (12, y, NOCHAR, r); 210 scr_overlay_set (12, y, NOCHAR, r);
209 } 211 }
210 212
211 scr_overlay_set (0, len, f->name); 213 scr_overlay_set (0, len, fname);
214
215 free (fname);
212 216
213#if ENABLE_COMBINING 217#if ENABLE_COMBINING
214 if (alloc) 218 if (alloc)
215 delete [] alloc; 219 delete [] alloc;
216#endif 220#endif
316 320
317 // the XOpenIM manpage lies about hardcoding the locale 321 // the XOpenIM manpage lies about hardcoding the locale
318 // at the point of XOpenIM, so temporarily switch locales 322 // at the point of XOpenIM, so temporarily switch locales
319 if (rs[Rs_imLocale]) 323 if (rs[Rs_imLocale])
320 SET_LOCALE (rs[Rs_imLocale]); 324 SET_LOCALE (rs[Rs_imLocale]);
325
321 // assume wchar_t == unicode or better 326 // assume wchar_t == unicode or better
322 len = XwcLookupString (Input_Context, &ev, wkbuf, 327 len = XwcLookupString (Input_Context, &ev, wkbuf,
323 KBUFSZ, &keysym, &status_return); 328 KBUFSZ, &keysym, &status_return);
329
324 if (rs[Rs_imLocale]) 330 if (rs[Rs_imLocale])
325 SET_LOCALE (locale); 331 SET_LOCALE (locale);
326 332
327 if (status_return == XLookupChars 333 if (status_return == XLookupChars
328 || status_return == XLookupBoth) 334 || status_return == XLookupBoth)
1330 button_release (ev.xbutton); 1336 button_release (ev.xbutton);
1331 break; 1337 break;
1332 1338
1333 case ClientMessage: 1339 case ClientMessage:
1334 if (ev.xclient.format == 32 1340 if (ev.xclient.format == 32
1335 && ev.xclient.message_type == xa[XA_WM_PROTOCOLS] 1341 && ev.xclient.message_type == xa[XA_WM_PROTOCOLS])
1342 {
1336 && ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW]) 1343 if (ev.xclient.data.l[0] == xa[XA_WM_DELETE_WINDOW])
1337 destroy (); 1344 destroy ();
1345#if ENABLE_EWMH
1346 else if (ev.xclient.data.l[0] == xa[XA_NET_WM_PING])
1347 XSendEvent (disp, ev.xclient.window = display->root,
1348 False, SubstructureRedirectMask | SubstructureNotifyMask,
1349 &ev);
1350#endif
1351 }
1338#if ENABLE_XEMBED 1352#if ENABLE_XEMBED
1339 else if (ev.xclient.format == 32 1353 else if (ev.xclient.format == 32 && ev.xclient.message_type == xa[XA_XEMBED])
1340 && ev.xclient.message_type == xa[XA_XEMBED])
1341 { 1354 {
1342 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN) 1355 if (ev.xclient.data.l[1] == XEMBED_FOCUS_IN)
1343 focus_in (); 1356 focus_in ();
1344 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT) 1357 else if (ev.xclient.data.l[1] == XEMBED_FOCUS_OUT)
1345 focus_out (); 1358 focus_out ();
2633 /* Read a text string from the input buffer */ 2646 /* Read a text string from the input buffer */
2634 unicode_t buf[UBUFSIZ]; 2647 unicode_t buf[UBUFSIZ];
2635 bool refreshnow = false; 2648 bool refreshnow = false;
2636 int nlines = 0; 2649 int nlines = 0;
2637 unicode_t *str = buf; 2650 unicode_t *str = buf;
2651 unicode_t *eol = str + min (TermWin.ncol, UBUFSIZ);
2638 2652
2639 for (;;) 2653 for (;;)
2640 { 2654 {
2641 if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT)) 2655 if (ch == NOCHAR || (IS_CONTROL (ch) && ch != C0_LF && ch != C0_CR && ch != C0_HT))
2642 break; 2656 break;
2643 2657
2644 *str++ = ch; 2658 *str++ = ch;
2645 2659
2646 if (ch == C0_LF) 2660 if (ch == C0_LF || str >= eol)
2647 { 2661 {
2648 nlines++; 2662 nlines++;
2649 refresh_count++; 2663 refresh_count++;
2650 2664
2651 if (!(options & Opt_jumpScroll) 2665 if (!(options & Opt_jumpScroll)
2660 if (nlines >= TermWin.nrow - 1) 2674 if (nlines >= TermWin.nrow - 1)
2661 { 2675 {
2662 scr_add_lines (buf, nlines, str - buf); 2676 scr_add_lines (buf, nlines, str - buf);
2663 nlines = 0; 2677 nlines = 0;
2664 str = buf; 2678 str = buf;
2679 eol = str + min (TermWin.ncol, UBUFSIZ);
2665 } 2680 }
2666 }
2667 2681
2668 if (str >= buf + UBUFSIZ) 2682 if (str >= eol)
2669 { 2683 {
2684 if (eol >= buf + UBUFSIZ)
2685 {
2670 ch = NOCHAR; 2686 ch = NOCHAR;
2671 break; 2687 break;
2688 }
2689 else
2690 eol = min (eol + TermWin.ncol, buf + UBUFSIZ);
2691 }
2692
2672 } 2693 }
2673 2694
2674 seq_begin = cmdbuf_ptr; 2695 seq_begin = cmdbuf_ptr;
2675 ch = next_char (); 2696 ch = next_char ();
2676 } 2697 }
3581 else if (ch < 0x20) 3602 else if (ch < 0x20)
3582 return NULL; /* other control character - exit */ 3603 return NULL; /* other control character - exit */
3583 3604
3584 seen_esc = false; 3605 seen_esc = false;
3585 3606
3586 if (n >= sizeof (string) - 1) 3607 if (n >= STRING_MAX - 1)
3587 // stop at some sane length 3608 // stop at some sane length
3588 return NULL; 3609 return NULL;
3589 3610
3590 if (ch == C0_SYN) 3611 if (ch == C0_SYN)
3591 string[n++] = cmd_get8 (); 3612 string[n++] = cmd_get8 ();
3659 set_window_color (color, str); 3680 set_window_color (color, str);
3660} 3681}
3661 3682
3662/* 3683/*
3663 * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL) 3684 * XTerm escape sequences: ESC ] Ps;Pt (ST|BEL)
3664 * 0 = change iconName/title
3665 * 1 = change iconName
3666 * 2 = change title
3667 * 4 = change color
3668 * 10 = change fg color
3669 * 11 = change bg color
3670 * 12 = change text color
3671 * 13 = change mouse foreground color
3672 * 17 = change highlight character colour
3673 * 18 = change bold character color
3674 * 19 = change underlined character color
3675 * 46 = change logfile (not implemented)
3676 * 50 = change font
3677 *
3678 * rxvt extensions:
3679 * 20 = bg pixmap
3680 * 39 = change default fg color
3681 * 49 = change default bg color
3682 * 55 = dump scrollback buffer and all of screen
3683 * 701 = change locale
3684 * 702 = find font
3685 * 703 = menu
3686 */ 3685 */
3687void 3686void
3688rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp) 3687rxvt_term::process_xterm_seq (int op, const char *str, unsigned char resp)
3689{ 3688{
3690 int changed = 0; 3689 int changed = 0;
3789 break; 3788 break;
3790#ifndef NO_BOLD_UNDERLINE_REVERSE 3789#ifndef NO_BOLD_UNDERLINE_REVERSE
3791 case XTerm_Color_BD: 3790 case XTerm_Color_BD:
3792 process_color_seq (XTerm_Color_BD, Color_BD, str, resp); 3791 process_color_seq (XTerm_Color_BD, Color_BD, str, resp);
3793 break; 3792 break;
3794 case XTerm_Color_IT:
3795 process_color_seq (XTerm_Color_IT, Color_IT, str, resp);
3796 break;
3797 case XTerm_Color_UL: 3793 case XTerm_Color_UL:
3798 process_color_seq (XTerm_Color_UL, Color_UL, str, resp); 3794 process_color_seq (XTerm_Color_UL, Color_UL, str, resp);
3799 break; 3795 break;
3800 case XTerm_Color_RV: 3796 case XTerm_Color_RV:
3801 process_color_seq (XTerm_Color_RV, Color_RV, str, resp); 3797 process_color_seq (XTerm_Color_RV, Color_RV, str, resp);
3802 break; 3798 break;
3799 case URxvt_Color_IT:
3800 process_color_seq (URxvt_Color_IT, Color_IT, str, resp);
3801 break;
3803#endif 3802#endif
3804#if TRANSPARENT && TINTING 3803#if TRANSPARENT && TINTING
3805 case XTerm_Color_tint: 3804 case URxvt_Color_tint:
3806 process_color_seq (XTerm_Color_tint, Color_tint, str, resp); 3805 process_color_seq (URxvt_Color_tint, Color_tint, str, resp);
3807 check_our_parents (); 3806 check_our_parents ();
3808 if (am_transparent) 3807 if (am_transparent)
3809 want_full_refresh = want_refresh = 1; 3808 want_full_refresh = want_refresh = 1;
3810 break; 3809 break;
3811#endif 3810#endif
3845 3844
3846 case XTerm_logfile: 3845 case XTerm_logfile:
3847 // TODO, when secure mode? 3846 // TODO, when secure mode?
3848 break; 3847 break;
3849 3848
3849#ifdef MENUBAR
3850 case URxvt_Menu:
3851 if (options & Opt_insecure)
3852 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked
3853 break;
3854#endif
3855#if 0
3856 case XTerm_dumpscreen: /* no error notices */
3857 {
3858 int fd;
3859 if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0)
3860 {
3861 scr_dump (fd);
3862 close (fd);
3863 }
3864 }
3865 break;
3866#endif
3850 case XTerm_font: 3867 case XTerm_font:
3851 op = URxvt_font; 3868 op = URxvt_font;
3852 case URxvt_font: 3869 case URxvt_font:
3853#if ENABLE_STYLES 3870#if ENABLE_STYLES
3854 case URxvt_boldFont: 3871 case URxvt_boldFont:
3869 set_fonts (); 3886 set_fonts ();
3870 } 3887 }
3871 break; 3888 break;
3872 3889
3873#if ENABLE_FRILLS 3890#if ENABLE_FRILLS
3874 case XTerm_locale: 3891 case URxvt_locale:
3875 if (query) 3892 if (query)
3876 tt_printf ("\33]%d;%-.250s%c", XTerm_locale, (options & Opt_insecure) ? locale : "", resp); 3893 tt_printf ("\33]%d;%-.250s%c", URxvt_locale, (options & Opt_insecure) ? locale : "", resp);
3877 else 3894 else
3878 { 3895 {
3879 set_locale (str); 3896 set_locale (str);
3880 pty.set_utf8_mode (enc_utf8); 3897 pty.set_utf8_mode (enc_utf8);
3881# ifdef USE_XIM
3882 im_cb (); 3898 init_xlocale ();
3883# endif
3884 } 3899 }
3885 break; 3900 break;
3886#endif
3887 3901
3888#ifdef MENUBAR 3902 case URxvt_view_up:
3889 case XTerm_Menu: 3903 case URxvt_view_down:
3890 if (options & Opt_insecure) 3904 int lines = atoi (str);
3891 menubar_dispatch (const_cast<char *>(str)); // casting away constness is checked 3905
3892 break; 3906 if (lines)
3893#endif 3907 scr_page (op == URxvt_view_up ? UP : DN, lines);
3894#if 0
3895 case XTerm_dumpscreen: /* no error notices */
3896 { 3908 else
3897 int fd;
3898 if ((fd = open (str, O_RDWR | O_CREAT | O_EXCL, 0600)) >= 0)
3899 { 3909 {
3900 scr_dump (fd); 3910 scr_erase_savelines ();
3901 close (fd);
3902 } 3911 }
3903 } 3912
3904 break; 3913 break;
3905#endif 3914#endif
3906 } 3915 }
3907} 3916}
3908/*----------------------------------------------------------------------*/ 3917/*----------------------------------------------------------------------*/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines