aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md17
-rw-r--r--vterm-module.c18
-rw-r--r--vterm.el18
3 files changed, 40 insertions, 13 deletions
diff --git a/README.md b/README.md
index 7d5833b..750edd0 100644
--- a/README.md
+++ b/README.md
@@ -459,7 +459,7 @@ C-c`.
## Fonts
-If you would like to change the font or face used in a vterm, use the following code:
+You can change the font (the _face_) used in a vterm with the following code:
``` emacs
(add-hook 'vterm-mode-hook
@@ -468,8 +468,14 @@ If you would like to change the font or face used in a vterm, use the following
(buffer-face-mode t)))
```
-The above would change change the font in vterm buffers to a mono-spaced font
-(the `fixed-pitch` face) if your default font in Emacs is a proportional font.
+Where instead of `'fixed-pitch` you specify the face you want to use. The
+example reported here can be used to force vterm to use a mono-spaced font (the
+`fixed-pitch` face). This is useful when your default font in Emacs is a
+proportional font.
+
+In addition to that, you can disable some text properties (bold, underline,
+reverse video) setting the relative option to `t` (`vterm-disable-bold`,
+`vterm-disable-underline`, or `vterm-disable-inverse-video`).
## Colors
@@ -826,6 +832,11 @@ not appropriate in some cases like terminals."
Obsolete variables will be removed in version 0.1.
+#### October 2020
+
+* `vterm-disable-bold-font` was renamed to `vterm-disable-bold` to uniform it
+ with the other similar options.
+
#### July 2020
* `vterm-use-vterm-prompt` was renamed to `vterm-use-vterm-prompt-detection-method`.
diff --git a/vterm-module.c b/vterm-module.c
index dd0bec0..7bdd635 100644
--- a/vterm-module.c
+++ b/vterm-module.c
@@ -700,11 +700,18 @@ static emacs_value render_text(emacs_env *env, Term *term, char *buffer,
emacs_value fg = cell_rgb_color(env, term, cell, true);
emacs_value bg = cell_rgb_color(env, term, cell, false);
+ /* With vterm-disable-bold-font, vterm-disable-underline,
+ * vterm-disable-inverse-video, users can disable some text properties.
+ * Here, we check whether the text would require adding such properties.
+ * In case it does, and the user does not disable the attribute, we later
+ * append the property to the list props. If the text does not require
+ * such property, or the user disable it, we set the variable to nil.
+ * Properties that are marked as nil are not added to the text. */
emacs_value bold =
- cell->attrs.bold && !term->disable_bold_font ? Qbold : Qnormal;
+ cell->attrs.bold && !term->disable_bold_font ? Qbold : Qnil;
emacs_value underline =
cell->attrs.underline && !term->disable_underline ? Qt : Qnil;
- emacs_value italic = cell->attrs.italic ? Qitalic : Qnormal;
+ emacs_value italic = cell->attrs.italic ? Qitalic : Qnil;
emacs_value reverse =
cell->attrs.reverse && !term->disable_inverse_video ? Qt : Qnil;
emacs_value strike = cell->attrs.strike ? Qt : Qnil;
@@ -718,11 +725,11 @@ static emacs_value render_text(emacs_env *env, Term *term, char *buffer,
props[props_len++] = Qforeground, props[props_len++] = fg;
if (env->is_not_nil (env, bg))
props[props_len++] = Qbackground, props[props_len++] = bg;
- if (bold != Qnormal)
+ if (bold != Qnil)
props[props_len++] = Qweight, props[props_len++] = bold;
if (underline != Qnil)
props[props_len++] = Qunderline, props[props_len++] = underline;
- if (italic != Qnormal)
+ if (italic != Qnil)
props[props_len++] = Qslant, props[props_len++] = italic;
if (reverse != Qnil)
props[props_len++] = Qreverse, props[props_len++] = reverse;
@@ -733,7 +740,8 @@ static emacs_value render_text(emacs_env *env, Term *term, char *buffer,
properties = list (env, props, props_len);
- put_text_property(env, text, Qface, properties);
+ if (props_len)
+ put_text_property(env, text, Qface, properties);
return text;
}
diff --git a/vterm.el b/vterm.el
index 74a66cf..bb880bc 100644
--- a/vterm.el
+++ b/vterm.el
@@ -317,20 +317,28 @@ The need for an explicit map is to avoid arbitrary code execution."
:group 'vterm)
(defcustom vterm-disable-underline nil
- "Disable underline for the cells with underline attribute."
+ "When not-nil, underline text properties are ignored.
+
+This means that vterm will render underlined text as if it was not
+underlined."
:type 'boolean
:group 'vterm)
(defcustom vterm-disable-inverse-video nil
- "Disable inverse video for the cells with inverse video attribute."
+ "When not-nil, inverse video text properties are ignored.
+
+This means that vterm will render reversed video text as if it was not
+such."
:type 'boolean
:group 'vterm)
+(define-obsolete-variable-alias 'vterm-disable-bold-font
+ 'vterm-disable-bold "0.0.1")
+
(defcustom vterm-disable-bold-font nil
- "Disable bold fonts or not.
+ "When not-nil, bold text properties are ignored.
-When `vterm-disable-bold-font' is set to t, bold fonts are
-rendered as normal ones."
+This means that vterm will render bold with the default face weight."
:type 'boolean
:group 'vterm)