From a2937e2731bdfbd161d1fb8292a1787fcf279dab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81=20Ko=CC=88cher?= Date: Fri, 13 Nov 2015 23:02:11 +0100 Subject: [PATCH 1/4] Add documentation macligatures option (#129). --- runtime/doc/gui_mac.txt | 2 +- runtime/doc/options.txt | 17 +++++++++++++++++ 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/runtime/doc/gui_mac.txt b/runtime/doc/gui_mac.txt index a3d3ea729c..012c2a0031 100644 --- a/runtime/doc/gui_mac.txt +++ b/runtime/doc/gui_mac.txt @@ -111,7 +111,7 @@ to your .gvimrc file to revert back to the default Vim tab label. *macvim-options* These are the non-standard options that MacVim supports: 'antialias' 'blurradius' 'fullscreen' - 'fuoptions' 'macmeta' 'toolbariconsize' + 'fuoptions' 'macmeta' 'macligatures' 'toolbariconsize' 'transparency' *macvim-commands* diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt index ffa5b679a1..830bb50e31 100644 --- a/runtime/doc/options.txt +++ b/runtime/doc/options.txt @@ -4997,6 +4997,23 @@ A jump table for the options with a short description can be found at |Q_op|. bound with the Meta flag even when this option is disabled, but this is not the case for the majority of keys (e.g. , ). + *'macligatures'* *'nomacligatures'* +'macligatures' boolean (default off) + global + {not in Vi} + {only available when compiled with GUI enabled on + Mac OS X} + This option only has an effect in the GUI version of Vim on Mac OS X + v10.2 or later. When on, Vim will display ligatures if the selected + 'guifont' supports them. Examples for such fonts are Fira Code or + Haskelig. + Note: Currently this option only has an effect if + 'Use Core Text renderer' is enabled in the GUI preferences pane. + + Support for this option is not flawless in MacVim. In particular it + currently requires the use of 'cursorline' or 'relativenumber' to draw + properly. + *'magic'* *'nomagic'* 'magic' boolean (default on) global From 0563b553349825a48331438df78be9f1abf16163 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81=20Ko=CC=88cher?= Date: Sat, 14 Nov 2015 13:46:57 +0100 Subject: [PATCH 2/4] Make p_macligatures available outside options.c --- src/option.c | 1 - src/option.h | 3 +++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/option.c b/src/option.c index 4143bb2020..45c5c7c303 100644 --- a/src/option.c +++ b/src/option.c @@ -344,7 +344,6 @@ static int p_lisp; static int p_ml; static int p_ma; #ifdef FEAT_GUI_MACVIM -static int p_macligatures; static int p_mmta; #endif static int p_mod; diff --git a/src/option.h b/src/option.h index 752b6a36bf..2c3f7fb71c 100644 --- a/src/option.h +++ b/src/option.h @@ -644,6 +644,9 @@ EXTERN char_u *p_luadll; /* 'luadll' */ #ifdef FEAT_GUI_MAC EXTERN int p_macatsui; /* 'macatsui' */ #endif +#ifdef FEAT_GUI_MACVIM +EXTERN int p_macligatures; /* 'macligatures' */ +#endif EXTERN int p_magic; /* 'magic' */ #ifdef FEAT_QUICKFIX EXTERN char_u *p_mef; /* 'makeef' */ From f538ee38f3e356cc9e0fe1107b9f5d17d2e6cc85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rene=CC=81=20Ko=CC=88cher?= Date: Sat, 14 Nov 2015 13:47:20 +0100 Subject: [PATCH 3/4] Add additional redraw checks for macligatures. --- src/move.c | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/move.c b/src/move.c index bc6a1207cd..56d0f4ae10 100644 --- a/src/move.c +++ b/src/move.c @@ -107,6 +107,9 @@ comp_botline(wp) wp->w_cline_folded = folded; #endif redraw_for_cursorline(wp); +#ifdef FEATU_GUI_MACVIM + redraw_for_ligatures(wp); +#endif wp->w_valid |= (VALID_CROW|VALID_CHEIGHT); } if (done + n > wp->w_height) @@ -145,6 +148,29 @@ redraw_for_cursorline(wp) redraw_win_later(wp, SOME_VALID); } +#ifdef FEAT_GUI_MACVIM +/* + * Redraw when 'macliguters' is set. + * This is basically the same as when 'cursorline' + * or 'relativenumber' is set but unconditional. + */ +static void +redraw_for_ligatures(wp) + win_T *wp; +{ + /* Only if ligatures are on but neither + * 'cursorline' nor 'relativenumber'. + */ + if (p_macligatures + && (wp->w_p_rnu == 0 +#ifdef FEAT_SYN_HL + || wp->w_p_cul == 0 +#endif + )) + redraw_win_later(wp, CLEAR); +} +#endif + /* * Update curwin->w_topline and redraw if necessary. * Used to update the screen before printing a message. @@ -793,6 +819,9 @@ curs_rows(wp) } redraw_for_cursorline(curwin); +#ifdef FEAT_GUI_MACVIM + redraw_for_ligatures(curwin); +#endif wp->w_valid |= VALID_CROW|VALID_CHEIGHT; } From 0a0c7a7795f7da8172ca5076d9f51986e424c9c0 Mon Sep 17 00:00:00 2001 From: Shirk Date: Sat, 14 Nov 2015 13:56:10 +0100 Subject: [PATCH 4/4] Fix logic when checking for w_p_rnu && w_p_cul. --- src/move.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/move.c b/src/move.c index 56d0f4ae10..de84455031 100644 --- a/src/move.c +++ b/src/move.c @@ -21,6 +21,9 @@ static void comp_botline __ARGS((win_T *wp)); static void redraw_for_cursorline __ARGS((win_T *wp)); +#ifdef FEAT_GUI_MACVIM +static void redraw_for_ligatures __ARGS((win_T *wp)); +#endif static int scrolljump_value __ARGS((void)); static int check_top_offset __ARGS((void)); static void curs_rows __ARGS((win_T *wp)); @@ -164,7 +167,7 @@ redraw_for_ligatures(wp) if (p_macligatures && (wp->w_p_rnu == 0 #ifdef FEAT_SYN_HL - || wp->w_p_cul == 0 + && wp->w_p_cul == 0 #endif )) redraw_win_later(wp, CLEAR);