some patches and configuration for st terminal emulator
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

st-bright-bold-text.patch 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. --- a/config.def.h
  2. +++ b/config.def.h
  3. @@ -114,9 +114,10 @@ static const char *colorname[] = {
  4. /*
  5. * Default colors (colorname index)
  6. - * foreground, background, cursor, reverse cursor
  7. + * foreground, default color for bold text, background, cursor, reverse cursor
  8. */
  9. unsigned int defaultfg = 7;
  10. +unsigned int defaultbd = 15;
  11. unsigned int defaultbg = 0;
  12. static unsigned int defaultcs = 256;
  13. static unsigned int defaultrcs = 257;
  14. --- a/st.c
  15. +++ b/st.c
  16. @@ -1378,9 +1378,12 @@ tsetattr(int *attr, int l)
  17. ATTR_STRUCK );
  18. term.c.attr.fg = defaultfg;
  19. term.c.attr.bg = defaultbg;
  20. + term.c.attr.colored = 0;
  21. break;
  22. case 1:
  23. term.c.attr.mode |= ATTR_BOLD;
  24. + if (!term.c.attr.colored)
  25. + term.c.attr.fg = defaultbd;
  26. break;
  27. case 2:
  28. term.c.attr.mode |= ATTR_FAINT;
  29. @@ -1427,11 +1430,14 @@ tsetattr(int *attr, int l)
  30. term.c.attr.mode &= ~ATTR_STRUCK;
  31. break;
  32. case 38:
  33. - if ((idx = tdefcolor(attr, &i, l)) >= 0)
  34. + if ((idx = tdefcolor(attr, &i, l)) >= 0) {
  35. term.c.attr.fg = idx;
  36. + term.c.attr.colored = 1;
  37. + }
  38. break;
  39. case 39:
  40. term.c.attr.fg = defaultfg;
  41. + term.c.attr.colored = 0;
  42. break;
  43. case 48:
  44. if ((idx = tdefcolor(attr, &i, l)) >= 0)
  45. @@ -1443,10 +1449,12 @@ tsetattr(int *attr, int l)
  46. default:
  47. if (BETWEEN(attr[i], 30, 37)) {
  48. term.c.attr.fg = attr[i] - 30;
  49. + term.c.attr.colored = 1;
  50. } else if (BETWEEN(attr[i], 40, 47)) {
  51. term.c.attr.bg = attr[i] - 40;
  52. } else if (BETWEEN(attr[i], 90, 97)) {
  53. term.c.attr.fg = attr[i] - 90 + 8;
  54. + term.c.attr.colored = 1;
  55. } else if (BETWEEN(attr[i], 100, 107)) {
  56. term.c.attr.bg = attr[i] - 100 + 8;
  57. } else {
  58. --- a/st.h
  59. +++ b/st.h
  60. @@ -65,6 +65,7 @@ typedef struct {
  61. ushort mode; /* attribute flags */
  62. uint32_t fg; /* foreground */
  63. uint32_t bg; /* background */
  64. + int colored; /* tell if the text color set explicitly */
  65. } Glyph;
  66. typedef Glyph *Line;
  67. @@ -119,4 +120,5 @@ extern int allowaltscreen;
  68. extern char *termname;
  69. extern unsigned int tabspaces;
  70. extern unsigned int defaultfg;
  71. +extern unsigned int defaultbd;
  72. extern unsigned int defaultbg;