Mercurial > vim
comparison src/term.c @ 14867:cf4d6489c9eb v8.1.0445
patch 8.1.0445: setting 'term' does not store location for termcap options
commit https://github.com/vim/vim/commit/35bc7d6c52f516b60d683bf9f0f57266d86e25b9
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Oct 2 14:45:10 2018 +0200
patch 8.1.0445: setting 'term' does not store location for termcap options
Problem: Setting 'term' does not store location for termcap options.
Solution: Set the script context for termcap options that are changed when
'term' is set.
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Tue, 02 Oct 2018 15:00:07 +0200 |
parents | 27b9a84395b5 |
children | 6fcfff2b4ba5 |
comparison
equal
deleted
inserted
replaced
14866:2cc6cfa2b804 | 14867:cf4d6489c9eb |
---|---|
1469 { | 1469 { |
1470 /* Only set the value if it wasn't set yet. */ | 1470 /* Only set the value if it wasn't set yet. */ |
1471 if (term_strings[p->bt_entry] == NULL | 1471 if (term_strings[p->bt_entry] == NULL |
1472 || term_strings[p->bt_entry] == empty_option) | 1472 || term_strings[p->bt_entry] == empty_option) |
1473 { | 1473 { |
1474 #ifdef FEAT_EVAL | |
1475 int opt_idx = -1; | |
1476 #endif | |
1474 /* 8bit terminal: use CSI instead of <Esc>[ */ | 1477 /* 8bit terminal: use CSI instead of <Esc>[ */ |
1475 if (term_8bit && term_7to8bit((char_u *)p->bt_string) != 0) | 1478 if (term_8bit && term_7to8bit((char_u *)p->bt_string) != 0) |
1476 { | 1479 { |
1477 char_u *s, *t; | 1480 char_u *s, *t; |
1478 | 1481 |
1484 { | 1487 { |
1485 *t = term_7to8bit(t); | 1488 *t = term_7to8bit(t); |
1486 STRMOVE(t + 1, t + 2); | 1489 STRMOVE(t + 1, t + 2); |
1487 } | 1490 } |
1488 term_strings[p->bt_entry] = s; | 1491 term_strings[p->bt_entry] = s; |
1489 set_term_option_alloced(&term_strings[p->bt_entry]); | 1492 #ifdef FEAT_EVAL |
1493 opt_idx = | |
1494 #endif | |
1495 set_term_option_alloced( | |
1496 &term_strings[p->bt_entry]); | |
1490 } | 1497 } |
1491 } | 1498 } |
1492 else | 1499 else |
1500 { | |
1493 term_strings[p->bt_entry] = (char_u *)p->bt_string; | 1501 term_strings[p->bt_entry] = (char_u *)p->bt_string; |
1502 #ifdef FEAT_EVAL | |
1503 opt_idx = get_term_opt_idx(&term_strings[p->bt_entry]); | |
1504 #endif | |
1505 } | |
1506 #ifdef FEAT_EVAL | |
1507 set_term_option_sctx_idx(NULL, opt_idx); | |
1508 #endif | |
1494 } | 1509 } |
1495 } | 1510 } |
1496 else | 1511 else |
1497 { | 1512 { |
1498 name[0] = KEY2TERMCAP0((int)p->bt_entry); | 1513 name[0] = KEY2TERMCAP0((int)p->bt_entry); |
1614 */ | 1629 */ |
1615 for (i = 0; string_names[i].name != NULL; ++i) | 1630 for (i = 0; string_names[i].name != NULL; ++i) |
1616 { | 1631 { |
1617 if (TERM_STR(string_names[i].dest) == NULL | 1632 if (TERM_STR(string_names[i].dest) == NULL |
1618 || TERM_STR(string_names[i].dest) == empty_option) | 1633 || TERM_STR(string_names[i].dest) == empty_option) |
1634 { | |
1619 TERM_STR(string_names[i].dest) = TGETSTR(string_names[i].name, &tp); | 1635 TERM_STR(string_names[i].dest) = TGETSTR(string_names[i].name, &tp); |
1636 #ifdef FEAT_EVAL | |
1637 set_term_option_sctx_idx(string_names[i].name, -1); | |
1638 #endif | |
1639 } | |
1620 } | 1640 } |
1621 | 1641 |
1622 /* tgetflag() returns 1 if the flag is present, 0 if not and | 1642 /* tgetflag() returns 1 if the flag is present, 0 if not and |
1623 * possibly -1 if the flag doesn't exist. */ | 1643 * possibly -1 if the flag doesn't exist. */ |
1624 if ((T_MS == NULL || T_MS == empty_option) && tgetflag("ms") > 0) | 1644 if ((T_MS == NULL || T_MS == empty_option) && tgetflag("ms") > 0) |
1656 | 1676 |
1657 /* | 1677 /* |
1658 * Get number of colors (if not done already). | 1678 * Get number of colors (if not done already). |
1659 */ | 1679 */ |
1660 if (TERM_STR(KS_CCO) == NULL || TERM_STR(KS_CCO) == empty_option) | 1680 if (TERM_STR(KS_CCO) == NULL || TERM_STR(KS_CCO) == empty_option) |
1681 { | |
1661 set_color_count(tgetnum("Co")); | 1682 set_color_count(tgetnum("Co")); |
1683 #ifdef FEAT_EVAL | |
1684 set_term_option_sctx_idx("Co", -1); | |
1685 #endif | |
1686 } | |
1662 | 1687 |
1663 # ifndef hpux | 1688 # ifndef hpux |
1664 BC = (char *)TGETSTR("bc", &tp); | 1689 BC = (char *)TGETSTR("bc", &tp); |
1665 UP = (char *)TGETSTR("up", &tp); | 1690 UP = (char *)TGETSTR("up", &tp); |
1666 p = TGETSTR("pc", &tp); | 1691 p = TGETSTR("pc", &tp); |