# HG changeset patch
# Parent 4788b87d17786243e3d3b6fca78c4ff73026644b
implement 'charspace' for Windows GUI
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 8598713bc..1d83efb2a 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1498,6 +1498,20 @@ A jump table for the options with a short description can be found at |Q_op|.
This option cannot be set from a |modeline| or in the |sandbox|, for
security reasons.
+
*'charspace'* *'csp'*
+'charspace' 'csp'
number (default: 0)
+
global
+
{not in Vi}
+
{only in Windows GUI version and when compiled with
+
the |+kaoriya| feature}
+
Number of horizontal pixels inserted between characters. Useful if
+
the font uses the full character cell width, making characters touch
+
each other.
+
When non-zero there is room for side of characters.
+
With some fonts there can be too much room between characters (to
+
have space for left and right). Then it make sense to set 'charspace'
+
to a negative value. This may cause display problems though!
+
*'cindent'* *'cin'* *'nocindent'* *'nocin'*
'cindent' 'cin'
boolean
(default off)
local to buffer
diff --git a/src/gui_w32.c b/src/gui_w32.c
index d9d835bd7..10c495c45 100644
--- a/src/gui_w32.c
+++ b/src/gui_w32.c
@@ -1472,6 +1472,8 @@ GetFontSize(GuiFont font)
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz",
52, &size);
gui.char_width = (
size.cx / 26 + 1) / 2 + tm.tmOverhang;
+ // add extra pixels for 'charspace' option.
+ gui.char_width += p_charspace;
gui.char_height = tm.tmHeight + p_linespace;
diff --git a/src/option.c b/src/option.c
index c581e47a1..93de1e307 100644
--- a/src/option.c
+++ b/src/option.c
@@ -3256,7 +3256,7 @@ set_num_option(
}
#ifdef FEAT_GUI
- else if (pp == &p_linespace)
+ else if (pp == &p_linespace || pp == &p_charspace)
{
// Recompute gui.char_height and resize the Vim window to keep the
// same number of lines.
diff --git a/src/option.h b/src/option.h
index 27aae4099..0844b743c 100644
--- a/src/option.h
+++ b/src/option.h
@@ -456,6 +456,9 @@ EXTERN int
p_deco;
// 'delcombine'
#ifdef FEAT_EVAL
EXTERN char_u
*p_ccv;
// 'charconvert'
#endif
+#ifdef FEAT_GUI
+EXTERN long
p_charspace;
// 'charspace'
+#endif
EXTERN char_u
*p_cino;
// 'cinoptions'
#ifdef FEAT_CMDWIN
EXTERN char_u
*p_cedit;
// 'cedit'
diff --git a/src/optiondefs.h b/src/optiondefs.h
index 6e9701ab3..e0c893f0d 100644
--- a/src/optiondefs.h
+++ b/src/optiondefs.h
@@ -566,6 +566,14 @@ static struct vimoption options[] =
{(char_u *)0L, (char_u *)0L}
#endif
SCTX_INIT},
+ {"charspace", "csp", P_NUM|P_NODEFAULT|P_VIM|P_RCLR,
+#ifdef FEAT_GUI
+
(char_u *)&p_charspace, PV_NONE,
+#else
+
(char_u *)NULL, PV_NONE,
+#endif
+
{(char_u *)0L, (char_u *)0L}
+
SCTX_INIT},
{"cindent",
"cin", P_BOOL|P_VI_DEF|P_VIM,
#ifdef FEAT_CINDENT
(char_u *)&p_cin, PV_CIN,