Skip to content

Commit 2f4d38b

Browse files
committed
Merge pull request #133 from Shirk/feature/macligatures_redraw_additions
Improve redraw behavior when macligatures is active.
2 parents 86347d1 + 0a0c7a7 commit 2f4d38b

File tree

5 files changed

+49
-2
lines changed

5 files changed

+49
-2
lines changed

runtime/doc/gui_mac.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ to your .gvimrc file to revert back to the default Vim tab label.
111111
*macvim-options*
112112
These are the non-standard options that MacVim supports:
113113
'antialias' 'blurradius' 'fullscreen'
114-
'fuoptions' 'macmeta' 'toolbariconsize'
114+
'fuoptions' 'macmeta' 'macligatures' 'toolbariconsize'
115115
'transparency'
116116

117117
*macvim-commands*

runtime/doc/options.txt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4997,6 +4997,19 @@ A jump table for the options with a short description can be found at |Q_op|.
49974997
bound with the Meta flag even when this option is disabled, but this
49984998
is not the case for the majority of keys (e.g. <M-a>, <M-`>).
49994999

5000+
*'macligatures'* *'nomacligatures'*
5001+
'macligatures' boolean (default off)
5002+
global
5003+
{not in Vi}
5004+
{only available when compiled with GUI enabled on
5005+
Mac OS X}
5006+
This option only has an effect in the GUI version of Vim on Mac OS X
5007+
v10.2 or later. When on, Vim will display ligatures if the selected
5008+
'guifont' supports them. Examples for such fonts are Fira Code or
5009+
Haskelig.
5010+
Note: Currently this option only has an effect if
5011+
'Use Core Text renderer' is enabled in the GUI preferences pane.
5012+
50005013
*'magic'* *'nomagic'*
50015014
'magic' boolean (default on)
50025015
global

src/move.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@
2121

2222
static void comp_botline __ARGS((win_T *wp));
2323
static void redraw_for_cursorline __ARGS((win_T *wp));
24+
#ifdef FEAT_GUI_MACVIM
25+
static void redraw_for_ligatures __ARGS((win_T *wp));
26+
#endif
2427
static int scrolljump_value __ARGS((void));
2528
static int check_top_offset __ARGS((void));
2629
static void curs_rows __ARGS((win_T *wp));
@@ -107,6 +110,9 @@ comp_botline(wp)
107110
wp->w_cline_folded = folded;
108111
#endif
109112
redraw_for_cursorline(wp);
113+
#ifdef FEATU_GUI_MACVIM
114+
redraw_for_ligatures(wp);
115+
#endif
110116
wp->w_valid |= (VALID_CROW|VALID_CHEIGHT);
111117
}
112118
if (done + n > wp->w_height)
@@ -145,6 +151,29 @@ redraw_for_cursorline(wp)
145151
redraw_win_later(wp, SOME_VALID);
146152
}
147153

154+
#ifdef FEAT_GUI_MACVIM
155+
/*
156+
* Redraw when 'macliguters' is set.
157+
* This is basically the same as when 'cursorline'
158+
* or 'relativenumber' is set but unconditional.
159+
*/
160+
static void
161+
redraw_for_ligatures(wp)
162+
win_T *wp;
163+
{
164+
/* Only if ligatures are on but neither
165+
* 'cursorline' nor 'relativenumber'.
166+
*/
167+
if (p_macligatures
168+
&& (wp->w_p_rnu == 0
169+
#ifdef FEAT_SYN_HL
170+
&& wp->w_p_cul == 0
171+
#endif
172+
))
173+
redraw_win_later(wp, CLEAR);
174+
}
175+
#endif
176+
148177
/*
149178
* Update curwin->w_topline and redraw if necessary.
150179
* Used to update the screen before printing a message.
@@ -793,6 +822,9 @@ curs_rows(wp)
793822
}
794823

795824
redraw_for_cursorline(curwin);
825+
#ifdef FEAT_GUI_MACVIM
826+
redraw_for_ligatures(curwin);
827+
#endif
796828
wp->w_valid |= VALID_CROW|VALID_CHEIGHT;
797829

798830
}

src/option.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,6 @@ static int p_lisp;
344344
static int p_ml;
345345
static int p_ma;
346346
#ifdef FEAT_GUI_MACVIM
347-
static int p_macligatures;
348347
static int p_mmta;
349348
#endif
350349
static int p_mod;

src/option.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,9 @@ EXTERN char_u *p_luadll; /* 'luadll' */
644644
#ifdef FEAT_GUI_MAC
645645
EXTERN int p_macatsui; /* 'macatsui' */
646646
#endif
647+
#ifdef FEAT_GUI_MACVIM
648+
EXTERN int p_macligatures; /* 'macligatures' */
649+
#endif
647650
EXTERN int p_magic; /* 'magic' */
648651
#ifdef FEAT_QUICKFIX
649652
EXTERN char_u *p_mef; /* 'makeef' */

0 commit comments

Comments
 (0)