Some introductory blurb in the docs
[u/mdw/putty] / terminal.c
index 0f4504a..9ef0c5c 100644 (file)
@@ -803,8 +803,30 @@ static int beep_overload = 0;
                 *
                 * An xterm returns "xterm" (5 characters)
                 */
-               compatibility(OTHER);
-               ldisc_send ("PuTTY", 5);
+               compatibility(ANSIMIN);
+               {
+                   char abuf[256], *s, *d;
+                   int state=0;
+                   for(s=cfg.answerback, d=abuf; *s; s++) {
+                        if (state)
+                        {
+                            if (*s >= 'a' && *s <= 'z')
+                                *d++ = (*s - ('a'-1));
+                            else if ((*s >='@' && *s<='_') ||
+                                     *s == '?' || (*s&0x80))
+                                *d++ = ('@'^*s);
+                            else if (*s == '~')
+                                *d++ = '^';
+                            state = 0;
+                        }
+                        else if (*s == '^') {
+                            state = 1;
+                        }
+                        else
+                            *d++ = xlat_kbd2tty((unsigned char)*s);
+                   }
+                   ldisc_send (abuf, d-abuf);
+               }
                break;
              case '\007':
                beep_count++; 
@@ -1836,8 +1858,8 @@ static void do_paint (Context ctx, int may_optimise){
  */
 
 void term_blink(int flg) {
-static long last_blink = 0;
-static long last_tblink = 0;
+    static long last_blink = 0;
+    static long last_tblink = 0;
     long now, blink_diff;
 
     now = GetTickCount();
@@ -1858,8 +1880,8 @@ static long last_tblink = 0;
 
     blink_diff = now-last_blink;
 
-    /* Make sure the cursor blinks no more than 2Hz */
-    if (blink_diff>=0 && blink_diff<450)
+    /* Make sure the cursor blinks no faster than GetCaretBlinkTime() */
+    if (blink_diff>=0 && blink_diff<(long)GetCaretBlinkTime())
        return;
  
     last_blink = now;
@@ -1948,34 +1970,34 @@ static void clipme(unsigned long *top, unsigned long *bottom, char *workbuf) {
        }
        while (top < nlpos && top < bottom)
        {
-#if 0
-           /* VT Specials -> ISO8859-1  */
-           static const char poorman2[] =
+           int ch = (*top & CHAR_MASK);
+           int set = (*top & CSET_MASK);
+
+           /* VT Specials -> ISO8859-1 for Cut&Paste */
+           static const unsigned char poorman2[] =
 "* # HTFFCRLF\xB0 \xB1 NLVT+ + + + + - - - - - + + + + | <=>=PI!=\xA3 \xB7 ";
-#endif
 
-           int ch = (*top & CHAR_MASK);
+           if (set && !cfg.rawcnp) {
+               if (set == ATTR_LINEDRW && ch >= 0x60 && ch < 0x7F) {
+                   int x;
+                   if ((x = poorman2[2*(ch-0x60)+1]) == ' ')
+                       x = 0;
+                   ch = (x<<8) + poorman2[2*(ch-0x60)];
+               }
+           }
 
-#if 0
-           if ((*top & ATTR_LINEDRW) && ch >= 0x60 && ch < 0x7F) {
-               int x;
-               *wbptr++ = poorman2[2*(ch-0x60)];
-               if ( (x = poorman2[2*(ch-0x60)+1]) != ' ')
-                   *wbptr++ = x;
-           } else
-#endif
-#if 0
-           if ((*top & ATTR_GBCHR) && ch == '#')
-               *wbptr++ = (unsigned char) 0xA3;
-           else
-#endif
-           if ( wblen == buflen )
-           {
-               workbuf = srealloc(workbuf, buflen += 100);
-               wbptr = workbuf + wblen;
+           while(ch != 0) {
+               if (cfg.rawcnp || !!(ch&0xE0)) {
+                   if ( wblen == buflen )
+                   {
+                       workbuf = srealloc(workbuf, buflen += 100);
+                       wbptr = workbuf + wblen;
+                   }
+                   wblen++;
+                   *wbptr++ = (unsigned char) ch;
+               }
+               ch>>=8;
            }
-           wblen++;
-           *wbptr++ = (unsigned char) ch;
            top++;
        }
        if (nl) {