/[emacs]/emacs/src/term.c
ViewVC logotype

Diff of /emacs/src/term.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.143 by raeburn, Fri Jul 19 14:37:18 2002 UTC revision 1.144 by lektu, Tue Feb 4 14:03:13 2003 UTC
# Line 76  static void tty_hide_cursor P_ ((void)); Line 76  static void tty_hide_cursor P_ ((void));
76           tputs (a, (int) (FRAME_HEIGHT (XFRAME (selected_frame))        \           tputs (a, (int) (FRAME_HEIGHT (XFRAME (selected_frame))        \
77                            - curY), cmputc);                             \                            - curY), cmputc);                             \
78       } while (0)       } while (0)
79        
80  #define OUTPUT1_IF(a) do { if (a) tputs (a, 1, cmputc); } while (0)  #define OUTPUT1_IF(a) do { if (a) tputs (a, 1, cmputc); } while (0)
81    
82  /* Function to use to ring the bell.  */  /* Function to use to ring the bell.  */
# Line 203  void (*set_vertical_scroll_bar_hook) Line 203  void (*set_vertical_scroll_bar_hook)
203    
204  /* Arrange for all scroll bars on FRAME to be removed at the next call  /* Arrange for all scroll bars on FRAME to be removed at the next call
205     to `*judge_scroll_bars_hook'.  A scroll bar may be spared if     to `*judge_scroll_bars_hook'.  A scroll bar may be spared if
206     `*redeem_scroll_bar_hook' is applied to its window before the judgment.     `*redeem_scroll_bar_hook' is applied to its window before the judgment.
207    
208     This should be applied to each frame each time its window tree is     This should be applied to each frame each time its window tree is
209     redisplayed, even if it is not displaying scroll bars at the moment;     redisplayed, even if it is not displaying scroll bars at the moment;
# Line 222  void (*condemn_scroll_bars_hook) P_ ((FR Line 222  void (*condemn_scroll_bars_hook) P_ ((FR
222  void (*redeem_scroll_bar_hook) P_ ((struct window *window));  void (*redeem_scroll_bar_hook) P_ ((struct window *window));
223    
224  /* Remove all scroll bars on FRAME that haven't been saved since the  /* Remove all scroll bars on FRAME that haven't been saved since the
225     last call to `*condemn_scroll_bars_hook'.       last call to `*condemn_scroll_bars_hook'.
226    
227     This should be applied to each frame after each time its window     This should be applied to each frame after each time its window
228     tree is redisplayed, even if it is not displaying scroll bars at the     tree is redisplayed, even if it is not displaying scroll bars at the
# Line 431  ring_bell () Line 431  ring_bell ()
431           We don't specbind it, because that would carefully           We don't specbind it, because that would carefully
432           restore the bad value if there's an error           restore the bad value if there's an error
433           and make the loop of errors happen anyway.  */           and make the loop of errors happen anyway.  */
434          
435        function = Vring_bell_function;        function = Vring_bell_function;
436        Vring_bell_function = Qnil;        Vring_bell_function = Qnil;
437    
# Line 499  update_end (f) Line 499  update_end (f)
499      }      }
500    else    else
501      update_end_hook (f);      update_end_hook (f);
502      
503    updating_frame = NULL;    updating_frame = NULL;
504  }  }
505    
# Line 523  set_scroll_region (start, stop) Line 523  set_scroll_region (start, stop)
523  {  {
524    char *buf;    char *buf;
525    struct frame *sf = XFRAME (selected_frame);    struct frame *sf = XFRAME (selected_frame);
526      
527    if (TS_set_scroll_region)    if (TS_set_scroll_region)
528      buf = tparam (TS_set_scroll_region, 0, 0, start, stop - 1);      buf = tparam (TS_set_scroll_region, 0, 0, start, stop - 1);
529    else if (TS_set_scroll_region_1)    else if (TS_set_scroll_region_1)
# Line 533  set_scroll_region (start, stop) Line 533  set_scroll_region (start, stop)
533                    FRAME_HEIGHT (sf));                    FRAME_HEIGHT (sf));
534    else    else
535      buf = tparam (TS_set_window, 0, 0, start, 0, stop, FRAME_WIDTH (sf));      buf = tparam (TS_set_window, 0, 0, start, 0, stop, FRAME_WIDTH (sf));
536      
537    OUTPUT (buf);    OUTPUT (buf);
538    xfree (buf);    xfree (buf);
539    losecursor ();    losecursor ();
# Line 644  cursor_to (vpos, hpos) Line 644  cursor_to (vpos, hpos)
644       int vpos, hpos;       int vpos, hpos;
645  {  {
646    struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame);    struct frame *f = updating_frame ? updating_frame : XFRAME (selected_frame);
647      
648    if (! FRAME_TERMCAP_P (f) && cursor_to_hook)    if (! FRAME_TERMCAP_P (f) && cursor_to_hook)
649      {      {
650        (*cursor_to_hook) (vpos, hpos);        (*cursor_to_hook) (vpos, hpos);
# Line 720  void Line 720  void
720  clear_frame ()  clear_frame ()
721  {  {
722    struct frame *sf = XFRAME (selected_frame);    struct frame *sf = XFRAME (selected_frame);
723      
724    if (clear_frame_hook    if (clear_frame_hook
725        && ! FRAME_TERMCAP_P ((updating_frame ? updating_frame : sf)))        && ! FRAME_TERMCAP_P ((updating_frame ? updating_frame : sf)))
726      {      {
# Line 872  encode_terminal_code (src, dst, src_len, Line 872  encode_terminal_code (src, dst, src_len,
872                    coding->src_multibyte = STRING_MULTIBYTE (tbase[g]);                    coding->src_multibyte = STRING_MULTIBYTE (tbase[g]);
873                  }                  }
874              }              }
875              
876            result = encode_coding (coding, buf, dst, len, dst_end - dst);            result = encode_coding (coding, buf, dst, len, dst_end - dst);
877            len -= coding->consumed;            len -= coding->consumed;
878            dst += coding->produced;            dst += coding->produced;
# Line 895  encode_terminal_code (src, dst, src_len, Line 895  encode_terminal_code (src, dst, src_len,
895          }          }
896        src++;        src++;
897      }      }
898      
899    *consumed = src - src_start;    *consumed = src - src_start;
900    return (dst - dst_start);    return (dst - dst_start);
901  }  }
# Line 933  write_glyphs (string, len) Line 933  write_glyphs (string, len)
933      return;      return;
934    
935    cmplus (len);    cmplus (len);
936      
937    /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at    /* The mode bit CODING_MODE_LAST_BLOCK should be set to 1 only at
938       the tail.  */       the tail.  */
939    terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK;    terminal_coding.mode &= ~CODING_MODE_LAST_BLOCK;
940      
941    while (len > 0)    while (len > 0)
942      {      {
943        /* Identify a run of glyphs with the same face.  */        /* Identify a run of glyphs with the same face.  */
944        int face_id = string->face_id;        int face_id = string->face_id;
945        int n;        int n;
946          
947        for (n = 1; n < len; ++n)        for (n = 1; n < len; ++n)
948          if (string[n].face_id != face_id)          if (string[n].face_id != face_id)
949            break;            break;
# Line 977  write_glyphs (string, len) Line 977  write_glyphs (string, len)
977        turn_off_face (f, face_id);        turn_off_face (f, face_id);
978        turn_off_highlight ();        turn_off_highlight ();
979      }      }
980      
981    /* We may have to output some codes to terminate the writing.  */    /* We may have to output some codes to terminate the writing.  */
982    if (CODING_REQUIRE_FLUSHING (&terminal_coding))    if (CODING_REQUIRE_FLUSHING (&terminal_coding))
983      {      {
# Line 994  write_glyphs (string, len) Line 994  write_glyphs (string, len)
994                      termscript);                      termscript);
995          }          }
996      }      }
997      
998    cmcheckmagic ();    cmcheckmagic ();
999  }  }
1000    
1001  /* If start is zero, insert blanks instead of a string at start */  /* If start is zero, insert blanks instead of a string at start */
1002    
1003  void  void
1004  insert_glyphs (start, len)  insert_glyphs (start, len)
1005       register struct glyph *start;       register struct glyph *start;
# Line 1087  insert_glyphs (start, len) Line 1087  insert_glyphs (start, len)
1087            turn_off_highlight ();            turn_off_highlight ();
1088          }          }
1089      }      }
1090      
1091    cmcheckmagic ();    cmcheckmagic ();
1092  }  }
1093    
# Line 1148  ins_del_lines (vpos, n) Line 1148  ins_del_lines (vpos, n)
1148      }      }
1149    
1150    sf = XFRAME (selected_frame);    sf = XFRAME (selected_frame);
1151      
1152    /* If the lines below the insertion are being pushed    /* If the lines below the insertion are being pushed
1153       into the end of the window, this is the same as clearing;       into the end of the window, this is the same as clearing;
1154       and we know the lines are already clear, since the matching       and we know the lines are already clear, since the matching
# Line 1462  static char **term_get_fkeys_arg; Line 1462  static char **term_get_fkeys_arg;
1462  static Lisp_Object term_get_fkeys_1 ();  static Lisp_Object term_get_fkeys_1 ();
1463    
1464  /* Find the escape codes sent by the function keys for Vfunction_key_map.  /* Find the escape codes sent by the function keys for Vfunction_key_map.
1465     This function scans the termcap function key sequence entries, and     This function scans the termcap function key sequence entries, and
1466     adds entries to Vfunction_key_map for each function key it finds.  */     adds entries to Vfunction_key_map for each function key it finds.  */
1467    
1468  void  void
# Line 1567  term_get_fkeys_1 () Line 1567  term_get_fkeys_1 ()
1567                           Fmake_vector (make_number (1), \                           Fmake_vector (make_number (1), \
1568                                         intern (sym)));  \                                         intern (sym)));  \
1569          }          }
1570              
1571        /* if there's no key_next keycap, map key_npage to `next' keysym */        /* if there's no key_next keycap, map key_npage to `next' keysym */
1572        CONDITIONAL_REASSIGN ("%5", "kN", "next");        CONDITIONAL_REASSIGN ("%5", "kN", "next");
1573        /* if there's no key_prev keycap, map key_ppage to `previous' keysym */        /* if there's no key_prev keycap, map key_ppage to `previous' keysym */
# Line 1607  static void append_glyph P_ ((struct it Line 1607  static void append_glyph P_ ((struct it
1607     for which to produce glyphs; IT->face_id contains the character's     for which to produce glyphs; IT->face_id contains the character's
1608     face.  Padding glyphs are appended if IT->c has a IT->pixel_width >     face.  Padding glyphs are appended if IT->c has a IT->pixel_width >
1609     1.  */     1.  */
1610      
1611  static void  static void
1612  append_glyph (it)  append_glyph (it)
1613       struct it *it;       struct it *it;
# Line 1620  append_glyph (it) Line 1620  append_glyph (it)
1620             + it->glyph_row->used[it->area]);             + it->glyph_row->used[it->area]);
1621    end = it->glyph_row->glyphs[1 + it->area];    end = it->glyph_row->glyphs[1 + it->area];
1622    
1623    for (i = 0;    for (i = 0;
1624         i < it->pixel_width && glyph < end;         i < it->pixel_width && glyph < end;
1625         ++i)         ++i)
1626      {      {
1627        glyph->type = CHAR_GLYPH;        glyph->type = CHAR_GLYPH;
# Line 1631  append_glyph (it) Line 1631  append_glyph (it)
1631        glyph->padding_p = i > 0;        glyph->padding_p = i > 0;
1632        glyph->charpos = CHARPOS (it->position);        glyph->charpos = CHARPOS (it->position);
1633        glyph->object = it->object;        glyph->object = it->object;
1634          
1635        ++it->glyph_row->used[it->area];        ++it->glyph_row->used[it->area];
1636        ++glyph;        ++glyph;
1637      }      }
# Line 1656  append_glyph (it) Line 1656  append_glyph (it)
1656     Callers usually don't call produce_glyphs directly;     Callers usually don't call produce_glyphs directly;
1657     instead they use the macro PRODUCE_GLYPHS.  */     instead they use the macro PRODUCE_GLYPHS.  */
1658    
1659  void  void
1660  produce_glyphs (it)  produce_glyphs (it)
1661       struct it *it;       struct it *it;
1662  {  {
# Line 1665  produce_glyphs (it) Line 1665  produce_glyphs (it)
1665             || it->what == IT_COMPOSITION             || it->what == IT_COMPOSITION
1666             || it->what == IT_IMAGE             || it->what == IT_IMAGE
1667             || it->what == IT_STRETCH);             || it->what == IT_STRETCH);
1668      
1669    /* Nothing but characters are supported on terminal frames.  For a    /* Nothing but characters are supported on terminal frames.  For a
1670       composition sequence, it->c is the first character of the       composition sequence, it->c is the first character of the
1671       sequence.  */       sequence.  */
# Line 1684  produce_glyphs (it) Line 1684  produce_glyphs (it)
1684      {      {
1685        int absolute_x = (it->current_x        int absolute_x = (it->current_x
1686                          + it->continuation_lines_width);                          + it->continuation_lines_width);
1687        int next_tab_x        int next_tab_x
1688          = (((1 + absolute_x + it->tab_width - 1)          = (((1 + absolute_x + it->tab_width - 1)
1689              / it->tab_width)              / it->tab_width)
1690             * it->tab_width);             * it->tab_width);
1691        int nspaces;        int nspaces;
# Line 1696  produce_glyphs (it) Line 1696  produce_glyphs (it)
1696           continued line.  So, we will get the right number of spaces           continued line.  So, we will get the right number of spaces
1697           here.  */           here.  */
1698        nspaces = next_tab_x - absolute_x;        nspaces = next_tab_x - absolute_x;
1699          
1700        if (it->glyph_row)        if (it->glyph_row)
1701          {          {
1702            int n = nspaces;            int n = nspaces;
1703              
1704            it->c = ' ';            it->c = ' ';
1705            it->pixel_width = it->len = 1;            it->pixel_width = it->len = 1;
1706              
1707            while (n--)            while (n--)
1708              append_glyph (it);              append_glyph (it);
1709              
1710            it->c = '\t';            it->c = '\t';
1711          }          }
1712    
# Line 1734  produce_glyphs (it) Line 1734  produce_glyphs (it)
1734    
1735        it->pixel_width = CHARSET_WIDTH (charset);        it->pixel_width = CHARSET_WIDTH (charset);
1736        it->nglyphs = it->pixel_width;        it->nglyphs = it->pixel_width;
1737          
1738        if (it->glyph_row)        if (it->glyph_row)
1739          append_glyph (it);          append_glyph (it);
1740      }      }
1741    
1742    /* Advance current_x by the pixel width as a convenience for    /* Advance current_x by the pixel width as a convenience for
1743       the caller.  */       the caller.  */
1744    if (it->area == TEXT_AREA)    if (it->area == TEXT_AREA)
1745      it->current_x += it->pixel_width;      it->current_x += it->pixel_width;
# Line 1760  produce_special_glyphs (it, what) Line 1760  produce_special_glyphs (it, what)
1760       enum display_element_type what;       enum display_element_type what;
1761  {  {
1762    struct it temp_it;    struct it temp_it;
1763      
1764    temp_it = *it;    temp_it = *it;
1765    temp_it.dp = NULL;    temp_it.dp = NULL;
1766    temp_it.what = IT_CHARACTER;    temp_it.what = IT_CHARACTER;
# Line 1780  produce_special_glyphs (it, what) Line 1780  produce_special_glyphs (it, what)
1780          }          }
1781        else        else
1782          temp_it.c = '\\';          temp_it.c = '\\';
1783          
1784        produce_glyphs (&temp_it);        produce_glyphs (&temp_it);
1785        it->pixel_width = temp_it.pixel_width;        it->pixel_width = temp_it.pixel_width;
1786        it->nglyphs = temp_it.pixel_width;        it->nglyphs = temp_it.pixel_width;
# Line 1797  produce_special_glyphs (it, what) Line 1797  produce_special_glyphs (it, what)
1797          }          }
1798        else        else
1799          temp_it.c = '$';          temp_it.c = '$';
1800          
1801        produce_glyphs (&temp_it);        produce_glyphs (&temp_it);
1802        it->pixel_width = temp_it.pixel_width;        it->pixel_width = temp_it.pixel_width;
1803        it->nglyphs = temp_it.pixel_width;        it->nglyphs = temp_it.pixel_width;
# Line 1918  turn_on_face (f, face_id) Line 1918  turn_on_face (f, face_id)
1918    if (TN_max_colors > 0)    if (TN_max_colors > 0)
1919      {      {
1920        char *p;        char *p;
1921          
1922        if (fg >= 0 && TS_set_foreground)        if (fg >= 0 && TS_set_foreground)
1923          {          {
1924            p = tparam (TS_set_foreground, NULL, 0, (int) fg);            p = tparam (TS_set_foreground, NULL, 0, (int) fg);
# Line 1934  turn_on_face (f, face_id) Line 1934  turn_on_face (f, face_id)
1934          }          }
1935      }      }
1936  }  }
1937      
1938    
1939  /* Turn off appearances of face FACE_ID on tty frame F.  */  /* Turn off appearances of face FACE_ID on tty frame F.  */
1940    
# Line 1986  turn_off_face (f, face_id) Line 1986  turn_off_face (f, face_id)
1986                && face->background != FACE_TTY_DEFAULT_BG_COLOR)))                && face->background != FACE_TTY_DEFAULT_BG_COLOR)))
1987      OUTPUT1_IF (TS_orig_pair);      OUTPUT1_IF (TS_orig_pair);
1988  }  }
1989      
1990        
1991  /* Return non-zero if the terminal on frame F supports all of the  /* Return non-zero if the terminal on frame F supports all of the
1992     capabilities in CAPS simultaneously, with foreground and background     capabilities in CAPS simultaneously, with foreground and background
1993     colors FG and BG.  */     colors FG and BG.  */
# Line 2316  to do `unset TERMCAP' (C-shell: `unseten Line 2316  to do `unset TERMCAP' (C-shell: `unseten
2316    TS_cursor_visible = tgetstr ("vs", address);    TS_cursor_visible = tgetstr ("vs", address);
2317    TS_cursor_invisible = tgetstr ("vi", address);    TS_cursor_invisible = tgetstr ("vi", address);
2318    TS_set_window = tgetstr ("wi", address);    TS_set_window = tgetstr ("wi", address);
2319      
2320    TS_enter_underline_mode = tgetstr ("us", address);    TS_enter_underline_mode = tgetstr ("us", address);
2321    TS_exit_underline_mode = tgetstr ("ue", address);    TS_exit_underline_mode = tgetstr ("ue", address);
2322    TS_enter_bold_mode = tgetstr ("md", address);    TS_enter_bold_mode = tgetstr ("md", address);
# Line 2326  to do `unset TERMCAP' (C-shell: `unseten Line 2326  to do `unset TERMCAP' (C-shell: `unseten
2326    TS_enter_alt_charset_mode = tgetstr ("as", address);    TS_enter_alt_charset_mode = tgetstr ("as", address);
2327    TS_exit_alt_charset_mode = tgetstr ("ae", address);    TS_exit_alt_charset_mode = tgetstr ("ae", address);
2328    TS_exit_attribute_mode = tgetstr ("me", address);    TS_exit_attribute_mode = tgetstr ("me", address);
2329      
2330    MultiUp = tgetstr ("UP", address);    MultiUp = tgetstr ("UP", address);
2331    MultiDown = tgetstr ("DO", address);    MultiDown = tgetstr ("DO", address);
2332    MultiLeft = tgetstr ("LE", address);    MultiLeft = tgetstr ("LE", address);
# Line 2346  to do `unset TERMCAP' (C-shell: `unseten Line 2346  to do `unset TERMCAP' (C-shell: `unseten
2346            TS_set_foreground = tgetstr ("Sf", address);            TS_set_foreground = tgetstr ("Sf", address);
2347            TS_set_background = tgetstr ("Sb", address);            TS_set_background = tgetstr ("Sb", address);
2348          }          }
2349          
2350        TN_max_colors = tgetnum ("Co");        TN_max_colors = tgetnum ("Co");
2351        TN_max_pairs = tgetnum ("pa");        TN_max_pairs = tgetnum ("pa");
2352          
2353        TN_no_color_video = tgetnum ("NC");        TN_no_color_video = tgetnum ("NC");
2354        if (TN_no_color_video == -1)        if (TN_no_color_video == -1)
2355          TN_no_color_video = 0;          TN_no_color_video = 0;
# Line 2387  to do `unset TERMCAP' (C-shell: `unseten Line 2387  to do `unset TERMCAP' (C-shell: `unseten
2387      SET_FRAME_WIDTH (sf, FRAME_WIDTH (sf));      SET_FRAME_WIDTH (sf, FRAME_WIDTH (sf));
2388    if (FRAME_HEIGHT (sf) <= 0)    if (FRAME_HEIGHT (sf) <= 0)
2389      FRAME_HEIGHT (sf) = tgetnum ("li");      FRAME_HEIGHT (sf) = tgetnum ("li");
2390      
2391    if (FRAME_HEIGHT (sf) < 3 || FRAME_WIDTH (sf) < 3)    if (FRAME_HEIGHT (sf) < 3 || FRAME_WIDTH (sf) < 3)
2392      fatal ("Screen size %dx%d is too small",      fatal ("Screen size %dx%d is too small",
2393             FRAME_HEIGHT (sf), FRAME_WIDTH (sf));             FRAME_HEIGHT (sf), FRAME_WIDTH (sf));
# Line 2414  to do `unset TERMCAP' (C-shell: `unseten Line 2414  to do `unset TERMCAP' (C-shell: `unseten
2414    
2415    if (TabWidth < 0)    if (TabWidth < 0)
2416      TabWidth = 8;      TabWidth = 8;
2417      
2418  /* Turned off since /etc/termcap seems to have :ta= for most terminals  /* Turned off since /etc/termcap seems to have :ta= for most terminals
2419     and newer termcap doc does not seem to say there is a default.     and newer termcap doc does not seem to say there is a default.
2420    if (!Wcm.cm_tab)    if (!Wcm.cm_tab)

Legend:
Removed from v.1.143  
changed lines
  Added in v.1.144

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26