comparison src/drawline.c @ 18570:0ac88fdbf089 v8.1.2279

patch 8.1.2279: computation of highlight attributes is too complicated Commit: https://github.com/vim/vim/commit/dbd4316806389e3c2240b48cc6c4d209cb1665fd Author: Bram Moolenaar <Bram@vim.org> Date: Sat Nov 9 21:28:14 2019 +0100 patch 8.1.2279: computation of highlight attributes is too complicated Problem: Computation of highlight attributes is too complicated. Solution: Simplify the attribute computation and make it more consistent. (closes #5190) Fix that 'combine' set to zero doesn't work.
author Bram Moolenaar <Bram@vim.org>
date Sat, 09 Nov 2019 21:30:03 +0100
parents 3ebb15e3c28d
children 8b0114ffde2b
comparison
equal deleted inserted replaced
18569:404b9c998acf 18570:0ac88fdbf089
1468 else 1468 else
1469 syntax_flags = get_syntax_info(&syntax_seqnr); 1469 syntax_flags = get_syntax_info(&syntax_seqnr);
1470 # endif 1470 # endif
1471 } 1471 }
1472 } 1472 }
1473 # ifdef FEAT_TEXT_PROP
1474 // Combine text property highlight into syntax highlight.
1475 if (text_prop_type != NULL)
1476 {
1477 if (text_prop_combine)
1478 syntax_attr = hl_combine_attr(syntax_attr, text_prop_attr);
1479 else
1480 syntax_attr = text_prop_attr;
1481 }
1482 # endif
1473 #endif 1483 #endif
1474 1484
1475 // Decide which of the highlight attributes to use. 1485 // Decide which of the highlight attributes to use.
1476 attr_pri = TRUE; 1486 attr_pri = TRUE;
1477 #ifdef LINE_ATTR 1487 #ifdef LINE_ATTR
1478 if (area_attr != 0) 1488 if (area_attr != 0)
1479 { 1489 {
1480 char_attr = hl_combine_attr(line_attr, area_attr); 1490 char_attr = hl_combine_attr(line_attr, area_attr);
1481 # ifdef FEAT_SYN_HL 1491 # ifdef FEAT_SYN_HL
1482 if (syntax_attr != 0) 1492 char_attr = hl_combine_attr(syntax_attr, char_attr);
1483 char_attr = hl_combine_attr(syntax_attr, char_attr);
1484 # endif 1493 # endif
1485 } 1494 }
1486 else if (search_attr != 0) 1495 else if (search_attr != 0)
1487 { 1496 {
1488 char_attr = hl_combine_attr(line_attr, search_attr); 1497 char_attr = hl_combine_attr(line_attr, search_attr);
1489 # ifdef FEAT_SYN_HL 1498 # ifdef FEAT_SYN_HL
1490 if (syntax_attr != 0) 1499 char_attr = hl_combine_attr(syntax_attr, char_attr);
1491 char_attr = hl_combine_attr(syntax_attr, char_attr); 1500 # endif
1492 # endif 1501 }
1493 }
1494 # ifdef FEAT_TEXT_PROP
1495 else if (text_prop_type != NULL)
1496 {
1497 char_attr = hl_combine_attr(line_attr != 0
1498 ? line_attr
1499 : syntax_attr != 0
1500 ? syntax_attr
1501 : win_attr, text_prop_attr);
1502 }
1503 # endif
1504 else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL) 1502 else if (line_attr != 0 && ((fromcol == -10 && tocol == MAXCOL)
1505 || vcol < fromcol || vcol_prev < fromcol_prev 1503 || vcol < fromcol || vcol_prev < fromcol_prev
1506 || vcol >= tocol)) 1504 || vcol >= tocol))
1507 { 1505 {
1508 // Use line_attr when not in the Visual or 'incsearch' area 1506 // Use line_attr when not in the Visual or 'incsearch' area
1509 // (area_attr may be 0 when "noinvcur" is set). 1507 // (area_attr may be 0 when "noinvcur" is set).
1510 # ifdef FEAT_SYN_HL 1508 # ifdef FEAT_SYN_HL
1511 if (syntax_attr != 0) 1509 char_attr = hl_combine_attr(syntax_attr, line_attr);
1512 char_attr = hl_combine_attr(syntax_attr, line_attr); 1510 # else
1513 else 1511 char_attr = line_attr;
1514 # endif 1512 # endif
1515 char_attr = line_attr;
1516 attr_pri = FALSE; 1513 attr_pri = FALSE;
1517 } 1514 }
1518 #else 1515 #else
1519 if (area_attr != 0) 1516 if (area_attr != 0)
1520 char_attr = area_attr; 1517 char_attr = area_attr;
1522 char_attr = search_attr; 1519 char_attr = search_attr;
1523 #endif 1520 #endif
1524 else 1521 else
1525 { 1522 {
1526 attr_pri = FALSE; 1523 attr_pri = FALSE;
1527 #ifdef FEAT_TEXT_PROP
1528 if (text_prop_type != NULL)
1529 {
1530 if (text_prop_combine)
1531 char_attr = hl_combine_attr(
1532 syntax_attr, text_prop_attr);
1533 else
1534 char_attr = hl_combine_attr(
1535 win_attr, text_prop_attr);
1536 }
1537 else
1538 #endif
1539 #ifdef FEAT_SYN_HL 1524 #ifdef FEAT_SYN_HL
1540 char_attr = syntax_attr; 1525 char_attr = syntax_attr;
1541 #else 1526 #else
1542 char_attr = 0; 1527 char_attr = 0;
1543 #endif 1528 #endif
1544 } 1529 }
1545 } 1530 }
1546 1531
1547 // combine attribute with 'wincolor' 1532 // combine attribute with 'wincolor'