• R/O
  • SSH

vim: Commit

Mirror of the Vim source from https://github.com/vim/vim


Commit MetaInfo

Revision79e10adc821dd15f4443b27878cb6b14110b0d59 (tree)
Time2019-12-02 06:15:03
AuthorBram Moolenaar <Bram@vim....>
CommiterBram Moolenaar

Log Message

patch 8.1.2380: using old C style comments

Commit: https://github.com/vim/vim/commit/306139005c31ea7e6f892dd119beba3c94dcb982
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Dec 1 22:11:18 2019 +0100

patch 8.1.2380: using old C style comments
Problem: Using old C style comments.
Solution: Use // comments where appropriate.

Change Summary

Incremental Difference

diff -r 04ce3b8a50ed -r 79e10adc821d src/getchar.c
--- a/src/getchar.c Sun Dec 01 21:45:05 2019 +0100
+++ b/src/getchar.c Sun Dec 01 22:15:03 2019 +0100
@@ -38,13 +38,13 @@
3838 * Un-escaping is done by vgetc().
3939 */
4040
41-#define MINIMAL_SIZE 20 /* minimal size for b_str */
41+#define MINIMAL_SIZE 20 // minimal size for b_str
4242
4343 static buffheader_T redobuff = {{NULL, {NUL}}, NULL, 0, 0};
4444 static buffheader_T old_redobuff = {{NULL, {NUL}}, NULL, 0, 0};
4545 static buffheader_T recordbuff = {{NULL, {NUL}}, NULL, 0, 0};
4646
47-static int typeahead_char = 0; /* typeahead char that's not flushed */
47+static int typeahead_char = 0; // typeahead char that's not flushed
4848
4949 /*
5050 * when block_redo is TRUE redo buffer will not be changed
@@ -73,20 +73,19 @@
7373 * typebuf.tb_noremap[typebuf.tb_off] is the first valid flag.
7474 * (typebuf has been put in globals.h, because check_termcode() needs it).
7575 */
76-#define RM_YES 0 /* tb_noremap: remap */
77-#define RM_NONE 1 /* tb_noremap: don't remap */
78-#define RM_SCRIPT 2 /* tb_noremap: remap local script mappings */
79-#define RM_ABBR 4 /* tb_noremap: don't remap, do abbrev. */
80-
81-/* typebuf.tb_buf has three parts: room in front (for result of mappings), the
82- * middle for typeahead and room for new characters (which needs to be 3 *
83- * MAXMAPLEN) for the Amiga).
84- */
76+#define RM_YES 0 // tb_noremap: remap
77+#define RM_NONE 1 // tb_noremap: don't remap
78+#define RM_SCRIPT 2 // tb_noremap: remap local script mappings
79+#define RM_ABBR 4 // tb_noremap: don't remap, do abbrev.
80+
81+// typebuf.tb_buf has three parts: room in front (for result of mappings), the
82+// middle for typeahead and room for new characters (which needs to be 3 *
83+// MAXMAPLEN) for the Amiga).
8584 #define TYPELEN_INIT (5 * (MAXMAPLEN + 3))
86-static char_u typebuf_init[TYPELEN_INIT]; /* initial typebuf.tb_buf */
87-static char_u noremapbuf_init[TYPELEN_INIT]; /* initial typebuf.tb_noremap */
88-
89-static int last_recorded_len = 0; /* number of last recorded chars */
85+static char_u typebuf_init[TYPELEN_INIT]; // initial typebuf.tb_buf
86+static char_u noremapbuf_init[TYPELEN_INIT]; // initial typebuf.tb_noremap
87+
88+static int last_recorded_len = 0; // number of last recorded chars
9089
9190 static int read_readbuf(buffheader_T *buf, int advance);
9291 static void init_typebuf(void);
@@ -120,7 +119,7 @@
120119 static char_u *
121120 get_buffcont(
122121 buffheader_T *buffer,
123- int dozero) /* count == zero is not an error */
122+ int dozero) // count == zero is not an error
124123 {
125124 long_u count = 0;
126125 char_u *p = NULL;
@@ -128,7 +127,7 @@
128127 char_u *str;
129128 buffblock_T *bp;
130129
131- /* compute the total length of the string */
130+ // compute the total length of the string
132131 for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next)
133132 count += (long_u)STRLEN(bp->b_str);
134133
@@ -196,22 +195,22 @@
196195 add_buff(
197196 buffheader_T *buf,
198197 char_u *s,
199- long slen) /* length of "s" or -1 */
198+ long slen) // length of "s" or -1
200199 {
201200 buffblock_T *p;
202201 long_u len;
203202
204203 if (slen < 0)
205204 slen = (long)STRLEN(s);
206- if (slen == 0) /* don't add empty strings */
205+ if (slen == 0) // don't add empty strings
207206 return;
208207
209- if (buf->bh_first.b_next == NULL) /* first add to list */
208+ if (buf->bh_first.b_next == NULL) // first add to list
210209 {
211210 buf->bh_space = 0;
212211 buf->bh_curr = &(buf->bh_first);
213212 }
214- else if (buf->bh_curr == NULL) /* buffer has already been read */
213+ else if (buf->bh_curr == NULL) // buffer has already been read
215214 {
216215 iemsg(_("E222: Add to read buffer"));
217216 return;
@@ -236,7 +235,7 @@
236235 len = slen;
237236 p = alloc(offsetof(buffblock_T, b_str) + len + 1);
238237 if (p == NULL)
239- return; /* no space, just forget it */
238+ return; // no space, just forget it
240239 buf->bh_space = (int)(len - slen);
241240 vim_strncpy(p->b_str, s, (size_t)slen);
242241
@@ -282,7 +281,7 @@
282281
283282 if (IS_SPECIAL(c) || c == K_SPECIAL || c == NUL)
284283 {
285- /* translate special key code into three byte sequence */
284+ // translate special key code into three byte sequence
286285 temp[0] = K_SPECIAL;
287286 temp[1] = K_SECOND(c);
288287 temp[2] = K_THIRD(c);
@@ -291,7 +290,7 @@
291290 #ifdef FEAT_GUI
292291 else if (c == CSI)
293292 {
294- /* Translate a CSI to a CSI - KS_EXTRA - KE_CSI sequence */
293+ // Translate a CSI to a CSI - KS_EXTRA - KE_CSI sequence
295294 temp[0] = CSI;
296295 temp[1] = KS_EXTRA;
297296 temp[2] = (int)KE_CSI;
@@ -307,10 +306,10 @@
307306 }
308307 }
309308
310-/* First read ahead buffer. Used for translated commands. */
309+// First read ahead buffer. Used for translated commands.
311310 static buffheader_T readbuf1 = {{NULL, {NUL}}, NULL, 0, 0};
312311
313-/* Second read ahead buffer. Used for redo. */
312+// Second read ahead buffer. Used for redo.
314313 static buffheader_T readbuf2 = {{NULL, {NUL}}, NULL, 0, 0};
315314
316315 /*
@@ -336,7 +335,7 @@
336335 char_u c;
337336 buffblock_T *curr;
338337
339- if (buf->bh_first.b_next == NULL) /* buffer is empty */
338+ if (buf->bh_first.b_next == NULL) // buffer is empty
340339 return NUL;
341340
342341 curr = buf->bh_first.b_next;
@@ -435,8 +434,8 @@
435434 typebuf.tb_off = MAXMAPLEN;
436435 typebuf.tb_len = 0;
437436 #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
438- /* Reset the flag that text received from a client or from feedkeys()
439- * was inserted in the typeahead buffer. */
437+ // Reset the flag that text received from a client or from feedkeys()
438+ // was inserted in the typeahead buffer.
440439 typebuf_was_filled = FALSE;
441440 #endif
442441 }
@@ -493,7 +492,7 @@
493492 save_redo->sr_old_redobuff = old_redobuff;
494493 old_redobuff.bh_first.b_next = NULL;
495494
496- /* Make a copy, so that ":normal ." in a function works. */
495+ // Make a copy, so that ":normal ." in a function works.
497496 s = get_buffcont(&save_redo->sr_redobuff, FALSE);
498497 if (s != NULL)
499498 {
@@ -533,7 +532,7 @@
533532 void
534533 AppendToRedobuffLit(
535534 char_u *str,
536- int len) /* length of "str" or -1 for up to the NUL */
535+ int len) // length of "str" or -1 for up to the NUL
537536 {
538537 char_u *s = str;
539538 int c;
@@ -544,18 +543,18 @@
544543
545544 while (len < 0 ? *s != NUL : s - str < len)
546545 {
547- /* Put a string of normal characters in the redo buffer (that's
548- * faster). */
546+ // Put a string of normal characters in the redo buffer (that's
547+ // faster).
549548 start = s;
550549 while (*s >= ' '
551550 #ifndef EBCDIC
552- && *s < DEL /* EBCDIC: all chars above space are normal */
551+ && *s < DEL // EBCDIC: all chars above space are normal
553552 #endif
554553 && (len < 0 || s - str < len))
555554 ++s;
556555
557- /* Don't put '0' or '^' as last character, just in case a CTRL-D is
558- * typed next. */
556+ // Don't put '0' or '^' as last character, just in case a CTRL-D is
557+ // typed next.
559558 if (*s == NUL && (s[-1] == '0' || s[-1] == '^'))
560559 --s;
561560 if (s > start)
@@ -564,16 +563,16 @@
564563 if (*s == NUL || (len >= 0 && s - str >= len))
565564 break;
566565
567- /* Handle a special or multibyte character. */
566+ // Handle a special or multibyte character.
568567 if (has_mbyte)
569- /* Handle composing chars separately. */
568+ // Handle composing chars separately.
570569 c = mb_cptr2char_adv(&s);
571570 else
572571 c = *s++;
573572 if (c < ' ' || c == DEL || (*s == NUL && (c == '0' || c == '^')))
574573 add_char_buff(&redobuff, Ctrl_V);
575574
576- /* CTRL-V '0' must be inserted as CTRL-V 048 (EBCDIC: xf0) */
575+ // CTRL-V '0' must be inserted as CTRL-V 048 (EBCDIC: xf0)
577576 if (*s == NUL && c == '0')
578577 #ifdef EBCDIC
579578 add_buff(&redobuff, (char_u *)"xf0", 3L);
@@ -647,7 +646,7 @@
647646 {
648647 if (*s == K_SPECIAL && s[1] != NUL && s[2] != NUL)
649648 {
650- /* Insert special key literally. */
649+ // Insert special key literally.
651650 stuffReadbuffLen(s, 3L);
652651 s += 3;
653652 }
@@ -712,22 +711,22 @@
712711 }
713712 if ((c = *p) != NUL)
714713 {
715- /* Reverse the conversion done by add_char_buff() */
716- /* For a multi-byte character get all the bytes and return the
717- * converted character. */
714+ // Reverse the conversion done by add_char_buff()
715+ // For a multi-byte character get all the bytes and return the
716+ // converted character.
718717 if (has_mbyte && (c != K_SPECIAL || p[1] == KS_SPECIAL))
719718 n = MB_BYTE2LEN_CHECK(c);
720719 else
721720 n = 1;
722721 for (i = 0; ; ++i)
723722 {
724- if (c == K_SPECIAL) /* special key or escaped K_SPECIAL */
723+ if (c == K_SPECIAL) // special key or escaped K_SPECIAL
725724 {
726725 c = TO_SPECIAL(p[1], p[2]);
727726 p += 2;
728727 }
729728 #ifdef FEAT_GUI
730- if (c == CSI) /* escaped CSI */
729+ if (c == CSI) // escaped CSI
731730 p += 2;
732731 #endif
733732 if (*++p == NUL && bp->b_next != NULL)
@@ -736,14 +735,14 @@
736735 p = bp->b_str;
737736 }
738737 buf[i] = c;
739- if (i == n - 1) /* last byte of a character */
738+ if (i == n - 1) // last byte of a character
740739 {
741740 if (n != 1)
742741 c = (*mb_ptr2char)(buf);
743742 break;
744743 }
745744 c = *p;
746- if (c == NUL) /* cannot happen? */
745+ if (c == NUL) // cannot happen?
747746 break;
748747 }
749748 }
@@ -779,24 +778,24 @@
779778 {
780779 int c;
781780
782- /* init the pointers; return if nothing to redo */
781+ // init the pointers; return if nothing to redo
783782 if (read_redo(TRUE, old_redo) == FAIL)
784783 return FAIL;
785784
786785 c = read_redo(FALSE, old_redo);
787786
788- /* copy the buffer name, if present */
787+ // copy the buffer name, if present
789788 if (c == '"')
790789 {
791790 add_buff(&readbuf2, (char_u *)"\"", 1L);
792791 c = read_redo(FALSE, old_redo);
793792
794- /* if a numbered buffer is used, increment the number */
793+ // if a numbered buffer is used, increment the number
795794 if (c >= '1' && c < '9')
796795 ++c;
797796 add_char_buff(&readbuf2, c);
798797
799- /* the expression register should be re-evaluated */
798+ // the expression register should be re-evaluated
800799 if (c == '=')
801800 {
802801 add_char_buff(&readbuf2, CAR);
@@ -806,7 +805,7 @@
806805 c = read_redo(FALSE, old_redo);
807806 }
808807
809- if (c == 'v') /* redo Visual */
808+ if (c == 'v') // redo Visual
810809 {
811810 VIsual = curwin->w_cursor;
812811 VIsual_active = TRUE;
@@ -816,15 +815,15 @@
816815 c = read_redo(FALSE, old_redo);
817816 }
818817
819- /* try to enter the count (in place of a previous count) */
818+ // try to enter the count (in place of a previous count)
820819 if (count)
821820 {
822- while (VIM_ISDIGIT(c)) /* skip "old" count */
821+ while (VIM_ISDIGIT(c)) // skip "old" count
823822 c = read_redo(FALSE, old_redo);
824823 add_num_buff(&readbuf2, count);
825824 }
826825
827- /* copy from the redo buffer into the stuff buffer */
826+ // copy from the redo buffer into the stuff buffer
828827 add_char_buff(&readbuf2, c);
829828 copy_redo(old_redo);
830829 return OK;
@@ -844,7 +843,7 @@
844843 return FAIL;
845844 start_stuff();
846845
847- /* skip the count and the command character */
846+ // skip the count and the command character
848847 while ((c = read_redo(FALSE, FALSE)) != NUL)
849848 {
850849 if (vim_strchr((char_u *)"AaIiRrOo", c) != NULL)
@@ -855,7 +854,7 @@
855854 }
856855 }
857856
858- /* copy the typed text from the redo buffer into the stuff buffer */
857+ // copy the typed text from the redo buffer into the stuff buffer
859858 copy_redo(FALSE);
860859 block_redo = TRUE;
861860 return OK;
@@ -965,30 +964,30 @@
965964 */
966965 newoff = MAXMAPLEN + 4;
967966 newlen = typebuf.tb_len + addlen + newoff + 4 * (MAXMAPLEN + 4);
968- if (newlen < 0) /* string is getting too long */
967+ if (newlen < 0) // string is getting too long
969968 {
970- emsg(_(e_toocompl)); /* also calls flush_buffers */
969+ emsg(_(e_toocompl)); // also calls flush_buffers
971970 setcursor();
972971 return FAIL;
973972 }
974973 s1 = alloc(newlen);
975- if (s1 == NULL) /* out of memory */
974+ if (s1 == NULL) // out of memory
976975 return FAIL;
977976 s2 = alloc(newlen);
978- if (s2 == NULL) /* out of memory */
977+ if (s2 == NULL) // out of memory
979978 {
980979 vim_free(s1);
981980 return FAIL;
982981 }
983982 typebuf.tb_buflen = newlen;
984983
985- /* copy the old chars, before the insertion point */
984+ // copy the old chars, before the insertion point
986985 mch_memmove(s1 + newoff, typebuf.tb_buf + typebuf.tb_off,
987986 (size_t)offset);
988- /* copy the new chars */
987+ // copy the new chars
989988 mch_memmove(s1 + newoff + offset, str, (size_t)addlen);
990- /* copy the old chars, after the insertion point, including the NUL at
991- * the end */
989+ // copy the old chars, after the insertion point, including the NUL at
990+ // the end
992991 mch_memmove(s1 + newoff + offset + addlen,
993992 typebuf.tb_buf + typebuf.tb_off + offset,
994993 (size_t)(typebuf.tb_len - offset + 1));
@@ -1009,7 +1008,7 @@
10091008 }
10101009 typebuf.tb_len += addlen;
10111010
1012- /* If noremap == REMAP_SCRIPT: do remap script-local mappings. */
1011+ // If noremap == REMAP_SCRIPT: do remap script-local mappings.
10131012 if (noremap == REMAP_SCRIPT)
10141013 val = RM_SCRIPT;
10151014 else if (noremap == REMAP_SKIP)
@@ -1035,9 +1034,9 @@
10351034 typebuf.tb_noremap[typebuf.tb_off + i + offset] =
10361035 (--nrm >= 0) ? val : RM_YES;
10371036
1038- /* tb_maplen and tb_silent only remember the length of mapped and/or
1039- * silent mappings at the start of the buffer, assuming that a mapped
1040- * sequence doesn't result in typed characters. */
1037+ // tb_maplen and tb_silent only remember the length of mapped and/or
1038+ // silent mappings at the start of the buffer, assuming that a mapped
1039+ // sequence doesn't result in typed characters.
10411040 if (nottyped || typebuf.tb_maplen > offset)
10421041 typebuf.tb_maplen += addlen;
10431042 if (silent || typebuf.tb_silent > offset)
@@ -1045,7 +1044,7 @@
10451044 typebuf.tb_silent += addlen;
10461045 cmd_silent = TRUE;
10471046 }
1048- if (typebuf.tb_no_abbr_cnt && offset == 0) /* and not used for abbrev.s */
1047+ if (typebuf.tb_no_abbr_cnt && offset == 0) // and not used for abbrev.s
10491048 typebuf.tb_no_abbr_cnt += addlen;
10501049
10511050 return OK;
@@ -1084,7 +1083,7 @@
10841083 */
10851084 int
10861085 typebuf_changed(
1087- int tb_change_cnt) /* old value of typebuf.tb_change_cnt */
1086+ int tb_change_cnt) // old value of typebuf.tb_change_cnt
10881087 {
10891088 return (tb_change_cnt != 0 && (typebuf.tb_change_cnt != tb_change_cnt
10901089 #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
@@ -1121,7 +1120,7 @@
11211120 int i;
11221121
11231122 if (len == 0)
1124- return; /* nothing to do */
1123+ return; // nothing to do
11251124
11261125 typebuf.tb_len -= len;
11271126
@@ -1148,31 +1147,31 @@
11481147 typebuf.tb_noremap + typebuf.tb_off, (size_t)offset);
11491148 typebuf.tb_off = MAXMAPLEN;
11501149 }
1151- /* adjust typebuf.tb_buf (include the NUL at the end) */
1150+ // adjust typebuf.tb_buf (include the NUL at the end)
11521151 mch_memmove(typebuf.tb_buf + typebuf.tb_off + offset,
11531152 typebuf.tb_buf + i + len,
11541153 (size_t)(typebuf.tb_len - offset + 1));
1155- /* adjust typebuf.tb_noremap[] */
1154+ // adjust typebuf.tb_noremap[]
11561155 mch_memmove(typebuf.tb_noremap + typebuf.tb_off + offset,
11571156 typebuf.tb_noremap + i + len,
11581157 (size_t)(typebuf.tb_len - offset));
11591158 }
11601159
1161- if (typebuf.tb_maplen > offset) /* adjust tb_maplen */
1160+ if (typebuf.tb_maplen > offset) // adjust tb_maplen
11621161 {
11631162 if (typebuf.tb_maplen < offset + len)
11641163 typebuf.tb_maplen = offset;
11651164 else
11661165 typebuf.tb_maplen -= len;
11671166 }
1168- if (typebuf.tb_silent > offset) /* adjust tb_silent */
1167+ if (typebuf.tb_silent > offset) // adjust tb_silent
11691168 {
11701169 if (typebuf.tb_silent < offset + len)
11711170 typebuf.tb_silent = offset;
11721171 else
11731172 typebuf.tb_silent -= len;
11741173 }
1175- if (typebuf.tb_no_abbr_cnt > offset) /* adjust tb_no_abbr_cnt */
1174+ if (typebuf.tb_no_abbr_cnt > offset) // adjust tb_no_abbr_cnt
11761175 {
11771176 if (typebuf.tb_no_abbr_cnt < offset + len)
11781177 typebuf.tb_no_abbr_cnt = offset;
@@ -1181,8 +1180,8 @@
11811180 }
11821181
11831182 #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL)
1184- /* Reset the flag that text received from a client or from feedkeys()
1185- * was inserted in the typeahead buffer. */
1183+ // Reset the flag that text received from a client or from feedkeys()
1184+ // was inserted in the typeahead buffer.
11861185 typebuf_was_filled = FALSE;
11871186 #endif
11881187 if (++typebuf.tb_change_cnt == 0)
@@ -1221,7 +1220,7 @@
12211220 continue;
12221221 }
12231222
1224- /* Handle one byte at a time; no translation to be done. */
1223+ // Handle one byte at a time; no translation to be done.
12251224 for (i = 0; i < buflen; ++i)
12261225 updatescript(buf[i]);
12271226
@@ -1229,7 +1228,7 @@
12291228 {
12301229 buf[buflen] = NUL;
12311230 add_buff(&recordbuff, buf, (long)buflen);
1232- /* remember how many chars were last recorded */
1231+ // remember how many chars were last recorded
12331232 last_recorded_len += buflen;
12341233 }
12351234 buflen = 0;
@@ -1237,12 +1236,12 @@
12371236 may_sync_undo();
12381237
12391238 #ifdef FEAT_EVAL
1240- /* output "debug mode" message next time in debug mode */
1239+ // output "debug mode" message next time in debug mode
12411240 debug_did_msg = FALSE;
12421241 #endif
12431242
1244- /* Since characters have been typed, consider the following to be in
1245- * another mapping. Search string will be kept in history. */
1243+ // Since characters have been typed, consider the following to be in
1244+ // another mapping. Search string will be kept in history.
12461245 ++maptick;
12471246 }
12481247
@@ -1277,7 +1276,7 @@
12771276 return FAIL;
12781277 }
12791278 typebuf.tb_buflen = TYPELEN_INIT;
1280- typebuf.tb_off = MAXMAPLEN + 4; /* can insert without realloc */
1279+ typebuf.tb_off = MAXMAPLEN + 4; // can insert without realloc
12811280 typebuf.tb_len = 0;
12821281 typebuf.tb_maplen = 0;
12831282 typebuf.tb_silent = 0;
@@ -1314,7 +1313,7 @@
13141313 {
13151314 init_typebuf();
13161315 saved_typebuf[curscript] = typebuf;
1317- /* If out of memory: restore typebuf and close file. */
1316+ // If out of memory: restore typebuf and close file.
13181317 if (alloc_typebuf() == FAIL)
13191318 {
13201319 closescript();
@@ -1323,10 +1322,10 @@
13231322 return OK;
13241323 }
13251324
1326-static int old_char = -1; /* character put back by vungetc() */
1327-static int old_mod_mask; /* mod_mask for ungotten character */
1328-static int old_mouse_row; /* mouse_row related to old_char */
1329-static int old_mouse_col; /* mouse_col related to old_char */
1325+static int old_char = -1; // character put back by vungetc()
1326+static int old_mod_mask; // mod_mask for ungotten character
1327+static int old_mouse_row; // mouse_row related to old_char
1328+static int old_mouse_col; // mouse_col related to old_char
13301329
13311330 /*
13321331 * Save all three kinds of typeahead, so that the user must type at a prompt.
@@ -1383,7 +1382,7 @@
13831382 void
13841383 openscript(
13851384 char_u *name,
1386- int directly) /* when TRUE execute directly */
1385+ int directly) // when TRUE execute directly
13871386 {
13881387 if (curscript + 1 == NSCRIPT)
13891388 {
@@ -1398,13 +1397,13 @@
13981397
13991398 #ifdef FEAT_EVAL
14001399 if (ignore_script)
1401- /* Not reading from script, also don't open one. Warning message? */
1400+ // Not reading from script, also don't open one. Warning message?
14021401 return;
14031402 #endif
14041403
1405- if (scriptin[curscript] != NULL) /* already reading script */
1404+ if (scriptin[curscript] != NULL) // already reading script
14061405 ++curscript;
1407- /* use NameBuff for expanded name */
1406+ // use NameBuff for expanded name
14081407 expand_env(name, NameBuff, MAXPATHL);
14091408 if ((scriptin[curscript] = mch_fopen((char *)NameBuff, READBIN)) == NULL)
14101409 {
@@ -1433,9 +1432,9 @@
14331432 int save_msg_scroll = msg_scroll;
14341433
14351434 State = NORMAL;
1436- msg_scroll = FALSE; /* no msg scrolling in Normal mode */
1437- restart_edit = 0; /* don't go to Insert mode */
1438- p_im = FALSE; /* don't use 'insertmode' */
1435+ msg_scroll = FALSE; // no msg scrolling in Normal mode
1436+ restart_edit = 0; // don't go to Insert mode
1437+ p_im = FALSE; // don't use 'insertmode'
14391438 clear_oparg(&oa);
14401439 finish_op = FALSE;
14411440
@@ -1574,8 +1573,8 @@
15741573 int i;
15751574
15761575 #ifdef FEAT_EVAL
1577- /* Do garbage collection when garbagecollect() was called previously and
1578- * we are now at the toplevel. */
1576+ // Do garbage collection when garbagecollect() was called previously and
1577+ // we are now at the toplevel.
15791578 if (may_garbage_collect && want_garbage_collect)
15801579 garbage_collect(FALSE);
15811580 #endif
@@ -1868,8 +1867,8 @@
18681867 while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR);
18691868
18701869 if (c == K_PS)
1871- /* Only handle the first pasted character. Drop the rest, since we
1872- * don't know what to do with it. */
1870+ // Only handle the first pasted character. Drop the rest, since we
1871+ // don't know what to do with it.
18731872 c = bracketed_paste(PASTE_ONE_CHAR, FALSE, NULL);
18741873
18751874 return c;
@@ -1934,8 +1933,8 @@
19341933 int retval;
19351934
19361935 #ifdef FEAT_EVAL
1937- /* When test_override("char_avail", 1) was called pretend there is no
1938- * typeahead. */
1936+ // When test_override("char_avail", 1) was called pretend there is no
1937+ // typeahead.
19391938 if (disable_char_avail_for_testing)
19401939 return FALSE;
19411940 #endif
@@ -1962,7 +1961,7 @@
19621961 parse_queued_messages();
19631962 #endif
19641963
1965- /* Position the cursor. Needed after a message that ends in a space. */
1964+ // Position the cursor. Needed after a message that ends in a space.
19661965 windgoto(msg_row, msg_col);
19671966
19681967 ++no_mapping;
@@ -1970,16 +1969,16 @@
19701969 for (;;)
19711970 {
19721971 if (argvars[0].v_type == VAR_UNKNOWN)
1973- /* getchar(): blocking wait. */
1972+ // getchar(): blocking wait.
19741973 n = plain_vgetc();
19751974 else if (tv_get_number_chk(&argvars[0], &error) == 1)
1976- /* getchar(1): only check if char avail */
1975+ // getchar(1): only check if char avail
19771976 n = vpeekc_any();
19781977 else if (error || vpeekc_any() == NUL)
1979- /* illegal argument or getchar(0) and no char avail: return zero */
1978+ // illegal argument or getchar(0) and no char avail: return zero
19801979 n = 0;
19811980 else
1982- /* getchar(0) and char avail: return char */
1981+ // getchar(0) and char avail: return char
19831982 n = plain_vgetc();
19841983
19851984 if (n == K_IGNORE)
@@ -1997,10 +1996,10 @@
19971996 rettv->vval.v_number = n;
19981997 if (IS_SPECIAL(n) || mod_mask != 0)
19991998 {
2000- char_u temp[10]; /* modifier: 3, mbyte-char: 6, NUL: 1 */
1999+ char_u temp[10]; // modifier: 3, mbyte-char: 6, NUL: 1
20012000 int i = 0;
20022001
2003- /* Turn a special key into three bytes, plus modifier. */
2002+ // Turn a special key into three bytes, plus modifier.
20042003 if (mod_mask != 0)
20052004 {
20062005 temp[i++] = K_SPECIAL;
@@ -2032,8 +2031,8 @@
20322031
20332032 if (row >= 0 && col >= 0)
20342033 {
2035- /* Find the window at the mouse coordinates and compute the
2036- * text position. */
2034+ // Find the window at the mouse coordinates and compute the
2035+ // text position.
20372036 win = mouse_find_win(&row, &col, FIND_POPUP);
20382037 if (win == NULL)
20392038 return;
@@ -2572,7 +2571,7 @@
25722571 else
25732572 setcursor();
25742573 flush_buffers(FLUSH_MINIMAL);
2575- *mapdepth = 0; /* for next one */
2574+ *mapdepth = 0; // for next one
25762575 *keylenp = keylen;
25772576 return map_result_fail;
25782577 }
@@ -2713,15 +2712,15 @@
27132712 vgetorpeek(int advance)
27142713 {
27152714 int c, c1;
2716- int timedout = FALSE; /* waited for more than 1 second
2717- for mapping to complete */
2718- int mapdepth = 0; /* check for recursive mapping */
2719- int mode_deleted = FALSE; /* set when mode has been deleted */
2715+ int timedout = FALSE; // waited for more than 1 second
2716+ // for mapping to complete
2717+ int mapdepth = 0; // check for recursive mapping
2718+ int mode_deleted = FALSE; // set when mode has been deleted
27202719 #ifdef FEAT_CMDL_INFO
27212720 int new_wcol, new_wrow;
27222721 #endif
27232722 #ifdef FEAT_GUI
2724- int shape_changed = FALSE; /* adjusted cursor shape */
2723+ int shape_changed = FALSE; // adjusted cursor shape
27252724 #endif
27262725 int n;
27272726 int old_wcol, old_wrow;
@@ -2767,13 +2766,13 @@
27672766 {
27682767 if (advance)
27692768 {
2770- /* KeyTyped = FALSE; When the command that stuffed something
2771- * was typed, behave like the stuffed command was typed.
2772- * needed for CTRL-W CTRL-] to open a fold, for example. */
2769+ // KeyTyped = FALSE; When the command that stuffed something
2770+ // was typed, behave like the stuffed command was typed.
2771+ // needed for CTRL-W CTRL-] to open a fold, for example.
27732772 KeyStuffed = TRUE;
27742773 }
27752774 if (typebuf.tb_no_abbr_cnt == 0)
2776- typebuf.tb_no_abbr_cnt = 1; /* no abbreviations now */
2775+ typebuf.tb_no_abbr_cnt = 1; // no abbreviations now
27772776 }
27782777 else
27792778 {
@@ -2798,10 +2797,10 @@
27982797 if (typebuf.tb_maplen)
27992798 line_breakcheck();
28002799 else
2801- ui_breakcheck(); /* check for CTRL-C */
2800+ ui_breakcheck(); // check for CTRL-C
28022801 if (got_int)
28032802 {
2804- /* flush all input */
2803+ // flush all input
28052804 c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0L);
28062805
28072806 /*
@@ -2820,8 +2819,8 @@
28202819
28212820 if (advance)
28222821 {
2823- /* Also record this character, it might be needed to
2824- * get out of Insert mode. */
2822+ // Also record this character, it might be needed to
2823+ // get out of Insert mode.
28252824 *typebuf.tb_buf = c;
28262825 gotchars(typebuf.tb_buf, 1);
28272826 }
@@ -2852,7 +2851,7 @@
28522851 * get a character: 2. from the typeahead buffer
28532852 */
28542853 c = typebuf.tb_buf[typebuf.tb_off];
2855- if (advance) /* remove chars from tb_buf */
2854+ if (advance) // remove chars from tb_buf
28562855 {
28572856 cmd_silent = (typebuf.tb_silent > 0);
28582857 if (typebuf.tb_maplen > 0)
@@ -2860,7 +2859,7 @@
28602859 else
28612860 {
28622861 KeyTyped = TRUE;
2863- /* write char to script file(s) */
2862+ // write char to script file(s)
28642863 gotchars(typebuf.tb_buf
28652864 + typebuf.tb_off, 1);
28662865 }
@@ -2911,7 +2910,7 @@
29112910 mode_deleted = TRUE;
29122911 }
29132912 #ifdef FEAT_GUI
2914- /* may show a different cursor shape */
2913+ // may show a different cursor shape
29152914 if (gui.in_use && State != NORMAL && !cmd_silent)
29162915 {
29172916 int save_State;
@@ -2927,7 +2926,7 @@
29272926 old_wcol = curwin->w_wcol;
29282927 old_wrow = curwin->w_wrow;
29292928
2930- /* move cursor left, if possible */
2929+ // move cursor left, if possible
29312930 if (curwin->w_cursor.col != 0)
29322931 {
29332932 if (curwin->w_wcol > 0)
@@ -2956,7 +2955,7 @@
29562955 + curwin->w_wcol / curwin->w_width;
29572956 curwin->w_wcol %= curwin->w_width;
29582957 curwin->w_wcol += curwin_col_off();
2959- col = 0; /* no correction needed */
2958+ col = 0; // no correction needed
29602959 }
29612960 else
29622961 {
@@ -2972,8 +2971,8 @@
29722971 }
29732972 if (has_mbyte && col > 0 && curwin->w_wcol > 0)
29742973 {
2975- /* Correct when the cursor is on the right halve
2976- * of a double-wide character. */
2974+ // Correct when the cursor is on the right halve
2975+ // of a double-wide character.
29772976 ptr = ml_get_curline();
29782977 col -= (*mb_head_off)(ptr, ptr + col);
29792978 if ((*mb_ptr2cells)(ptr + col) > 1)
@@ -2990,15 +2989,15 @@
29902989 curwin->w_wrow = old_wrow;
29912990 }
29922991 if (c < 0)
2993- continue; /* end of input script reached */
2994-
2995- /* Allow mapping for just typed characters. When we get here c
2996- * is the number of extra bytes and typebuf.tb_len is 1. */
2992+ continue; // end of input script reached
2993+
2994+ // Allow mapping for just typed characters. When we get here c
2995+ // is the number of extra bytes and typebuf.tb_len is 1.
29972996 for (n = 1; n <= c; ++n)
29982997 typebuf.tb_noremap[typebuf.tb_off + n] = RM_YES;
29992998 typebuf.tb_len += c;
30002999
3001- /* buffer full, don't map */
3000+ // buffer full, don't map
30023001 if (typebuf.tb_len >= typebuf.tb_maplen + MAXMAPLEN)
30033002 {
30043003 timedout = TRUE;
@@ -3011,20 +3010,20 @@
30113010 static int tc = 0;
30123011 #endif
30133012
3014- /* No typeahead left and inside ":normal". Must return
3015- * something to avoid getting stuck. When an incomplete
3016- * mapping is present, behave like it timed out. */
3013+ // No typeahead left and inside ":normal". Must return
3014+ // something to avoid getting stuck. When an incomplete
3015+ // mapping is present, behave like it timed out.
30173016 if (typebuf.tb_len > 0)
30183017 {
30193018 timedout = TRUE;
30203019 continue;
30213020 }
3022- /* When 'insertmode' is set, ESC just beeps in Insert
3023- * mode. Use CTRL-L to make edit() return.
3024- * For the command line only CTRL-C always breaks it.
3025- * For the cmdline window: Alternate between ESC and
3026- * CTRL-C: ESC for most situations and CTRL-C to close the
3027- * cmdline window. */
3021+ // When 'insertmode' is set, ESC just beeps in Insert
3022+ // mode. Use CTRL-L to make edit() return.
3023+ // For the command line only CTRL-C always breaks it.
3024+ // For the cmdline window: Alternate between ESC and
3025+ // CTRL-C: ESC for most situations and CTRL-C to close the
3026+ // cmdline window.
30283027 if (p_im && (State & INSERT))
30293028 c = Ctrl_L;
30303029 #ifdef FEAT_TERMINAL
@@ -3048,18 +3047,18 @@
30483047 /*
30493048 * get a character: 3. from the user - update display
30503049 */
3051- /* In insert mode a screen update is skipped when characters
3052- * are still available. But when those available characters
3053- * are part of a mapping, and we are going to do a blocking
3054- * wait here. Need to update the screen to display the
3055- * changed text so far. Also for when 'lazyredraw' is set and
3056- * redrawing was postponed because there was something in the
3057- * input buffer (e.g., termresponse). */
3050+ // In insert mode a screen update is skipped when characters
3051+ // are still available. But when those available characters
3052+ // are part of a mapping, and we are going to do a blocking
3053+ // wait here. Need to update the screen to display the
3054+ // changed text so far. Also for when 'lazyredraw' is set and
3055+ // redrawing was postponed because there was something in the
3056+ // input buffer (e.g., termresponse).
30583057 if (((State & INSERT) != 0 || p_lz) && (State & CMDLINE) == 0
30593058 && advance && must_redraw != 0 && !need_wait_return)
30603059 {
30613060 update_screen(0);
3062- setcursor(); /* put cursor back where it belongs */
3061+ setcursor(); // put cursor back where it belongs
30633062 }
30643063
30653064 /*
@@ -3076,18 +3075,18 @@
30763075 if (((State & (NORMAL | INSERT)) || State == LANGMAP)
30773076 && State != HITRETURN)
30783077 {
3079- /* this looks nice when typing a dead character map */
3078+ // this looks nice when typing a dead character map
30803079 if (State & INSERT
30813080 && ptr2cells(typebuf.tb_buf + typebuf.tb_off
30823081 + typebuf.tb_len - 1) == 1)
30833082 {
30843083 edit_putchar(typebuf.tb_buf[typebuf.tb_off
30853084 + typebuf.tb_len - 1], FALSE);
3086- setcursor(); /* put cursor back where it belongs */
3085+ setcursor(); // put cursor back where it belongs
30873086 c1 = 1;
30883087 }
30893088 #ifdef FEAT_CMDL_INFO
3090- /* need to use the col and row from above here */
3089+ // need to use the col and row from above here
30913090 old_wcol = curwin->w_wcol;
30923091 old_wrow = curwin->w_wrow;
30933092 curwin->w_wcol = new_wcol;
@@ -3103,7 +3102,7 @@
31033102 #endif
31043103 }
31053104
3106- /* this looks nice when typing a dead character map */
3105+ // this looks nice when typing a dead character map
31073106 if ((State & CMDLINE)
31083107 #if defined(FEAT_CRYPT) || defined(FEAT_EVAL)
31093108 && cmdline_star == 0
@@ -3156,37 +3155,37 @@
31563155 if (State & CMDLINE)
31573156 unputcmdline();
31583157 else
3159- setcursor(); /* put cursor back where it belongs */
3158+ setcursor(); // put cursor back where it belongs
31603159 }
31613160
31623161 if (c < 0)
3163- continue; /* end of input script reached */
3164- if (c == NUL) /* no character available */
3162+ continue; // end of input script reached
3163+ if (c == NUL) // no character available
31653164 {
31663165 if (!advance)
31673166 break;
3168- if (wait_tb_len > 0) /* timed out */
3167+ if (wait_tb_len > 0) // timed out
31693168 {
31703169 timedout = TRUE;
31713170 continue;
31723171 }
31733172 }
31743173 else
3175- { /* allow mapping for just typed characters */
3174+ { // allow mapping for just typed characters
31763175 while (typebuf.tb_buf[typebuf.tb_off
31773176 + typebuf.tb_len] != NUL)
31783177 typebuf.tb_noremap[typebuf.tb_off
31793178 + typebuf.tb_len++] = RM_YES;
31803179 #ifdef HAVE_INPUT_METHOD
3181- /* Get IM status right after getting keys, not after the
3182- * timeout for a mapping (focus may be lost by then). */
3180+ // Get IM status right after getting keys, not after the
3181+ // timeout for a mapping (focus may be lost by then).
31833182 vgetc_im_active = im_get_status();
31843183 #endif
31853184 }
3186- } /* for (;;) */
3187- } /* if (!character from stuffbuf) */
3188-
3189- /* if advance is FALSE don't loop on NULs */
3185+ } // for (;;)
3186+ } // if (!character from stuffbuf)
3187+
3188+ // if advance is FALSE don't loop on NULs
31903189 } while ((c < 0 && c != K_CANCEL) || (advance && c == NUL));
31913190
31923191 /*
@@ -3199,20 +3198,20 @@
31993198 if (c == ESC && !mode_deleted && !no_mapping && mode_displayed)
32003199 {
32013200 if (typebuf.tb_len && !KeyTyped)
3202- redraw_cmdline = TRUE; /* delete mode later */
3201+ redraw_cmdline = TRUE; // delete mode later
32033202 else
32043203 unshowmode(FALSE);
32053204 }
32063205 else if (c != ESC && mode_deleted)
32073206 {
32083207 if (typebuf.tb_len && !KeyTyped)
3209- redraw_cmdline = TRUE; /* show mode later */
3208+ redraw_cmdline = TRUE; // show mode later
32103209 else
32113210 showmode();
32123211 }
32133212 }
32143213 #ifdef FEAT_GUI
3215- /* may unshow different cursor shape */
3214+ // may unshow different cursor shape
32163215 if (gui.in_use && shape_changed)
32173216 gui_update_cursor(TRUE, FALSE);
32183217 #endif
@@ -3260,14 +3259,14 @@
32603259 inchar(
32613260 char_u *buf,
32623261 int maxlen,
3263- long wait_time) /* milli seconds */
3262+ long wait_time) // milli seconds
32643263 {
3265- int len = 0; /* init for GCC */
3266- int retesc = FALSE; /* return ESC with gotint */
3264+ int len = 0; // init for GCC
3265+ int retesc = FALSE; // return ESC with gotint
32673266 int script_char;
32683267 int tb_change_cnt = typebuf.tb_change_cnt;
32693268
3270- if (wait_time == -1L || wait_time > 100L) /* flush output before waiting */
3269+ if (wait_time == -1L || wait_time > 100L) // flush output before waiting
32713270 {
32723271 cursor_on();
32733272 out_flush_cursor(FALSE, FALSE);
@@ -3284,10 +3283,10 @@
32843283 */
32853284 if (State != HITRETURN)
32863285 {
3287- did_outofmem_msg = FALSE; /* display out of memory message (again) */
3288- did_swapwrite_msg = FALSE; /* display swap file write error again */
3286+ did_outofmem_msg = FALSE; // display out of memory message (again)
3287+ did_swapwrite_msg = FALSE; // display swap file write error again
32893288 }
3290- undo_off = FALSE; /* restart undo now */
3289+ undo_off = FALSE; // restart undo now
32913290
32923291 /*
32933292 * Get a character from a script file if there is one.
@@ -3306,9 +3305,9 @@
33063305
33073306 if (got_int || (script_char = getc(scriptin[curscript])) < 0)
33083307 {
3309- /* Reached EOF.
3310- * Careful: closescript() frees typebuf.tb_buf[] and buf[] may
3311- * point inside typebuf.tb_buf[]. Don't use buf[] after this! */
3308+ // Reached EOF.
3309+ // Careful: closescript() frees typebuf.tb_buf[] and buf[] may
3310+ // point inside typebuf.tb_buf[]. Don't use buf[] after this!
33123311 closescript();
33133312 /*
33143313 * When reading script file is interrupted, return an ESC to get
@@ -3327,7 +3326,7 @@
33273326 }
33283327 }
33293328
3330- if (script_char < 0) /* did not get a character from script */
3329+ if (script_char < 0) // did not get a character from script
33313330 {
33323331 /*
33333332 * If we got an interrupt, skip all previously typed characters and
@@ -3365,14 +3364,14 @@
33653364 len = ui_inchar(buf, maxlen / 3, wait_time, tb_change_cnt);
33663365 }
33673366
3368- /* If the typebuf was changed further down, it is like nothing was added by
3369- * this call. */
3367+ // If the typebuf was changed further down, it is like nothing was added by
3368+ // this call.
33703369 if (typebuf_changed(tb_change_cnt))
33713370 return 0;
33723371
3373- /* Note the change in the typeahead buffer, this matters for when
3374- * vgetorpeek() is called recursively, e.g. using getchar(1) in a timer
3375- * function. */
3372+ // Note the change in the typeahead buffer, this matters for when
3373+ // vgetorpeek() is called recursively, e.g. using getchar(1) in a timer
3374+ // function.
33763375 if (len > 0 && ++typebuf.tb_change_cnt == 0)
33773376 typebuf.tb_change_cnt = 1;
33783377
@@ -3400,15 +3399,15 @@
34003399 for (i = len; --i >= 0; ++p)
34013400 {
34023401 #ifdef FEAT_GUI
3403- /* When the GUI is used any character can come after a CSI, don't
3404- * escape it. */
3402+ // When the GUI is used any character can come after a CSI, don't
3403+ // escape it.
34053404 if (gui.in_use && p[0] == CSI && i >= 2)
34063405 {
34073406 p += 2;
34083407 i -= 2;
34093408 }
34103409 # ifndef MSWIN
3411- /* When the GUI is not used CSI needs to be escaped. */
3410+ // When the GUI is not used CSI needs to be escaped.
34123411 else if (!gui.in_use && p[0] == CSI)
34133412 {
34143413 mch_memmove(p + 3, p + 1, (size_t)i);
diff -r 04ce3b8a50ed -r 79e10adc821d src/gui.c
--- a/src/gui.c Sun Dec 01 21:45:05 2019 +0100
+++ b/src/gui.c Sun Dec 01 22:15:03 2019 +0100
@@ -10,7 +10,7 @@
1010
1111 #include "vim.h"
1212
13-/* Structure containing all the GUI information */
13+// Structure containing all the GUI information
1414 gui_T gui;
1515
1616 #if !defined(FEAT_GUI_GTK)
@@ -38,7 +38,7 @@
3838
3939 static int gui_read_child_pipe(int fd);
4040
41-/* Return values for gui_read_child_pipe */
41+// Return values for gui_read_child_pipe
4242 enum {
4343 GUI_CHILD_IO_ERROR,
4444 GUI_CHILD_OK,
@@ -48,8 +48,8 @@
4848
4949 static void gui_attempt_start(void);
5050
51-static int can_update_cursor = TRUE; /* can display the cursor */
52-static int disable_flush = 0; /* If > 0, gui_mch_flush() is disabled. */
51+static int can_update_cursor = TRUE; // can display the cursor
52+static int disable_flush = 0; // If > 0, gui_mch_flush() is disabled.
5353
5454 /*
5555 * The Athena scrollbars can move the thumb to after the end of the scrollbar,
@@ -78,9 +78,9 @@
7878
7979 old_term = vim_strsave(T_NAME);
8080
81- settmode(TMODE_COOK); /* stop RAW mode */
81+ settmode(TMODE_COOK); // stop RAW mode
8282 if (full_screen)
83- cursor_on(); /* needed for ":gui" in .vimrc */
83+ cursor_on(); // needed for ":gui" in .vimrc
8484 full_screen = FALSE;
8585
8686 ++recursive;
@@ -125,30 +125,29 @@
125125 #endif
126126 {
127127 #ifdef FEAT_GUI_GTK
128- /* If there is 'f' in 'guioptions' and specify -g argument,
129- * gui_mch_init_check() was not called yet. */
128+ // If there is 'f' in 'guioptions' and specify -g argument,
129+ // gui_mch_init_check() was not called yet.
130130 if (gui_mch_init_check() != OK)
131131 getout_preserve_modified(1);
132132 #endif
133133 gui_attempt_start();
134134 }
135135
136- if (!gui.in_use) /* failed to start GUI */
136+ if (!gui.in_use) // failed to start GUI
137137 {
138- /* Back to old term settings
139- *
140- * FIXME: If we got here because a child process failed and flagged to
141- * the parent to resume, and X11 is enabled with FEAT_TITLE, this will
142- * hit an X11 I/O error and do a longjmp(), leaving recursive
143- * permanently set to 1. This is probably not as big a problem as it
144- * sounds, because gui_mch_init() in both gui_x11.c and gui_gtk_x11.c
145- * return "OK" unconditionally, so it would be very difficult to
146- * actually hit this case.
147- */
138+ // Back to old term settings
139+ //
140+ // FIXME: If we got here because a child process failed and flagged to
141+ // the parent to resume, and X11 is enabled with FEAT_TITLE, this will
142+ // hit an X11 I/O error and do a longjmp(), leaving recursive
143+ // permanently set to 1. This is probably not as big a problem as it
144+ // sounds, because gui_mch_init() in both gui_x11.c and gui_gtk_x11.c
145+ // return "OK" unconditionally, so it would be very difficult to
146+ // actually hit this case.
148147 termcapinit(old_term);
149- settmode(TMODE_RAW); /* restart RAW mode */
148+ settmode(TMODE_RAW); // restart RAW mode
150149 #ifdef FEAT_TITLE
151- set_title_defaults(); /* set 'title' and 'icon' again */
150+ set_title_defaults(); // set 'title' and 'icon' again
152151 #endif
153152 #if defined(GUI_MAY_SPAWN) && defined(EXPERIMENTAL_GUI_CMD)
154153 if (msg)
@@ -158,8 +157,8 @@
158157
159158 vim_free(old_term);
160159
161- /* If the GUI started successfully, trigger the GUIEnter event, otherwise
162- * the GUIFailed event. */
160+ // If the GUI started successfully, trigger the GUIEnter event, otherwise
161+ // the GUIFailed event.
163162 gui_mch_update();
164163 apply_autocmds(gui.in_use ? EVENT_GUIENTER : EVENT_GUIFAILED,
165164 NULL, NULL, FALSE, curbuf);
@@ -202,7 +201,7 @@
202201 set_vim_var_nr(VV_WINDOWID, (long)x11_window);
203202 # endif
204203
205- /* Display error messages in a dialog now. */
204+ // Display error messages in a dialog now.
206205 display_errors();
207206 }
208207 #endif
@@ -211,7 +210,7 @@
211210
212211 #ifdef GUI_MAY_FORK
213212
214-/* for waitpid() */
213+// for waitpid()
215214 # if defined(HAVE_SYS_WAIT_H) || defined(HAVE_UNION_WAIT)
216215 # include <sys/wait.h>
217216 # endif
@@ -231,38 +230,38 @@
231230 static void
232231 gui_do_fork(void)
233232 {
234- int pipefd[2]; /* pipe between parent and child */
233+ int pipefd[2]; // pipe between parent and child
235234 int pipe_error;
236235 int status;
237236 int exit_status;
238237 pid_t pid = -1;
239238
240- /* Setup a pipe between the child and the parent, so that the parent
241- * knows when the child has done the setsid() call and is allowed to
242- * exit. */
239+ // Setup a pipe between the child and the parent, so that the parent
240+ // knows when the child has done the setsid() call and is allowed to
241+ // exit.
243242 pipe_error = (pipe(pipefd) < 0);
244243 pid = fork();
245- if (pid < 0) /* Fork error */
244+ if (pid < 0) // Fork error
246245 {
247246 emsg(_("E851: Failed to create a new process for the GUI"));
248247 return;
249248 }
250- else if (pid > 0) /* Parent */
249+ else if (pid > 0) // Parent
251250 {
252- /* Give the child some time to do the setsid(), otherwise the
253- * exit() may kill the child too (when starting gvim from inside a
254- * gvim). */
251+ // Give the child some time to do the setsid(), otherwise the
252+ // exit() may kill the child too (when starting gvim from inside a
253+ // gvim).
255254 if (!pipe_error)
256255 {
257- /* The read returns when the child closes the pipe (or when
258- * the child dies for some reason). */
256+ // The read returns when the child closes the pipe (or when
257+ // the child dies for some reason).
259258 close(pipefd[1]);
260259 status = gui_read_child_pipe(pipefd[0]);
261260 if (status == GUI_CHILD_FAILED)
262261 {
263- /* The child failed to start the GUI, so the caller must
264- * continue. There may be more error information written
265- * to stderr by the child. */
262+ // The child failed to start the GUI, so the caller must
263+ // continue. There may be more error information written
264+ // to stderr by the child.
266265 # ifdef __NeXT__
267266 wait4(pid, &exit_status, 0, (struct rusage *)0);
268267 # else
@@ -275,14 +274,14 @@
275274 {
276275 pipe_error = TRUE;
277276 }
278- /* else GUI_CHILD_OK: parent exit */
277+ // else GUI_CHILD_OK: parent exit
279278 }
280279
281280 if (pipe_error)
282281 ui_delay(301L, TRUE);
283282
284- /* When swapping screens we may need to go to the next line, e.g.,
285- * after a hit-enter prompt and using ":gui". */
283+ // When swapping screens we may need to go to the next line, e.g.,
284+ // after a hit-enter prompt and using ":gui".
286285 if (newline_on_exit)
287286 mch_errmsg("\r\n");
288287
@@ -292,10 +291,10 @@
292291 */
293292 _exit(0);
294293 }
295- /* Child */
294+ // Child
296295
297296 #ifdef FEAT_GUI_GTK
298- /* Call gtk_init_check() here after fork(). See gui_init_check(). */
297+ // Call gtk_init_check() here after fork(). See gui_init_check().
299298 if (gui_mch_init_check() != OK)
300299 getout_preserve_modified(1);
301300 #endif
@@ -315,14 +314,14 @@
315314 close(pipefd[0]);
316315
317316 # if defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION)
318- /* Tell the session manager our new PID */
317+ // Tell the session manager our new PID
319318 gui_mch_forked();
320319 # endif
321320
322- /* Try to start the GUI */
321+ // Try to start the GUI
323322 gui_attempt_start();
324323
325- /* Notify the parent */
324+ // Notify the parent
326325 if (!pipe_error)
327326 {
328327 if (gui.in_use)
@@ -332,7 +331,7 @@
332331 close(pipefd[1]);
333332 }
334333
335- /* If we failed to start the GUI, exit now. */
334+ // If we failed to start the GUI, exit now.
336335 if (!gui.in_use)
337336 getout_preserve_modified(1);
338337 }
@@ -364,7 +363,7 @@
364363 return GUI_CHILD_FAILED;
365364 }
366365
367-#endif /* GUI_MAY_FORK */
366+#endif // GUI_MAY_FORK
368367
369368 /*
370369 * Call this when vim starts up, whether or not the GUI is started
@@ -372,8 +371,8 @@
372371 void
373372 gui_prepare(int *argc, char **argv)
374373 {
375- gui.in_use = FALSE; /* No GUI yet (maybe later) */
376- gui.starting = FALSE; /* No GUI yet (maybe later) */
374+ gui.in_use = FALSE; // No GUI yet (maybe later)
375+ gui.starting = FALSE; // No GUI yet (maybe later)
377376 gui_mch_prepare(argc, argv);
378377 }
379378
@@ -397,7 +396,7 @@
397396
398397 gui.shell_created = FALSE;
399398 gui.dying = FALSE;
400- gui.in_focus = TRUE; /* so the guicursor setting works */
399+ gui.in_focus = TRUE; // so the guicursor setting works
401400 gui.dragged_sb = SBAR_NONE;
402401 gui.dragged_wp = NULL;
403402 gui.pointer_hidden = FALSE;
@@ -441,7 +440,7 @@
441440 gui.menu_font = NOFONT;
442441 # endif
443442 # endif
444- gui.menu_is_active = TRUE; /* default: include menu */
443+ gui.menu_is_active = TRUE; // default: include menu
445444 # ifndef FEAT_GUI_GTK
446445 gui.menu_height = MENU_DEFAULT_HEIGHT;
447446 gui.menu_width = 0;
@@ -499,7 +498,7 @@
499498
500499 clip_init(TRUE);
501500
502- /* If can't initialize, don't try doing the rest */
501+ // If can't initialize, don't try doing the rest
503502 if (gui_init_check() == FAIL)
504503 {
505504 --recursive;
@@ -596,8 +595,8 @@
596595 {
597596 stat_T s;
598597
599- /* if ".gvimrc" file is not owned by user, set 'secure'
600- * mode */
598+ // if ".gvimrc" file is not owned by user, set 'secure'
599+ // mode
601600 if (mch_stat(GVIMRC_FILE, &s) || s.st_uid != getuid())
602601 secure = p_secure;
603602 }
@@ -638,19 +637,19 @@
638637 --recursive;
639638 }
640639
641- /* If recursive call opened the shell, return here from the first call */
640+ // If recursive call opened the shell, return here from the first call
642641 if (gui.in_use)
643642 return;
644643
645644 /*
646645 * Create the GUI shell.
647646 */
648- gui.in_use = TRUE; /* Must be set after menus have been set up */
647+ gui.in_use = TRUE; // Must be set after menus have been set up
649648 if (gui_mch_init() == FAIL)
650649 goto error;
651650
652- /* Avoid a delay for an error message that was printed in the terminal
653- * where Vim was started. */
651+ // Avoid a delay for an error message that was printed in the terminal
652+ // where Vim was started.
654653 emsg_on_display = FALSE;
655654 msg_scrolled = 0;
656655 clear_sb_text(TRUE);
@@ -686,7 +685,7 @@
686685 gui.num_rows = Rows;
687686 gui_reset_scroll_region();
688687
689- /* Create initial scrollbars */
688+ // Create initial scrollbars
690689 FOR_ALL_WINDOWS(wp)
691690 {
692691 gui_create_scrollbar(&wp->w_scrollbars[SBAR_LEFT], SBAR_LEFT, wp);
@@ -701,10 +700,10 @@
701700 sign_gui_started();
702701 #endif
703702
704- /* Configure the desired menu and scrollbars */
703+ // Configure the desired menu and scrollbars
705704 gui_init_which_components(NULL);
706705
707- /* All components of the GUI have been created now */
706+ // All components of the GUI have been created now
708707 gui.shell_created = TRUE;
709708
710709 #ifdef FEAT_GUI_MSWIN
@@ -723,8 +722,8 @@
723722 # endif
724723 #endif
725724 #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU)
726- /* Need to set the size of the menubar after all the menus have been
727- * created. */
725+ // Need to set the size of the menubar after all the menus have been
726+ // created.
728727 gui_mch_compute_menu_height((Widget)0);
729728 #endif
730729
@@ -739,16 +738,16 @@
739738 #endif
740739 init_gui_options();
741740 #ifdef FEAT_ARABIC
742- /* Our GUI can't do bidi. */
741+ // Our GUI can't do bidi.
743742 p_tbidi = FALSE;
744743 #endif
745744 #if defined(FEAT_GUI_GTK)
746- /* Give GTK+ a chance to put all widget's into place. */
745+ // Give GTK+ a chance to put all widget's into place.
747746 gui_mch_update();
748747
749748 # ifdef FEAT_MENU
750- /* If there is no 'm' in 'guioptions' we need to remove the menu now.
751- * It was still there to make F10 work. */
749+ // If there is no 'm' in 'guioptions' we need to remove the menu now.
750+ // It was still there to make F10 work.
752751 if (vim_strchr(p_go, GO_MENUS) == NULL)
753752 {
754753 --gui.starting;
@@ -758,19 +757,19 @@
758757 }
759758 # endif
760759
761- /* Now make sure the shell fits on the screen. */
760+ // Now make sure the shell fits on the screen.
762761 if (gui_mch_maximized())
763762 gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH);
764763 else
765764 gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH);
766765 #endif
767- /* When 'lines' was set while starting up the topframe may have to be
768- * resized. */
766+ // When 'lines' was set while starting up the topframe may have to be
767+ // resized.
769768 win_new_shellsize();
770769
771770 #ifdef FEAT_BEVAL_GUI
772- /* Always create the Balloon Evaluation area, but disable it when
773- * 'ballooneval' is off. */
771+ // Always create the Balloon Evaluation area, but disable it when
772+ // 'ballooneval' is off.
774773 if (balloonEval != NULL)
775774 {
776775 # ifdef FEAT_VARTABS
@@ -804,8 +803,8 @@
804803 if (!im_xim_isvalid_imactivate())
805804 emsg(_("E599: Value of 'imactivatekey' is invalid"));
806805 #endif
807- /* When 'cmdheight' was set during startup it may not have taken
808- * effect yet. */
806+ // When 'cmdheight' was set during startup it may not have taken
807+ // effect yet.
809808 if (p_ch != 1L)
810809 command_height();
811810
@@ -814,7 +813,7 @@
814813
815814 error2:
816815 #ifdef FEAT_GUI_X11
817- /* undo gui_mch_init() */
816+ // undo gui_mch_init()
818817 gui_mch_uninit();
819818 #endif
820819
@@ -827,8 +826,8 @@
827826 void
828827 gui_exit(int rc)
829828 {
830- /* don't free the fonts, it leads to a BUS error
831- * richard@whitequeen.com Jul 99 */
829+ // don't free the fonts, it leads to a BUS error
830+ // richard@whitequeen.com Jul 99
832831 free_highlight_fonts();
833832 gui.in_use = FALSE;
834833 gui_mch_exit(rc);
@@ -850,7 +849,7 @@
850849
851850 save_cmdmod = cmdmod;
852851
853- /* Only exit when there are no changed files */
852+ // Only exit when there are no changed files
854853 exiting = TRUE;
855854 # ifdef FEAT_BROWSE
856855 cmdmod.browse = TRUE;
@@ -858,14 +857,14 @@
858857 # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG)
859858 cmdmod.confirm = TRUE;
860859 # endif
861- /* If there are changed buffers, present the user with a dialog if
862- * possible, otherwise give an error message. */
860+ // If there are changed buffers, present the user with a dialog if
861+ // possible, otherwise give an error message.
863862 if (!check_changed_any(FALSE, FALSE))
864863 getout(0);
865864
866865 exiting = FALSE;
867866 cmdmod = save_cmdmod;
868- gui_update_screen(); /* redraw, window may show changed buffer */
867+ gui_update_screen(); // redraw, window may show changed buffer
869868 }
870869 #endif
871870
@@ -894,26 +893,26 @@
894893 else
895894 {
896895 #ifdef FEAT_XFONTSET
897- /* When using a fontset, the whole list of fonts is one name. */
896+ // When using a fontset, the whole list of fonts is one name.
898897 if (fontset)
899898 ret = gui_mch_init_font(font_list, TRUE);
900899 else
901900 #endif
902901 while (*font_list != NUL)
903902 {
904- /* Isolate one comma separated font name. */
903+ // Isolate one comma separated font name.
905904 (void)copy_option_part(&font_list, font_name, FONTLEN, ",");
906905
907- /* Careful!!! The Win32 version of gui_mch_init_font(), when
908- * called with "*" will change p_guifont to the selected font
909- * name, which frees the old value. This makes font_list
910- * invalid. Thus when OK is returned here, font_list must no
911- * longer be used! */
906+ // Careful!!! The Win32 version of gui_mch_init_font(), when
907+ // called with "*" will change p_guifont to the selected font
908+ // name, which frees the old value. This makes font_list
909+ // invalid. Thus when OK is returned here, font_list must no
910+ // longer be used!
912911 if (gui_mch_init_font(font_name, FALSE) == OK)
913912 {
914913 #if !defined(FEAT_GUI_GTK)
915- /* If it's a Unicode font, try setting 'guifontwide' to a
916- * similar double-width font. */
914+ // If it's a Unicode font, try setting 'guifontwide' to a
915+ // similar double-width font.
917916 if ((p_guifontwide == NULL || *p_guifontwide == NUL)
918917 && strstr((char *)font_name, "10646") != NULL)
919918 set_guifontwide(font_name);
@@ -939,7 +938,7 @@
939938 if (ret == OK)
940939 {
941940 #ifndef FEAT_GUI_GTK
942- /* Set normal font as current font */
941+ // Set normal font as current font
943942 # ifdef FEAT_XFONTSET
944943 if (gui.fontset != NOFONTSET)
945944 gui_mch_set_fontset(gui.fontset);
@@ -961,7 +960,7 @@
961960 set_guifontwide(char_u *name)
962961 {
963962 int i = 0;
964- char_u wide_name[FONTLEN + 10]; /* room for 2 * width and '*' */
963+ char_u wide_name[FONTLEN + 10]; // room for 2 * width and '*'
965964 char_u *wp = NULL;
966965 char_u *p;
967966 GuiFont font;
@@ -973,18 +972,18 @@
973972 if (*p == '-')
974973 {
975974 ++i;
976- if (i == 6) /* font type: change "--" to "-*-" */
975+ if (i == 6) // font type: change "--" to "-*-"
977976 {
978977 if (p[1] == '-')
979978 *wp++ = '*';
980979 }
981- else if (i == 12) /* found the width */
980+ else if (i == 12) // found the width
982981 {
983982 ++p;
984983 i = getdigits(&p);
985984 if (i != 0)
986985 {
987- /* Double the width specification. */
986+ // Double the width specification.
988987 sprintf((char *)wp, "%d%s", i * 2, p);
989988 font = gui_mch_get_font(wide_name, FALSE);
990989 if (font != NOFONT)
@@ -1000,7 +999,7 @@
1000999 }
10011000 }
10021001 }
1003-#endif /* !FEAT_GUI_GTK */
1002+#endif // !FEAT_GUI_GTK
10041003
10051004 /*
10061005 * Get the font for 'guifontwide'.
@@ -1013,14 +1012,14 @@
10131012 char_u font_name[FONTLEN];
10141013 char_u *p;
10151014
1016- if (!gui.in_use) /* Can't allocate font yet, assume it's OK. */
1017- return OK; /* Will give an error message later. */
1015+ if (!gui.in_use) // Can't allocate font yet, assume it's OK.
1016+ return OK; // Will give an error message later.
10181017
10191018 if (p_guifontwide != NULL && *p_guifontwide != NUL)
10201019 {
10211020 for (p = p_guifontwide; *p != NUL; )
10221021 {
1023- /* Isolate one comma separated font name. */
1022+ // Isolate one comma separated font name.
10241023 (void)copy_option_part(&p, font_name, FONTLEN, ",");
10251024 font = gui_mch_get_font(font_name, FALSE);
10261025 if (font != NOFONT)
@@ -1032,7 +1031,7 @@
10321031
10331032 gui_mch_free_font(gui.wide_font);
10341033 #ifdef FEAT_GUI_GTK
1035- /* Avoid unnecessary overhead if 'guifontwide' is equal to 'guifont'. */
1034+ // Avoid unnecessary overhead if 'guifontwide' is equal to 'guifont'.
10361035 if (font != NOFONT && gui.norm_font != NOFONT
10371036 && pango_font_description_equal(font, gui.norm_font))
10381037 {
@@ -1081,8 +1080,8 @@
10811080 */
10821081 void
10831082 gui_update_cursor(
1084- int force, /* when TRUE, update even when not moved */
1085- int clear_selection)/* clear selection under cursor */
1083+ int force, // when TRUE, update even when not moved
1084+ int clear_selection) // clear selection under cursor
10861085 {
10871086 int cur_width = 0;
10881087 int cur_height = 0;
@@ -1093,13 +1092,13 @@
10931092 guicolor_T shape_fg = INVALCOLOR;
10941093 guicolor_T shape_bg = INVALCOLOR;
10951094 #endif
1096- guicolor_T cfg, cbg, cc; /* cursor fore-/background color */
1097- int cattr; /* cursor attributes */
1095+ guicolor_T cfg, cbg, cc; // cursor fore-/background color
1096+ int cattr; // cursor attributes
10981097 int attr;
10991098 attrentry_T *aep = NULL;
11001099
1101- /* Don't update the cursor when halfway busy scrolling or the screen size
1102- * doesn't match 'columns' and 'lines. ScreenLines[] isn't valid then. */
1100+ // Don't update the cursor when halfway busy scrolling or the screen size
1101+ // doesn't match 'columns' and 'lines. ScreenLines[] isn't valid then.
11031102 if (!can_update_cursor || screen_Columns != gui.num_cols
11041103 || screen_Rows != gui.num_rows)
11051104 return;
@@ -1118,15 +1117,15 @@
11181117 gui.cursor_row = gui.row;
11191118 gui.cursor_col = gui.col;
11201119
1121- /* Only write to the screen after ScreenLines[] has been initialized */
1120+ // Only write to the screen after ScreenLines[] has been initialized
11221121 if (!screen_cleared || ScreenLines == NULL)
11231122 return;
11241123
1125- /* Clear the selection if we are about to write over it */
1124+ // Clear the selection if we are about to write over it
11261125 if (clear_selection)
11271126 clip_may_clear_selection(gui.row, gui.row);
1128- /* Check that the cursor is inside the shell (resizing may have made
1129- * it invalid) */
1127+ // Check that the cursor is inside the shell (resizing may have made
1128+ // it invalid)
11301129 if (gui.row >= screen_Rows || gui.col >= screen_Columns)
11311130 return;
11321131
@@ -1147,7 +1146,7 @@
11471146 else
11481147 id = shape->id;
11491148
1150- /* get the colors and attributes for the cursor. Default is inverted */
1149+ // get the colors and attributes for the cursor. Default is inverted
11511150 cfg = INVALCOLOR;
11521151 cbg = INVALCOLOR;
11531152 cattr = HL_INVERSE;
@@ -1292,16 +1291,16 @@
12921291 if (has_mbyte && (*mb_off2cells)(LineOffset[gui.row] + gui.col,
12931292 LineOffset[gui.row] + screen_Columns) > 1)
12941293 {
1295- /* Double wide character. */
1294+ // Double wide character.
12961295 if (shape->shape != SHAPE_VER)
12971296 cur_width += gui.char_width;
12981297 #ifdef FEAT_RIGHTLEFT
12991298 if (CURSOR_BAR_RIGHT)
13001299 {
1301- /* gui.col points to the left halve of the character but
1302- * the vertical line needs to be on the right halve.
1303- * A double-wide horizontal line is also drawn from the
1304- * right halve in gui_mch_draw_part_cursor(). */
1300+ // gui.col points to the left halve of the character but
1301+ // the vertical line needs to be on the right halve.
1302+ // A double-wide horizontal line is also drawn from the
1303+ // right halve in gui_mch_draw_part_cursor().
13051304 col_off = TRUE;
13061305 ++gui.col;
13071306 }
@@ -1313,7 +1312,7 @@
13131312 --gui.col;
13141313 #endif
13151314
1316-#ifndef FEAT_GUI_MSWIN /* doesn't seem to work for MSWindows */
1315+#ifndef FEAT_GUI_MSWIN // doesn't seem to work for MSWindows
13171316 gui.highlight_mask = ScreenAttrs[LineOffset[gui.row] + gui.col];
13181317 (void)gui_screenchar(LineOffset[gui.row] + gui.col,
13191318 GUI_MON_TRS_CURSOR | GUI_MON_NOCLEAR,
@@ -1347,7 +1346,7 @@
13471346 int text_area_width;
13481347 int text_area_height;
13491348
1350- /* avoid that moving components around generates events */
1349+ // avoid that moving components around generates events
13511350 ++hold_gui_events;
13521351
13531352 text_area_x = 0;
@@ -1436,9 +1435,9 @@
14361435 if (gui.which_scrollbars[SBAR_BOTTOM])
14371436 base_height += gui.scrollbar_height;
14381437 #ifdef FEAT_GUI_GTK
1439- /* We can't take the sizes properly into account until anything is
1440- * realized. Therefore we recalculate all the values here just before
1441- * setting the size. (--mdcki) */
1438+ // We can't take the sizes properly into account until anything is
1439+ // realized. Therefore we recalculate all the values here just before
1440+ // setting the size. (--mdcki)
14421441 #else
14431442 # ifdef FEAT_MENU
14441443 if (gui.menu_is_active)
@@ -1477,7 +1476,7 @@
14771476 {
14781477 static int busy = FALSE;
14791478
1480- if (!gui.shell_created) /* ignore when still initializing */
1479+ if (!gui.shell_created) // ignore when still initializing
14811480 return;
14821481
14831482 /*
@@ -1496,7 +1495,7 @@
14961495 new_pixel_height = 0;
14971496 busy = TRUE;
14981497
1499- /* Flush pending output before redrawing */
1498+ // Flush pending output before redrawing
15001499 out_flush();
15011500
15021501 gui.num_cols = (pixel_width - gui_get_base_width()) / gui.char_width;
@@ -1512,8 +1511,8 @@
15121511 if (State == ASKMORE || State == CONFIRM)
15131512 gui.row = gui.num_rows;
15141513
1515- /* Only comparing Rows and Columns may be sufficient, but let's stay on
1516- * the safe side. */
1514+ // Only comparing Rows and Columns may be sufficient, but let's stay on
1515+ // the safe side.
15171516 if (gui.num_rows != screen_Rows || gui.num_cols != screen_Columns
15181517 || gui.num_rows != Rows || gui.num_cols != Columns)
15191518 shell_resized();
@@ -1526,9 +1525,9 @@
15261525
15271526 busy = FALSE;
15281527
1529- /* We may have been called again while redrawing the screen.
1530- * Need to do it all again with the latest size then. But only if the size
1531- * actually changed. */
1528+ // We may have been called again while redrawing the screen.
1529+ // Need to do it all again with the latest size then. But only if the size
1530+ // actually changed.
15321531 if (new_pixel_height)
15331532 {
15341533 if (pixel_width == new_pixel_width && pixel_height == new_pixel_height)
@@ -1552,8 +1551,8 @@
15521551 gui_may_resize_shell(void)
15531552 {
15541553 if (new_pixel_height)
1555- /* careful: gui_resize_shell() may postpone the resize again if we
1556- * were called indirectly by it */
1554+ // careful: gui_resize_shell() may postpone the resize again if we
1555+ // were called indirectly by it
15571556 gui_resize_shell(new_pixel_width, new_pixel_height);
15581557 }
15591558
@@ -1576,7 +1575,7 @@
15761575 gui_set_shellsize(
15771576 int mustset UNUSED,
15781577 int fit_to_display,
1579- int direction) /* RESIZE_HOR, RESIZE_VER */
1578+ int direction) // RESIZE_HOR, RESIZE_VER
15801579 {
15811580 int base_width;
15821581 int base_height;
@@ -1596,8 +1595,8 @@
15961595 return;
15971596
15981597 #if defined(MSWIN) || defined(FEAT_GUI_GTK)
1599- /* If not setting to a user specified size and maximized, calculate the
1600- * number of characters that fit in the maximized window. */
1598+ // If not setting to a user specified size and maximized, calculate the
1599+ // number of characters that fit in the maximized window.
16011600 if (!mustset && (vim_strchr(p_go, GO_KEEPWINSIZE) != NULL
16021601 || gui_mch_maximized()))
16031602 {
@@ -1609,7 +1608,7 @@
16091608 base_width = gui_get_base_width();
16101609 base_height = gui_get_base_height();
16111610 if (fit_to_display)
1612- /* Remember the original window position. */
1611+ // Remember the original window position.
16131612 (void)gui_mch_get_winpos(&x, &y);
16141613
16151614 width = Columns * gui.char_width + base_width;
@@ -1640,7 +1639,7 @@
16401639 #ifdef FEAT_GUI_GTK
16411640 if (did_adjust == 2 || (width + gui.char_width >= screen_w
16421641 && height + gui.char_height >= screen_h))
1643- /* don't unmaximize if at maximum size */
1642+ // don't unmaximize if at maximum size
16441643 un_maximize = FALSE;
16451644 #endif
16461645 }
@@ -1655,8 +1654,8 @@
16551654 #ifdef FEAT_GUI_GTK
16561655 if (un_maximize)
16571656 {
1658- /* If the window size is smaller than the screen unmaximize the
1659- * window, otherwise resizing won't work. */
1657+ // If the window size is smaller than the screen unmaximize the
1658+ // window, otherwise resizing won't work.
16601659 gui_mch_get_screen_dimensions(&screen_w, &screen_h);
16611660 if ((width + gui.char_width < screen_w
16621661 || height + gui.char_height * 2 < screen_h)
@@ -1670,9 +1669,9 @@
16701669
16711670 if (fit_to_display && x >= 0 && y >= 0)
16721671 {
1673- /* Some window managers put the Vim window left of/above the screen.
1674- * Only change the position if it wasn't already negative before
1675- * (happens on MS-Windows with a secondary monitor). */
1672+ // Some window managers put the Vim window left of/above the screen.
1673+ // Only change the position if it wasn't already negative before
1674+ // (happens on MS-Windows with a secondary monitor).
16761675 gui_mch_update();
16771676 if (gui_mch_get_winpos(&x, &y) == OK && (x < 0 || y < 0))
16781677 gui_mch_set_winpos(x < 0 ? 0 : x, y < 0 ? 0 : y);
@@ -1707,18 +1706,18 @@
17071706 static void
17081707 gui_start_highlight(int mask)
17091708 {
1710- if (mask > HL_ALL) /* highlight code */
1709+ if (mask > HL_ALL) // highlight code
17111710 gui.highlight_mask = mask;
1712- else /* mask */
1711+ else // mask
17131712 gui.highlight_mask |= mask;
17141713 }
17151714
17161715 void
17171716 gui_stop_highlight(int mask)
17181717 {
1719- if (mask > HL_ALL) /* highlight code */
1718+ if (mask > HL_ALL) // highlight code
17201719 gui.highlight_mask = HL_NORMAL;
1721- else /* mask */
1720+ else // mask
17221721 gui.highlight_mask &= ~mask;
17231722 }
17241723
@@ -1733,12 +1732,12 @@
17331732 int row2,
17341733 int col2)
17351734 {
1736- /* Clear the selection if we are about to write over it */
1735+ // Clear the selection if we are about to write over it
17371736 clip_may_clear_selection(row1, row2);
17381737
17391738 gui_mch_clear_block(row1, col1, row2, col2);
17401739
1741- /* Invalidate cursor if it was in this block */
1740+ // Invalidate cursor if it was in this block
17421741 if ( gui.cursor_row >= row1 && gui.cursor_row <= row2
17431742 && gui.cursor_col >= col1 && gui.cursor_col <= col2)
17441743 gui.cursor_is_valid = FALSE;
@@ -1761,11 +1760,11 @@
17611760 {
17621761 char_u *p;
17631762 int arg1 = 0, arg2 = 0;
1764- int force_cursor = FALSE; /* force cursor update */
1763+ int force_cursor = FALSE; // force cursor update
17651764 int force_scrollbar = FALSE;
17661765 static win_T *old_curwin = NULL;
17671766
1768-/* #define DEBUG_GUI_WRITE */
1767+// #define DEBUG_GUI_WRITE
17691768 #ifdef DEBUG_GUI_WRITE
17701769 {
17711770 int i;
@@ -1810,19 +1809,19 @@
18101809 }
18111810 switch (*p)
18121811 {
1813- case 'C': /* Clear screen */
1812+ case 'C': // Clear screen
18141813 clip_scroll_selection(9999);
18151814 gui_mch_clear_all();
18161815 gui.cursor_is_valid = FALSE;
18171816 force_scrollbar = TRUE;
18181817 break;
1819- case 'M': /* Move cursor */
1818+ case 'M': // Move cursor
18201819 gui_set_cursor(arg1, arg2);
18211820 break;
1822- case 's': /* force cursor (shape) update */
1821+ case 's': // force cursor (shape) update
18231822 force_cursor = TRUE;
18241823 break;
1825- case 'R': /* Set scroll region */
1824+ case 'R': // Set scroll region
18261825 if (arg1 < arg2)
18271826 {
18281827 gui.scroll_region_top = arg1;
@@ -1834,7 +1833,7 @@
18341833 gui.scroll_region_bot = arg1;
18351834 }
18361835 break;
1837- case 'V': /* Set vertical scroll region */
1836+ case 'V': // Set vertical scroll region
18381837 if (arg1 < arg2)
18391838 {
18401839 gui.scroll_region_left = arg1;
@@ -1846,33 +1845,33 @@
18461845 gui.scroll_region_right = arg1;
18471846 }
18481847 break;
1849- case 'd': /* Delete line */
1848+ case 'd': // Delete line
18501849 gui_delete_lines(gui.row, 1);
18511850 break;
1852- case 'D': /* Delete lines */
1851+ case 'D': // Delete lines
18531852 gui_delete_lines(gui.row, arg1);
18541853 break;
1855- case 'i': /* Insert line */
1854+ case 'i': // Insert line
18561855 gui_insert_lines(gui.row, 1);
18571856 break;
1858- case 'I': /* Insert lines */
1857+ case 'I': // Insert lines
18591858 gui_insert_lines(gui.row, arg1);
18601859 break;
1861- case '$': /* Clear to end-of-line */
1860+ case '$': // Clear to end-of-line
18621861 gui_clear_block(gui.row, gui.col, gui.row,
18631862 (int)Columns - 1);
18641863 break;
1865- case 'h': /* Turn on highlighting */
1864+ case 'h': // Turn on highlighting
18661865 gui_start_highlight(arg1);
18671866 break;
1868- case 'H': /* Turn off highlighting */
1867+ case 'H': // Turn off highlighting
18691868 gui_stop_highlight(arg1);
18701869 break;
1871- case 'f': /* flash the window (visual bell) */
1870+ case 'f': // flash the window (visual bell)
18721871 gui_mch_flash(arg1 == 0 ? 20 : arg1);
18731872 break;
18741873 default:
1875- p = s + 1; /* Skip the ESC */
1874+ p = s + 1; // Skip the ESC
18761875 break;
18771876 }
18781877 len -= (int)(++p - s);
@@ -1880,9 +1879,9 @@
18801879 }
18811880 else if (
18821881 #ifdef EBCDIC
1883- CtrlChar(s[0]) != 0 /* Ctrl character */
1882+ CtrlChar(s[0]) != 0 // Ctrl character
18841883 #else
1885- s[0] < 0x20 /* Ctrl character */
1884+ s[0] < 0x20 // Ctrl character
18861885 #endif
18871886 #ifdef FEAT_SIGN_ICONS
18881887 && s[0] != SIGN_BYTE
@@ -1892,7 +1891,7 @@
18921891 #endif
18931892 )
18941893 {
1895- if (s[0] == '\n') /* NL */
1894+ if (s[0] == '\n') // NL
18961895 {
18971896 gui.col = 0;
18981897 if (gui.row < gui.scroll_region_bot)
@@ -1900,26 +1899,26 @@
19001899 else
19011900 gui_delete_lines(gui.scroll_region_top, 1);
19021901 }
1903- else if (s[0] == '\r') /* CR */
1902+ else if (s[0] == '\r') // CR
19041903 {
19051904 gui.col = 0;
19061905 }
1907- else if (s[0] == '\b') /* Backspace */
1906+ else if (s[0] == '\b') // Backspace
19081907 {
19091908 if (gui.col)
19101909 --gui.col;
19111910 }
1912- else if (s[0] == Ctrl_L) /* cursor-right */
1911+ else if (s[0] == Ctrl_L) // cursor-right
19131912 {
19141913 ++gui.col;
19151914 }
1916- else if (s[0] == Ctrl_G) /* Beep */
1915+ else if (s[0] == Ctrl_G) // Beep
19171916 {
19181917 gui_mch_beep();
19191918 }
1920- /* Other Ctrl character: shouldn't happen! */
1921-
1922- --len; /* Skip this char */
1919+ // Other Ctrl character: shouldn't happen!
1920+
1921+ --len; // Skip this char
19231922 ++s;
19241923 }
19251924 else
@@ -1947,20 +1946,20 @@
19471946 }
19481947 }
19491948
1950- /* Postponed update of the cursor (won't work if "can_update_cursor" isn't
1951- * set). */
1949+ // Postponed update of the cursor (won't work if "can_update_cursor" isn't
1950+ // set).
19521951 if (force_cursor)
19531952 gui_update_cursor(TRUE, TRUE);
19541953
1955- /* When switching to another window the dragging must have stopped.
1956- * Required for GTK, dragged_sb isn't reset. */
1954+ // When switching to another window the dragging must have stopped.
1955+ // Required for GTK, dragged_sb isn't reset.
19571956 if (old_curwin != curwin)
19581957 gui.dragged_sb = SBAR_NONE;
19591958
1960- /* Update the scrollbars after clearing the screen or when switched
1961- * to another window.
1962- * Update the horizontal scrollbar always, it's difficult to check all
1963- * situations where it might change. */
1959+ // Update the scrollbars after clearing the screen or when switched
1960+ // to another window.
1961+ // Update the horizontal scrollbar always, it's difficult to check all
1962+ // situations where it might change.
19641963 if (force_scrollbar || old_curwin != curwin)
19651964 gui_update_scrollbars(force_scrollbar);
19661965 else
@@ -1975,7 +1974,7 @@
19751974 gui.dragged_sb = SBAR_NONE;
19761975 #endif
19771976
1978- gui_may_flush(); /* In case vim decides to take a nap */
1977+ gui_may_flush(); // In case vim decides to take a nap
19791978 }
19801979
19811980 /*
@@ -1988,7 +1987,7 @@
19881987 {
19891988 if (gui.in_use)
19901989 {
1991- /* Undraw the cursor now, we probably can't do it after the change. */
1990+ // Undraw the cursor now, we probably can't do it after the change.
19921991 if (undraw)
19931992 gui_undraw_cursor();
19941993 can_update_cursor = FALSE;
@@ -1999,8 +1998,8 @@
19991998 gui_can_update_cursor(void)
20001999 {
20012000 can_update_cursor = TRUE;
2002- /* No need to update the cursor right now, there is always more output
2003- * after scrolling. */
2001+ // No need to update the cursor right now, there is always more output
2002+ // after scrolling.
20042003 }
20052004
20062005 /*
@@ -2047,7 +2046,7 @@
20472046 {
20482047 if (has_mbyte)
20492048 {
2050- /* Find out how many chars fit in the current line. */
2049+ // Find out how many chars fit in the current line.
20512050 cells = 0;
20522051 for (this_len = 0; this_len < len; )
20532052 {
@@ -2057,7 +2056,7 @@
20572056 this_len += (*mb_ptr2len)(s + this_len);
20582057 }
20592058 if (this_len > len)
2060- this_len = len; /* don't include following composing char */
2059+ this_len = len; // don't include following composing char
20612060 }
20622061 else
20632062 if (gui.col + len > Columns)
@@ -2069,11 +2068,11 @@
20692068 0, (guicolor_T)0, (guicolor_T)0, 0);
20702069 s += this_len;
20712070 len -= this_len;
2072- /* fill up for a double-width char that doesn't fit. */
2071+ // fill up for a double-width char that doesn't fit.
20732072 if (len > 0 && gui.col < Columns)
20742073 (void)gui_outstr_nowrap((char_u *)" ", 1,
20752074 0, (guicolor_T)0, (guicolor_T)0, 0);
2076- /* The cursor may wrap to the next line. */
2075+ // The cursor may wrap to the next line.
20772076 if (gui.col >= Columns)
20782077 {
20792078 gui.col = 0;
@@ -2089,20 +2088,20 @@
20892088 */
20902089 static int
20912090 gui_screenchar(
2092- int off, /* Offset from start of screen */
2091+ int off, // Offset from start of screen
20932092 int flags,
2094- guicolor_T fg, /* colors for cursor */
2095- guicolor_T bg, /* colors for cursor */
2096- int back) /* backup this many chars when using bold trick */
2093+ guicolor_T fg, // colors for cursor
2094+ guicolor_T bg, // colors for cursor
2095+ int back) // backup this many chars when using bold trick
20972096 {
20982097 char_u buf[MB_MAXBYTES + 1];
20992098
2100- /* Don't draw right halve of a double-width UTF-8 char. "cannot happen" */
2099+ // Don't draw right halve of a double-width UTF-8 char. "cannot happen"
21012100 if (enc_utf8 && ScreenLines[off] == 0)
21022101 return OK;
21032102
21042103 if (enc_utf8 && ScreenLinesUC[off] != 0)
2105- /* Draw UTF-8 multi-byte character. */
2104+ // Draw UTF-8 multi-byte character.
21062105 return gui_outstr_nowrap(buf, utfc_char2bytes(off, buf),
21072106 flags, fg, bg, back);
21082107
@@ -2113,7 +2112,7 @@
21132112 return gui_outstr_nowrap(buf, 2, flags, fg, bg, back);
21142113 }
21152114
2116- /* Draw non-multi-byte character or DBCS character. */
2115+ // Draw non-multi-byte character or DBCS character.
21172116 return gui_outstr_nowrap(ScreenLines + off,
21182117 enc_dbcs ? (*mb_ptr2len)(ScreenLines + off) : 1,
21192118 flags, fg, bg, back);
@@ -2127,31 +2126,31 @@
21272126 */
21282127 static int
21292128 gui_screenstr(
2130- int off, /* Offset from start of screen */
2131- int len, /* string length in screen cells */
2129+ int off, // Offset from start of screen
2130+ int len, // string length in screen cells
21322131 int flags,
2133- guicolor_T fg, /* colors for cursor */
2134- guicolor_T bg, /* colors for cursor */
2135- int back) /* backup this many chars when using bold trick */
2132+ guicolor_T fg, // colors for cursor
2133+ guicolor_T bg, // colors for cursor
2134+ int back) // backup this many chars when using bold trick
21362135 {
21372136 char_u *buf;
21382137 int outlen = 0;
21392138 int i;
21402139 int retval;
21412140
2142- if (len <= 0) /* "cannot happen"? */
2141+ if (len <= 0) // "cannot happen"?
21432142 return OK;
21442143
21452144 if (enc_utf8)
21462145 {
21472146 buf = alloc(len * MB_MAXBYTES + 1);
21482147 if (buf == NULL)
2149- return OK; /* not much we could do here... */
2148+ return OK; // not much we could do here...
21502149
21512150 for (i = off; i < off + len; ++i)
21522151 {
21532152 if (ScreenLines[i] == 0)
2154- continue; /* skip second half of double-width char */
2153+ continue; // skip second half of double-width char
21552154
21562155 if (ScreenLinesUC[i] == 0)
21572156 buf[outlen++] = ScreenLines[i];
@@ -2159,7 +2158,7 @@
21592158 outlen += utfc_char2bytes(i, buf + outlen);
21602159 }
21612160
2162- buf[outlen] = NUL; /* only to aid debugging */
2161+ buf[outlen] = NUL; // only to aid debugging
21632162 retval = gui_outstr_nowrap(buf, outlen, flags, fg, bg, back);
21642163 vim_free(buf);
21652164
@@ -2169,20 +2168,20 @@
21692168 {
21702169 buf = alloc(len * 2 + 1);
21712170 if (buf == NULL)
2172- return OK; /* not much we could do here... */
2171+ return OK; // not much we could do here...
21732172
21742173 for (i = off; i < off + len; ++i)
21752174 {
21762175 buf[outlen++] = ScreenLines[i];
21772176
2178- /* handle double-byte single-width char */
2177+ // handle double-byte single-width char
21792178 if (ScreenLines[i] == 0x8e)
21802179 buf[outlen++] = ScreenLines2[i];
21812180 else if (MB_BYTE2LEN(ScreenLines[i]) == 2)
21822181 buf[outlen++] = ScreenLines[++i];
21832182 }
21842183
2185- buf[outlen] = NUL; /* only to aid debugging */
2184+ buf[outlen] = NUL; // only to aid debugging
21862185 retval = gui_outstr_nowrap(buf, outlen, flags, fg, bg, back);
21872186 vim_free(buf);
21882187
@@ -2194,7 +2193,7 @@
21942193 flags, fg, bg, back);
21952194 }
21962195 }
2197-#endif /* FEAT_GUI_GTK */
2196+#endif // FEAT_GUI_GTK
21982197
21992198 /*
22002199 * Output the given string at the current cursor position. If the string is
@@ -2214,9 +2213,9 @@
22142213 char_u *s,
22152214 int len,
22162215 int flags,
2217- guicolor_T fg, /* colors for cursor */
2218- guicolor_T bg, /* colors for cursor */
2219- int back) /* backup this many chars when using bold trick */
2216+ guicolor_T fg, // colors for cursor
2217+ guicolor_T bg, // colors for cursor
2218+ int back) // backup this many chars when using bold trick
22202219 {
22212220 long_u highlight_mask;
22222221 long_u hl_mask_todo;
@@ -2258,7 +2257,7 @@
22582257 if (*s == MULTISIGN_BYTE)
22592258 multi_sign = TRUE;
22602259 # endif
2261- /* draw spaces instead */
2260+ // draw spaces instead
22622261 if (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) == 'u' &&
22632262 (curwin->w_p_nu || curwin->w_p_rnu))
22642263 {
@@ -2283,7 +2282,7 @@
22832282 if (gui.highlight_mask > HL_ALL)
22842283 {
22852284 aep = syn_gui_attr2entry(gui.highlight_mask);
2286- if (aep == NULL) /* highlighting not set */
2285+ if (aep == NULL) // highlighting not set
22872286 highlight_mask = 0;
22882287 else
22892288 highlight_mask = aep->ae_attr;
@@ -2293,7 +2292,7 @@
22932292 hl_mask_todo = highlight_mask;
22942293
22952294 #if !defined(FEAT_GUI_GTK)
2296- /* Set the font */
2295+ // Set the font
22972296 if (aep != NULL && aep->ae_u.gui.font != NOFONT)
22982297 font = aep->ae_u.gui.font;
22992298 # ifdef FEAT_XFONTSET
@@ -2354,7 +2353,7 @@
23542353
23552354 draw_flags = 0;
23562355
2357- /* Set the color */
2356+ // Set the color
23582357 bg_color = gui.back_pixel;
23592358 if ((flags & GUI_MON_IS_CURSOR) && gui.in_focus)
23602359 {
@@ -2401,12 +2400,12 @@
24012400 }
24022401 gui_mch_set_sp_color(sp_color);
24032402
2404- /* Clear the selection if we are about to write over it */
2403+ // Clear the selection if we are about to write over it
24052404 if (!(flags & GUI_MON_NOCLEAR))
24062405 clip_may_clear_selection(gui.row, gui.row);
24072406
24082407
2409- /* If there's no bold font, then fake it */
2408+ // If there's no bold font, then fake it
24102409 if (hl_mask_todo & (HL_BOLD | HL_STANDOUT))
24112410 draw_flags |= DRAW_BOLD;
24122411
@@ -2419,29 +2418,29 @@
24192418 return FAIL;
24202419
24212420 #if defined(FEAT_GUI_GTK)
2422- /* If there's no italic font, then fake it.
2423- * For GTK2, we don't need a different font for italic style. */
2421+ // If there's no italic font, then fake it.
2422+ // For GTK2, we don't need a different font for italic style.
24242423 if (hl_mask_todo & HL_ITALIC)
24252424 draw_flags |= DRAW_ITALIC;
24262425
2427- /* Do we underline the text? */
2426+ // Do we underline the text?
24282427 if (hl_mask_todo & HL_UNDERLINE)
24292428 draw_flags |= DRAW_UNDERL;
24302429
24312430 #else
2432- /* Do we underline the text? */
2431+ // Do we underline the text?
24332432 if ((hl_mask_todo & HL_UNDERLINE) || (hl_mask_todo & HL_ITALIC))
24342433 draw_flags |= DRAW_UNDERL;
24352434 #endif
2436- /* Do we undercurl the text? */
2435+ // Do we undercurl the text?
24372436 if (hl_mask_todo & HL_UNDERCURL)
24382437 draw_flags |= DRAW_UNDERC;
24392438
2440- /* Do we strikethrough the text? */
2439+ // Do we strikethrough the text?
24412440 if (hl_mask_todo & HL_STRIKETHROUGH)
24422441 draw_flags |= DRAW_STRIKE;
24432442
2444- /* Do we draw transparently? */
2443+ // Do we draw transparently?
24452444 if (flags & GUI_MON_TRS_CURSOR)
24462445 draw_flags |= DRAW_TRANSP;
24472446
@@ -2449,31 +2448,31 @@
24492448 * Draw the text.
24502449 */
24512450 #ifdef FEAT_GUI_GTK
2452- /* The value returned is the length in display cells */
2451+ // The value returned is the length in display cells
24532452 len = gui_gtk2_draw_string(gui.row, col, s, len, draw_flags);
24542453 #else
24552454 if (enc_utf8)
24562455 {
2457- int start; /* index of bytes to be drawn */
2458- int cells; /* cellwidth of bytes to be drawn */
2459- int thislen; /* length of bytes to be drawn */
2460- int cn; /* cellwidth of current char */
2461- int i; /* index of current char */
2462- int c; /* current char value */
2463- int cl; /* byte length of current char */
2464- int comping; /* current char is composing */
2465- int scol = col; /* screen column */
2466- int curr_wide = FALSE; /* use 'guifontwide' */
2456+ int start; // index of bytes to be drawn
2457+ int cells; // cellwidth of bytes to be drawn
2458+ int thislen; // length of bytes to be drawn
2459+ int cn; // cellwidth of current char
2460+ int i; // index of current char
2461+ int c; // current char value
2462+ int cl; // byte length of current char
2463+ int comping; // current char is composing
2464+ int scol = col; // screen column
2465+ int curr_wide = FALSE; // use 'guifontwide'
24672466 int prev_wide = FALSE;
24682467 int wide_changed;
24692468 # ifdef MSWIN
2470- int sep_comp = FALSE; /* Don't separate composing chars. */
2469+ int sep_comp = FALSE; // Don't separate composing chars.
24712470 # else
2472- int sep_comp = TRUE; /* Separate composing chars. */
2471+ int sep_comp = TRUE; // Separate composing chars.
24732472 # endif
24742473
2475- /* Break the string at a composing character, it has to be drawn on
2476- * top of the previous character. */
2474+ // Break the string at a composing character, it has to be drawn on
2475+ // top of the previous character.
24772476 start = 0;
24782477 cells = 0;
24792478 for (i = 0; i < len; i += cl)
@@ -2481,7 +2480,7 @@
24812480 c = utf_ptr2char(s + i);
24822481 cn = utf_char2cells(c);
24832482 comping = utf_iscomposing(c);
2484- if (!comping) /* count cells from non-composing chars */
2483+ if (!comping) // count cells from non-composing chars
24852484 cells += cn;
24862485 if (!comping || sep_comp)
24872486 {
@@ -2495,20 +2494,20 @@
24952494 curr_wide = FALSE;
24962495 }
24972496 cl = utf_ptr2len(s + i);
2498- if (cl == 0) /* hit end of string */
2499- len = i + cl; /* len must be wrong "cannot happen" */
2497+ if (cl == 0) // hit end of string
2498+ len = i + cl; // len must be wrong "cannot happen"
25002499
25012500 wide_changed = curr_wide != prev_wide;
25022501
2503- /* Print the string so far if it's the last character or there is
2504- * a composing character. */
2502+ // Print the string so far if it's the last character or there is
2503+ // a composing character.
25052504 if (i + cl >= len || (comping && sep_comp && i > start)
25062505 || wide_changed
25072506 # if defined(FEAT_GUI_X11)
25082507 || (cn > 1
25092508 # ifdef FEAT_XFONTSET
2510- /* No fontset: At least draw char after wide char at
2511- * right position. */
2509+ // No fontset: At least draw char after wide char at
2510+ // right position.
25122511 && fontset == NOFONTSET
25132512 # endif
25142513 )
@@ -2531,8 +2530,8 @@
25312530 }
25322531 scol += cells;
25332532 cells = 0;
2534- /* Adjust to not draw a character which width is changed
2535- * against with last one. */
2533+ // Adjust to not draw a character which width is changed
2534+ // against with last one.
25362535 if (wide_changed && !(comping && sep_comp))
25372536 {
25382537 scol -= cn;
@@ -2540,8 +2539,8 @@
25402539 }
25412540
25422541 # if defined(FEAT_GUI_X11)
2543- /* No fontset: draw a space to fill the gap after a wide char
2544- * */
2542+ // No fontset: draw a space to fill the gap after a wide char
2543+ //
25452544 if (cn > 1 && (draw_flags & DRAW_TRANSP) == 0
25462545 # ifdef FEAT_XFONTSET
25472546 && fontset == NOFONTSET
@@ -2551,11 +2550,11 @@
25512550 1, draw_flags);
25522551 # endif
25532552 }
2554- /* Draw a composing char on top of the previous char. */
2553+ // Draw a composing char on top of the previous char.
25552554 if (comping && sep_comp)
25562555 {
25572556 # if defined(__APPLE_CC__) && TARGET_API_MAC_CARBON
2558- /* Carbon ATSUI autodraws composing char over previous char */
2557+ // Carbon ATSUI autodraws composing char over previous char
25592558 gui_mch_draw_string(gui.row, scol, s + i, cl,
25602559 draw_flags | DRAW_TRANSP);
25612560 # else
@@ -2566,7 +2565,7 @@
25662565 }
25672566 prev_wide = curr_wide;
25682567 }
2569- /* The stuff below assumes "len" is the length in screen columns. */
2568+ // The stuff below assumes "len" is the length in screen columns.
25702569 len = scol - col;
25712570 }
25722571 else
@@ -2574,23 +2573,23 @@
25742573 gui_mch_draw_string(gui.row, col, s, len, draw_flags);
25752574 if (enc_dbcs == DBCS_JPNU)
25762575 {
2577- /* Get the length in display cells, this can be different from the
2578- * number of bytes for "euc-jp". */
2576+ // Get the length in display cells, this can be different from the
2577+ // number of bytes for "euc-jp".
25792578 len = mb_string2cells(s, len);
25802579 }
25812580 }
2582-#endif /* !FEAT_GUI_GTK */
2581+#endif // !FEAT_GUI_GTK
25832582
25842583 if (!(flags & (GUI_MON_IS_CURSOR | GUI_MON_TRS_CURSOR)))
25852584 gui.col = col + len;
25862585
2587- /* May need to invert it when it's part of the selection. */
2586+ // May need to invert it when it's part of the selection.
25882587 if (flags & GUI_MON_NOCLEAR)
25892588 clip_may_redraw_selection(gui.row, col, len);
25902589
25912590 if (!(flags & (GUI_MON_IS_CURSOR | GUI_MON_TRS_CURSOR)))
25922591 {
2593- /* Invalidate the old physical cursor position if we wrote over it */
2592+ // Invalidate the old physical cursor position if we wrote over it
25942593 if (gui.cursor_row == gui.row
25952594 && gui.cursor_col >= col
25962595 && gui.cursor_col < col + len)
@@ -2599,7 +2598,7 @@
25992598
26002599 #ifdef FEAT_SIGN_ICONS
26012600 if (draw_sign)
2602- /* Draw the sign on top of the spaces. */
2601+ // Draw the sign on top of the spaces.
26032602 gui_mch_drawsign(gui.row, signcol, gui.highlight_mask);
26042603 # if defined(FEAT_NETBEANS_INTG) && (defined(FEAT_GUI_X11) \
26052604 || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN))
@@ -2670,7 +2669,7 @@
26702669 int col1,
26712670 int row2,
26722671 int col2,
2673- int flags) /* flags for gui_outstr_nowrap() */
2672+ int flags) // flags for gui_outstr_nowrap()
26742673 {
26752674 int old_row, old_col;
26762675 long_u old_hl_mask;
@@ -2681,18 +2680,18 @@
26812680 int retval = FALSE;
26822681 int orig_col1, orig_col2;
26832682
2684- /* Don't try to update when ScreenLines is not valid */
2683+ // Don't try to update when ScreenLines is not valid
26852684 if (!screen_cleared || ScreenLines == NULL)
26862685 return retval;
26872686
2688- /* Don't try to draw outside the shell! */
2689- /* Check everything, strange values may be caused by a big border width */
2687+ // Don't try to draw outside the shell!
2688+ // Check everything, strange values may be caused by a big border width
26902689 col1 = check_col(col1);
26912690 col2 = check_col(col2);
26922691 row1 = check_row(row1);
26932692 row2 = check_row(row2);
26942693
2695- /* Remember where our cursor was */
2694+ // Remember where our cursor was
26962695 old_row = gui.row;
26972696 old_col = gui.col;
26982697 old_hl_mask = gui.highlight_mask;
@@ -2701,8 +2700,8 @@
27012700
27022701 for (gui.row = row1; gui.row <= row2; gui.row++)
27032702 {
2704- /* When only half of a double-wide character is in the block, include
2705- * the other half. */
2703+ // When only half of a double-wide character is in the block, include
2704+ // the other half.
27062705 col1 = orig_col1;
27072706 col2 = orig_col2;
27082707 off = LineOffset[gui.row];
@@ -2739,8 +2738,8 @@
27392738 off = LineOffset[gui.row] + gui.col;
27402739 len = col2 - col1 + 1;
27412740
2742- /* Find how many chars back this highlighting starts, or where a space
2743- * is. Needed for when the bold trick is used */
2741+ // Find how many chars back this highlighting starts, or where a space
2742+ // is. Needed for when the bold trick is used
27442743 for (back = 0; back < col1; ++back)
27452744 if (ScreenAttrs[off - 1 - back] != ScreenAttrs[off]
27462745 || ScreenLines[off - 1 - back] == ' ')
@@ -2748,8 +2747,8 @@
27482747 retval = (col1 > 0 && ScreenAttrs[off - 1] != 0 && back == 0
27492748 && ScreenLines[off - 1] != ' ');
27502749
2751- /* Break it up in strings of characters with the same attributes. */
2752- /* Print UTF-8 characters individually. */
2750+ // Break it up in strings of characters with the same attributes.
2751+ // Print UTF-8 characters individually.
27532752 while (len > 0)
27542753 {
27552754 first_attr = ScreenAttrs[off];
@@ -2757,7 +2756,7 @@
27572756 #if !defined(FEAT_GUI_GTK)
27582757 if (enc_utf8 && ScreenLinesUC[off] != 0)
27592758 {
2760- /* output multi-byte character separately */
2759+ // output multi-byte character separately
27612760 nback = gui_screenchar(off, flags,
27622761 (guicolor_T)0, (guicolor_T)0, back);
27632762 if (gui.col < Columns && ScreenLines[off + 1] == 0)
@@ -2767,7 +2766,7 @@
27672766 }
27682767 else if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e)
27692768 {
2770- /* output double-byte, single-width character separately */
2769+ // output double-byte, single-width character separately
27712770 nback = gui_screenchar(off, flags,
27722771 (guicolor_T)0, (guicolor_T)0, back);
27732772 idx = 1;
@@ -2779,28 +2778,28 @@
27792778 for (idx = 0; idx < len; ++idx)
27802779 {
27812780 if (enc_utf8 && ScreenLines[off + idx] == 0)
2782- continue; /* skip second half of double-width char */
2781+ continue; // skip second half of double-width char
27832782 if (ScreenAttrs[off + idx] != first_attr)
27842783 break;
27852784 }
2786- /* gui_screenstr() takes care of multibyte chars */
2785+ // gui_screenstr() takes care of multibyte chars
27872786 nback = gui_screenstr(off, idx, flags,
27882787 (guicolor_T)0, (guicolor_T)0, back);
27892788 #else
27902789 for (idx = 0; idx < len && ScreenAttrs[off + idx] == first_attr;
27912790 idx++)
27922791 {
2793- /* Stop at a multi-byte Unicode character. */
2792+ // Stop at a multi-byte Unicode character.
27942793 if (enc_utf8 && ScreenLinesUC[off + idx] != 0)
27952794 break;
27962795 if (enc_dbcs == DBCS_JPNU)
27972796 {
2798- /* Stop at a double-byte single-width char. */
2797+ // Stop at a double-byte single-width char.
27992798 if (ScreenLines[off + idx] == 0x8e)
28002799 break;
28012800 if (len > 1 && (*mb_ptr2len)(ScreenLines
28022801 + off + idx) == 2)
2803- ++idx; /* skip second byte of double-byte char */
2802+ ++idx; // skip second byte of double-byte char
28042803 }
28052804 }
28062805 nback = gui_outstr_nowrap(ScreenLines + off, idx, flags,
@@ -2809,8 +2808,8 @@
28092808 }
28102809 if (nback == FAIL)
28112810 {
2812- /* Must back up to start drawing where a bold or italic word
2813- * starts. */
2811+ // Must back up to start drawing where a bold or italic word
2812+ // starts.
28142813 off -= back;
28152814 len += back;
28162815 gui.col -= back;
@@ -2824,7 +2823,7 @@
28242823 }
28252824 }
28262825
2827- /* Put the cursor back where it was */
2826+ // Put the cursor back where it was
28282827 gui.row = old_row;
28292828 gui.col = old_col;
28302829 gui.highlight_mask = (int)old_hl_mask;
@@ -2839,15 +2838,15 @@
28392838 return;
28402839
28412840 if (row + count > gui.scroll_region_bot)
2842- /* Scrolled out of region, just blank the lines out */
2841+ // Scrolled out of region, just blank the lines out
28432842 gui_clear_block(row, gui.scroll_region_left,
28442843 gui.scroll_region_bot, gui.scroll_region_right);
28452844 else
28462845 {
28472846 gui_mch_delete_lines(row, count);
28482847
2849- /* If the cursor was in the deleted lines it's now gone. If the
2850- * cursor was in the scrolled lines adjust its position. */
2848+ // If the cursor was in the deleted lines it's now gone. If the
2849+ // cursor was in the scrolled lines adjust its position.
28512850 if (gui.cursor_row >= row
28522851 && gui.cursor_col >= gui.scroll_region_left
28532852 && gui.cursor_col <= gui.scroll_region_right)
@@ -2867,7 +2866,7 @@
28672866 return;
28682867
28692868 if (row + count > gui.scroll_region_bot)
2870- /* Scrolled out of region, just blank the lines out */
2869+ // Scrolled out of region, just blank the lines out
28712870 gui_clear_block(row, gui.scroll_region_left,
28722871 gui.scroll_region_bot, gui.scroll_region_right);
28732872 else
@@ -2992,7 +2991,7 @@
29922991 gui_inchar(
29932992 char_u *buf,
29942993 int maxlen,
2995- long wtime, /* milli seconds */
2994+ long wtime, // milli seconds
29962995 int tb_change_cnt)
29972996 {
29982997 return gui_wait_for_chars_buf(buf, maxlen, wtime, tb_change_cnt);
@@ -3069,7 +3068,7 @@
30693068 button_char = KE_MOUSERIGHT;
30703069 button_set:
30713070 {
3072- /* Don't put events in the input queue now. */
3071+ // Don't put events in the input queue now.
30733072 if (hold_gui_events)
30743073 return;
30753074
@@ -3077,8 +3076,8 @@
30773076 string[4] = KS_EXTRA;
30783077 string[5] = (int)button_char;
30793078
3080- /* Pass the pointer coordinates of the scroll event so that we
3081- * know which window to scroll. */
3079+ // Pass the pointer coordinates of the scroll event so that we
3080+ // know which window to scroll.
30823081 row = gui_xy2colrow(x, y, &col);
30833082 string[6] = (char_u)(col / 128 + ' ' + 1);
30843083 string[7] = (char_u)(col % 128 + ' ' + 1);
@@ -3105,14 +3104,14 @@
31053104 }
31063105
31073106 #ifdef FEAT_CLIPBOARD
3108- /* If a clipboard selection is in progress, handle it */
3107+ // If a clipboard selection is in progress, handle it
31093108 if (clip_star.state == SELECT_IN_PROGRESS)
31103109 {
31113110 clip_process_selection(button, X_2_COL(x), Y_2_ROW(y), repeated_click);
31123111 return;
31133112 }
31143113
3115- /* Determine which mouse settings to look for based on the current mode */
3114+ // Determine which mouse settings to look for based on the current mode
31163115 switch (get_real_state())
31173116 {
31183117 case NORMAL_BUSY:
@@ -3130,9 +3129,9 @@
31303129 case INSERT:
31313130 case INSERT+LANGMAP: checkfor = MOUSE_INSERT; break;
31323131 case ASKMORE:
3133- case HITRETURN: /* At the more- and hit-enter prompt pass the
3134- mouse event for a click on or below the
3135- message line. */
3132+ case HITRETURN: // At the more- and hit-enter prompt pass the
3133+ // mouse event for a click on or below the
3134+ // message line.
31363135 if (Y_2_ROW(y) >= msg_row)
31373136 checkfor = MOUSE_NORMAL;
31383137 else
@@ -3192,7 +3191,7 @@
31923191 */
31933192 if (!mouse_has(checkfor) || checkfor == MOUSE_COMMAND)
31943193 {
3195- /* Don't do modeless selection in Visual mode. */
3194+ // Don't do modeless selection in Visual mode.
31963195 if (checkfor != MOUSE_NONEF && VIsual_active && (State & NORMAL))
31973196 return;
31983197
@@ -3207,9 +3206,9 @@
32073206 modifiers &= ~ MOUSE_SHIFT;
32083207 }
32093208
3210- /* If the selection is done, allow the right button to extend it.
3211- * If the selection is cleared, allow the right button to start it
3212- * from the cursor position. */
3209+ // If the selection is done, allow the right button to extend it.
3210+ // If the selection is cleared, allow the right button to start it
3211+ // from the cursor position.
32133212 if (button == MOUSE_RIGHT)
32143213 {
32153214 if (clip_star.state == SELECT_CLEARED)
@@ -3230,14 +3229,14 @@
32303229 repeated_click);
32313230 did_clip = TRUE;
32323231 }
3233- /* Allow the left button to start the selection */
3232+ // Allow the left button to start the selection
32343233 else if (button == MOUSE_LEFT)
32353234 {
32363235 clip_start_selection(X_2_COL(x), Y_2_ROW(y), repeated_click);
32373236 did_clip = TRUE;
32383237 }
32393238
3240- /* Always allow pasting */
3239+ // Always allow pasting
32413240 if (button != MOUSE_MIDDLE)
32423241 {
32433242 if (!mouse_has(checkfor) || button == MOUSE_RELEASE)
@@ -3252,7 +3251,7 @@
32523251 clip_clear_selection(&clip_star);
32533252 #endif
32543253
3255- /* Don't put events in the input queue now. */
3254+ // Don't put events in the input queue now.
32563255 if (hold_gui_events)
32573256 return;
32583257
@@ -3266,7 +3265,7 @@
32663265 {
32673266 if (row == prev_row && col == prev_col)
32683267 return;
3269- /* Dragging above the window, set "row" to -1 to cause a scroll. */
3268+ // Dragging above the window, set "row" to -1 to cause a scroll.
32703269 if (y < 0)
32713270 row = -1;
32723271 }
@@ -3283,7 +3282,7 @@
32833282 )
32843283 repeated_click = FALSE;
32853284
3286- string[0] = CSI; /* this sequence is recognized by check_termcode() */
3285+ string[0] = CSI; // this sequence is recognized by check_termcode()
32873286 string[1] = KS_MOUSE;
32883287 string[2] = KE_FILLER;
32893288 if (button != MOUSE_DRAG && button != MOUSE_RELEASE)
@@ -3356,7 +3355,7 @@
33563355 {
33573356 char_u bytes[sizeof(long_u)];
33583357
3359- /* Don't put events in the input queue now. */
3358+ // Don't put events in the input queue now.
33603359 if (hold_gui_events)
33613360 return;
33623361
@@ -3464,7 +3463,7 @@
34643463 break;
34653464 #endif
34663465 case GO_GREY:
3467- /* make menu's have grey items, ignored here */
3466+ // make menu's have grey items, ignored here
34683467 break;
34693468 #ifdef FEAT_TOOLBAR
34703469 case GO_TOOLBAR:
@@ -3482,7 +3481,7 @@
34823481 #endif
34833482 break;
34843483 default:
3485- /* Ignore options that are not supported */
3484+ // Ignore options that are not supported
34863485 break;
34873486 }
34883487
@@ -3500,13 +3499,13 @@
35003499 #endif
35013500
35023501 #ifdef FEAT_GUI_TABLINE
3503- /* Update the GUI tab line, it may appear or disappear. This may
3504- * cause the non-GUI tab line to disappear or appear. */
3502+ // Update the GUI tab line, it may appear or disappear. This may
3503+ // cause the non-GUI tab line to disappear or appear.
35053504 using_tabline = gui_has_tabline();
35063505 if (!gui_mch_showing_tabline() != !using_tabline)
35073506 {
3508- /* We don't want a resize event change "Rows" here, save and
3509- * restore it. Resizing is handled below. */
3507+ // We don't want a resize event change "Rows" here, save and
3508+ // restore it. Resizing is handled below.
35103509 i = Rows;
35113510 gui_update_tabline();
35123511 Rows = i;
@@ -3514,16 +3513,16 @@
35143513 if (using_tabline)
35153514 fix_size = TRUE;
35163515 if (!gui_use_tabline())
3517- redraw_tabline = TRUE; /* may draw non-GUI tab line */
3516+ redraw_tabline = TRUE; // may draw non-GUI tab line
35183517 }
35193518 #endif
35203519
35213520 for (i = 0; i < 3; i++)
35223521 {
3523- /* The scrollbar needs to be updated when it is shown/unshown and
3524- * when switching tab pages. But the size only changes when it's
3525- * shown/unshown. Thus we need two places to remember whether a
3526- * scrollbar is there or not. */
3522+ // The scrollbar needs to be updated when it is shown/unshown and
3523+ // when switching tab pages. But the size only changes when it's
3524+ // shown/unshown. Thus we need two places to remember whether a
3525+ // scrollbar is there or not.
35273526 if (gui.which_scrollbars[i] != prev_which_scrollbars[i]
35283527 || gui.which_scrollbars[i]
35293528 != curtab->tp_prev_which_scrollbars[i])
@@ -3553,8 +3552,8 @@
35533552 #ifdef FEAT_MENU
35543553 if (gui.menu_is_active != prev_menu_is_active)
35553554 {
3556- /* We don't want a resize event change "Rows" here, save and
3557- * restore it. Resizing is handled below. */
3555+ // We don't want a resize event change "Rows" here, save and
3556+ // restore it. Resizing is handled below.
35583557 i = Rows;
35593558 gui_mch_enable_menu(gui.menu_is_active);
35603559 Rows = i;
@@ -3598,22 +3597,22 @@
35983597 long prev_Columns = Columns;
35993598 long prev_Rows = Rows;
36003599 #endif
3601- /* Adjust the size of the window to make the text area keep the
3602- * same size and to avoid that part of our window is off-screen
3603- * and a scrollbar can't be used, for example. */
3600+ // Adjust the size of the window to make the text area keep the
3601+ // same size and to avoid that part of our window is off-screen
3602+ // and a scrollbar can't be used, for example.
36043603 gui_set_shellsize(FALSE, fix_size, need_set_size);
36053604
36063605 #ifdef FEAT_GUI_GTK
3607- /* GTK has the annoying habit of sending us resize events when
3608- * changing the window size ourselves. This mostly happens when
3609- * waiting for a character to arrive, quite unpredictably, and may
3610- * change Columns and Rows when we don't want it. Wait for a
3611- * character here to avoid this effect.
3612- * If you remove this, please test this command for resizing
3613- * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
3614- * Don't do this while starting up though.
3615- * Don't change Rows when adding menu/toolbar/tabline.
3616- * Don't change Columns when adding vertical toolbar. */
3606+ // GTK has the annoying habit of sending us resize events when
3607+ // changing the window size ourselves. This mostly happens when
3608+ // waiting for a character to arrive, quite unpredictably, and may
3609+ // change Columns and Rows when we don't want it. Wait for a
3610+ // character here to avoid this effect.
3611+ // If you remove this, please test this command for resizing
3612+ // effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q".
3613+ // Don't do this while starting up though.
3614+ // Don't change Rows when adding menu/toolbar/tabline.
3615+ // Don't change Columns when adding vertical toolbar.
36173616 if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR))
36183617 (void)char_avail();
36193618 if ((need_set_size & RESIZE_VERT) == 0)
@@ -3622,10 +3621,10 @@
36223621 Columns = prev_Columns;
36233622 #endif
36243623 }
3625- /* When the console tabline appears or disappears the window positions
3626- * change. */
3624+ // When the console tabline appears or disappears the window positions
3625+ // change.
36273626 if (firstwin->w_winrow != tabline_height())
3628- shell_new_rows(); /* recompute window positions and heights */
3627+ shell_new_rows(); // recompute window positions and heights
36293628 }
36303629 }
36313630
@@ -3666,8 +3665,8 @@
36663665
36673666 if (!gui.starting && starting == 0)
36683667 {
3669- /* Updating the tabline uses direct GUI commands, flush
3670- * outstanding instructions first. (esp. clear screen) */
3668+ // Updating the tabline uses direct GUI commands, flush
3669+ // outstanding instructions first. (esp. clear screen)
36713670 out_flush();
36723671
36733672 if (!showit != !shown)
@@ -3675,8 +3674,8 @@
36753674 if (showit != 0)
36763675 gui_mch_update_tabline();
36773676
3678- /* When the tabs change from hidden to shown or from shown to
3679- * hidden the size of the text area should remain the same. */
3677+ // When the tabs change from hidden to shown or from shown to
3678+ // hidden the size of the text area should remain the same.
36803679 if (!showit != !shown)
36813680 gui_set_shellsize(FALSE, showit, RESIZE_VERT);
36823681 }
@@ -3688,7 +3687,7 @@
36883687 void
36893688 get_tabline_label(
36903689 tabpage_T *tp,
3691- int tooltip) /* TRUE: get tooltip */
3690+ int tooltip) // TRUE: get tooltip
36923691 {
36933692 int modified = FALSE;
36943693 char_u buf[40];
@@ -3696,7 +3695,7 @@
36963695 win_T *wp;
36973696 char_u **opt;
36983697
3699- /* Use 'guitablabel' or 'guitabtooltip' if it's set. */
3698+ // Use 'guitablabel' or 'guitabtooltip' if it's set.
37003699 opt = (tooltip ? &p_gtt : &p_gtl);
37013700 if (**opt != NUL)
37023701 {
@@ -3714,7 +3713,7 @@
37143713 set_vim_var_nr(VV_LNUM, printer_page_num);
37153714 use_sandbox = was_set_insecurely(opt_name, 0);
37163715 # endif
3717- /* It's almost as going to the tabpage, but without autocommands. */
3716+ // It's almost as going to the tabpage, but without autocommands.
37183717 curtab->tp_firstwin = firstwin;
37193718 curtab->tp_lastwin = lastwin;
37203719 curtab->tp_curwin = curwin;
@@ -3726,12 +3725,12 @@
37263725 curwin = curtab->tp_curwin;
37273726 curbuf = curwin->w_buffer;
37283727
3729- /* Can't use NameBuff directly, build_stl_str_hl() uses it. */
3728+ // Can't use NameBuff directly, build_stl_str_hl() uses it.
37303729 build_stl_str_hl(curwin, res, MAXPATHL, *opt, use_sandbox,
37313730 0, (int)Columns, NULL, NULL);
37323731 STRCPY(NameBuff, res);
37333732
3734- /* Back to the original curtab. */
3733+ // Back to the original curtab.
37353734 curtab = save_curtab;
37363735 topframe = curtab->tp_topframe;
37373736 firstwin = curtab->tp_firstwin;
@@ -3745,11 +3744,11 @@
37453744 called_emsg |= save_called_emsg;
37463745 }
37473746
3748- /* If 'guitablabel'/'guitabtooltip' is not set or the result is empty then
3749- * use a default label. */
3747+ // If 'guitablabel'/'guitabtooltip' is not set or the result is empty then
3748+ // use a default label.
37503749 if (**opt == NUL || *NameBuff == NUL)
37513750 {
3752- /* Get the buffer name into NameBuff[] and shorten it. */
3751+ // Get the buffer name into NameBuff[] and shorten it.
37533752 get_trans_bufname(tp == curtab ? curbuf : tp->tp_curwin->w_buffer);
37543753 if (!tooltip)
37553754 shorten_dir(NameBuff);
@@ -3786,14 +3785,14 @@
37863785 if (nr == tabpage_index(curtab))
37873786 return FALSE;
37883787
3789- /* Don't put events in the input queue now. */
3788+ // Don't put events in the input queue now.
37903789 if (hold_gui_events
37913790 # ifdef FEAT_CMDWIN
37923791 || cmdwin_type != 0
37933792 # endif
37943793 )
37953794 {
3796- /* Set it back to the current tab page. */
3795+ // Set it back to the current tab page.
37973796 gui_mch_set_curtab(tabpage_index(curtab));
37983797 return FALSE;
37993798 }
@@ -3865,7 +3864,7 @@
38653864 {
38663865 static int sbar_ident = 0;
38673866
3868- sb->ident = sbar_ident++; /* No check for too big, but would it happen? */
3867+ sb->ident = sbar_ident++; // No check for too big, but would it happen?
38693868 sb->wp = wp;
38703869 sb->type = type;
38713870 sb->value = 0;
@@ -3935,7 +3934,7 @@
39353934 if (sb == NULL)
39363935 return;
39373936
3938- /* Don't put events in the input queue now. */
3937+ // Don't put events in the input queue now.
39393938 if (hold_gui_events)
39403939 return;
39413940
@@ -3958,13 +3957,13 @@
39583957 {
39593958 gui.dragged_sb = SBAR_NONE;
39603959 #ifdef FEAT_GUI_GTK
3961- /* Keep the "dragged_wp" value until after the scrolling, for when the
3962- * mouse button is released. GTK2 doesn't send the button-up event. */
3960+ // Keep the "dragged_wp" value until after the scrolling, for when the
3961+ // mouse button is released. GTK2 doesn't send the button-up event.
39633962 gui.dragged_wp = NULL;
39643963 #endif
39653964 }
39663965
3967- /* Vertical sbar info is kept in the first sbar (the left one) */
3966+ // Vertical sbar info is kept in the first sbar (the left one)
39683967 if (sb->wp != NULL)
39693968 sb = &sb->wp->w_scrollbars[0];
39703969
@@ -3984,14 +3983,14 @@
39843983 sb->value = value;
39853984
39863985 #ifdef USE_ON_FLY_SCROLL
3987- /* When not allowed to do the scrolling right now, return.
3988- * This also checked input_available(), but that causes the first click in
3989- * a scrollbar to be ignored when Vim doesn't have focus. */
3986+ // When not allowed to do the scrolling right now, return.
3987+ // This also checked input_available(), but that causes the first click in
3988+ // a scrollbar to be ignored when Vim doesn't have focus.
39903989 if (dont_scroll)
39913990 return;
39923991 #endif
3993- /* Disallow scrolling the current window when the completion popup menu is
3994- * visible. */
3992+ // Disallow scrolling the current window when the completion popup menu is
3993+ // visible.
39953994 if ((sb->wp == NULL || sb->wp == curwin) && pum_visible())
39963995 return;
39973996
@@ -4004,7 +4003,7 @@
40044003 }
40054004 #endif
40064005
4007- if (sb->wp != NULL) /* vertical scrollbar */
4006+ if (sb->wp != NULL) // vertical scrollbar
40084007 {
40094008 sb_num = 0;
40104009 for (wp = firstwin; wp != sb->wp && wp != NULL; wp = wp->w_next)
@@ -4034,12 +4033,12 @@
40344033 }
40354034 }
40364035 # ifdef FEAT_FOLDING
4037- /* Value may have been changed for closed fold. */
4036+ // Value may have been changed for closed fold.
40384037 sb->value = sb->wp->w_topline - 1;
40394038 # endif
40404039
4041- /* When dragging one scrollbar and there is another one at the other
4042- * side move the thumb of that one too. */
4040+ // When dragging one scrollbar and there is another one at the other
4041+ // side move the thumb of that one too.
40434042 if (gui.which_scrollbars[SBAR_RIGHT] && gui.which_scrollbars[SBAR_LEFT])
40444043 gui_mch_set_scrollbar_thumb(
40454044 &sb->wp->w_scrollbars[
@@ -4074,7 +4073,7 @@
40744073 }
40754074 if (old_leftcol != curwin->w_leftcol)
40764075 {
4077- updateWindow(curwin); /* update window, status and cmdline */
4076+ updateWindow(curwin); // update window, status and cmdline
40784077 setcursor();
40794078 }
40804079 #else
@@ -4098,7 +4097,7 @@
40984097 ))))
40994098 {
41004099 do_check_scrollbind(TRUE);
4101- /* need to update the window right here */
4100+ // need to update the window right here
41024101 FOR_ALL_WINDOWS(wp)
41034102 if (wp->w_redr_type > 0)
41044103 updateWindow(wp);
@@ -4133,21 +4132,21 @@
41334132
41344133 void
41354134 gui_update_scrollbars(
4136- int force) /* Force all scrollbars to get updated */
4135+ int force) // Force all scrollbars to get updated
41374136 {
41384137 win_T *wp;
41394138 scrollbar_T *sb;
4140- long val, size, max; /* need 32 bits here */
4139+ long val, size, max; // need 32 bits here
41414140 int which_sb;
41424141 int h, y;
41434142 static win_T *prev_curwin = NULL;
41444143
4145- /* Update the horizontal scrollbar */
4144+ // Update the horizontal scrollbar
41464145 gui_update_horiz_scrollbar(force);
41474146
41484147 #ifndef MSWIN
4149- /* Return straight away if there is neither a left nor right scrollbar.
4150- * On MS-Windows this is required anyway for scrollwheel messages. */
4148+ // Return straight away if there is neither a left nor right scrollbar.
4149+ // On MS-Windows this is required anyway for scrollwheel messages.
41514150 if (!gui.which_scrollbars[SBAR_LEFT] && !gui.which_scrollbars[SBAR_RIGHT])
41524151 return;
41534152 #endif
@@ -4174,14 +4173,14 @@
41744173 gui.dragged_wp->w_scrollbars[0].max);
41754174 }
41764175
4177- /* avoid that moving components around generates events */
4176+ // avoid that moving components around generates events
41784177 ++hold_gui_events;
41794178
41804179 for (wp = firstwin; wp != NULL; wp = W_NEXT(wp))
41814180 {
4182- if (wp->w_buffer == NULL) /* just in case */
4181+ if (wp->w_buffer == NULL) // just in case
41834182 continue;
4184- /* Skip a scrollbar that is being dragged. */
4183+ // Skip a scrollbar that is being dragged.
41854184 if (!force && (gui.dragged_sb == SBAR_LEFT
41864185 || gui.dragged_sb == SBAR_RIGHT)
41874186 && gui.dragged_wp == wp)
@@ -4192,20 +4191,20 @@
41924191 #else
41934192 max = wp->w_buffer->b_ml.ml_line_count + wp->w_height - 2;
41944193 #endif
4195- if (max < 0) /* empty buffer */
4194+ if (max < 0) // empty buffer
41964195 max = 0;
41974196 val = wp->w_topline - 1;
41984197 size = wp->w_height;
41994198 #ifdef SCROLL_PAST_END
4200- if (val > max) /* just in case */
4199+ if (val > max) // just in case
42014200 val = max;
42024201 #else
4203- if (size > max + 1) /* just in case */
4202+ if (size > max + 1) // just in case
42044203 size = max + 1;
42054204 if (val > max - size + 1)
42064205 val = max - size + 1;
42074206 #endif
4208- if (val < 0) /* minimal value is 0 */
4207+ if (val < 0) // minimal value is 0
42094208 val = 0;
42104209
42114210 /*
@@ -4225,7 +4224,7 @@
42254224 * This can happen during changing files. Just don't update the
42264225 * scrollbar for now.
42274226 */
4228- sb->height = 0; /* Force update next time */
4227+ sb->height = 0; // Force update next time
42294228 if (gui.which_scrollbars[SBAR_LEFT])
42304229 gui_do_scrollbar(wp, SBAR_LEFT, FALSE);
42314230 if (gui.which_scrollbars[SBAR_RIGHT])
@@ -4238,14 +4237,14 @@
42384237 || sb->width != wp->w_width
42394238 || prev_curwin != curwin)
42404239 {
4241- /* Height, width or position of scrollbar has changed. For
4242- * vertical split: curwin changed. */
4240+ // Height, width or position of scrollbar has changed. For
4241+ // vertical split: curwin changed.
42434242 sb->height = wp->w_height;
42444243 sb->top = wp->w_winrow;
42454244 sb->status_height = wp->w_status_height;
42464245 sb->width = wp->w_width;
42474246
4248- /* Calculate height and position in pixels */
4247+ // Calculate height and position in pixels
42494248 h = (sb->height + sb->status_height) * gui.char_height;
42504249 y = sb->top * gui.char_height + gui.border_offset;
42514250 #if defined(FEAT_MENU) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MOTIF) && !defined(FEAT_GUI_PHOTON)
@@ -4271,7 +4270,7 @@
42714270
42724271 if (wp->w_winrow == 0)
42734272 {
4274- /* Height of top scrollbar includes width of top border */
4273+ // Height of top scrollbar includes width of top border
42754274 h += gui.border_offset;
42764275 y -= gui.border_offset;
42774276 }
@@ -4291,10 +4290,10 @@
42914290 }
42924291 }
42934292
4294- /* Reduce the number of calls to gui_mch_set_scrollbar_thumb() by
4295- * checking if the thumb moved at least a pixel. Only do this for
4296- * Athena, most other GUIs require the update anyway to make the
4297- * arrows work. */
4293+ // Reduce the number of calls to gui_mch_set_scrollbar_thumb() by
4294+ // checking if the thumb moved at least a pixel. Only do this for
4295+ // Athena, most other GUIs require the update anyway to make the
4296+ // arrows work.
42984297 #ifdef FEAT_GUI_ATHENA
42994298 if (max == 0)
43004299 y = 0;
@@ -4305,7 +4304,7 @@
43054304 if (force || sb->value != val || sb->size != size || sb->max != max)
43064305 #endif
43074306 {
4308- /* Thumb of scrollbar has moved */
4307+ // Thumb of scrollbar has moved
43094308 sb->value = val;
43104309 #ifdef FEAT_GUI_ATHENA
43114310 sb->pixval = y;
@@ -4334,27 +4333,27 @@
43344333 static void
43354334 gui_do_scrollbar(
43364335 win_T *wp,
4337- int which, /* SBAR_LEFT or SBAR_RIGHT */
4338- int enable) /* TRUE to enable scrollbar */
4336+ int which, // SBAR_LEFT or SBAR_RIGHT
4337+ int enable) // TRUE to enable scrollbar
43394338 {
43404339 int midcol = curwin->w_wincol + curwin->w_width / 2;
43414340 int has_midcol = (wp->w_wincol <= midcol
43424341 && wp->w_wincol + wp->w_width >= midcol);
43434342
4344- /* Only enable scrollbars that contain the middle column of the current
4345- * window. */
4343+ // Only enable scrollbars that contain the middle column of the current
4344+ // window.
43464345 if (gui.which_scrollbars[SBAR_RIGHT] != gui.which_scrollbars[SBAR_LEFT])
43474346 {
4348- /* Scrollbars only on one side. Don't enable scrollbars that don't
4349- * contain the middle column of the current window. */
4347+ // Scrollbars only on one side. Don't enable scrollbars that don't
4348+ // contain the middle column of the current window.
43504349 if (!has_midcol)
43514350 enable = FALSE;
43524351 }
43534352 else
43544353 {
4355- /* Scrollbars on both sides. Don't enable scrollbars that neither
4356- * contain the middle column of the current window nor are on the far
4357- * side. */
4354+ // Scrollbars on both sides. Don't enable scrollbars that neither
4355+ // contain the middle column of the current window nor are on the far
4356+ // side.
43584357 if (midcol > Columns / 2)
43594358 {
43604359 if (which == SBAR_LEFT ? wp->w_wincol != 0 : !has_midcol)
@@ -4391,7 +4390,7 @@
43914390 if (wp == NULL)
43924391 break;
43934392 if (wp == NULL)
4394- /* Couldn't find window */
4393+ // Couldn't find window
43954394 return FALSE;
43964395
43974396 /*
@@ -4413,9 +4412,9 @@
44134412 scrolldown(-nlines, gui.dragged_wp == NULL);
44144413 else
44154414 scrollup(nlines, gui.dragged_wp == NULL);
4416- /* Reset dragged_wp after using it. "dragged_sb" will have been reset for
4417- * the mouse-up event already, but we still want it to behave like when
4418- * dragging. But not the next click in an arrow. */
4415+ // Reset dragged_wp after using it. "dragged_sb" will have been reset for
4416+ // the mouse-up event already, but we still want it to behave like when
4417+ // dragging. But not the next click in an arrow.
44194418 if (gui.dragged_sb == SBAR_NONE)
44204419 gui.dragged_wp = NULL;
44214420
@@ -4427,15 +4426,15 @@
44274426 {
44284427 if (get_scrolloff_value() != 0)
44294428 {
4430- cursor_correct(); /* fix window for 'so' */
4431- update_topline(); /* avoid up/down jump */
4429+ cursor_correct(); // fix window for 'so'
4430+ update_topline(); // avoid up/down jump
44324431 }
44334432 if (old_cursor.lnum != wp->w_cursor.lnum)
44344433 coladvance(wp->w_curswant);
44354434 wp->w_scbind_pos = wp->w_topline;
44364435 }
44374436
4438- /* Make sure wp->w_leftcol and wp->w_skipcol are correct. */
4437+ // Make sure wp->w_leftcol and wp->w_skipcol are correct.
44394438 validate_cursor();
44404439
44414440 curwin = save_wp;
@@ -4460,16 +4459,16 @@
44604459 wp->w_lines_valid = 0;
44614460 }
44624461
4463- /* Don't set must_redraw here, it may cause the popup menu to
4464- * disappear when losing focus after a scrollbar drag. */
4462+ // Don't set must_redraw here, it may cause the popup menu to
4463+ // disappear when losing focus after a scrollbar drag.
44654464 if (wp->w_redr_type < type)
44664465 wp->w_redr_type = type;
44674466 mch_disable_flush();
4468- updateWindow(wp); /* update window, status line, and cmdline */
4467+ updateWindow(wp); // update window, status line, and cmdline
44694468 mch_enable_flush();
44704469 }
44714470
4472- /* May need to redraw the popup menu. */
4471+ // May need to redraw the popup menu.
44734472 if (pum_visible())
44744473 pum_redraw();
44754474
@@ -4498,15 +4497,15 @@
44984497 {
44994498 w = chartabsize(p, col);
45004499 MB_PTR_ADV(p);
4501- if (*p == NUL) /* don't count the last character */
4500+ if (*p == NUL) // don't count the last character
45024501 break;
45034502 col += w;
45044503 }
45054504 return col;
45064505 }
45074506
4508-/* Remember which line is currently the longest, so that we don't have to
4509- * search for it when scrolling horizontally. */
4507+// Remember which line is currently the longest, so that we don't have to
4508+// search for it when scrolling horizontally.
45104509 static linenr_T longest_lnum = 0;
45114510
45124511 /*
@@ -4518,9 +4517,9 @@
45184517 {
45194518 linenr_T ret = 0;
45204519
4521- /* Calculate maximum for horizontal scrollbar. Check for reasonable
4522- * line numbers, topline and botline can be invalid when displaying is
4523- * postponed. */
4520+ // Calculate maximum for horizontal scrollbar. Check for reasonable
4521+ // line numbers, topline and botline can be invalid when displaying is
4522+ // postponed.
45244523 if (vim_strchr(p_go, GO_HORSCROLL) == NULL
45254524 && curwin->w_topline <= curwin->w_cursor.lnum
45264525 && curwin->w_botline > curwin->w_cursor.lnum
@@ -4530,9 +4529,9 @@
45304529 colnr_T n;
45314530 long max = 0;
45324531
4533- /* Use maximum of all visible lines. Remember the lnum of the
4534- * longest line, closest to the cursor line. Used when scrolling
4535- * below. */
4532+ // Use maximum of all visible lines. Remember the lnum of the
4533+ // longest line, closest to the cursor line. Used when scrolling
4534+ // below.
45364535 for (lnum = curwin->w_topline; lnum < curwin->w_botline; ++lnum)
45374536 {
45384537 n = scroll_line_len(lnum);
@@ -4548,7 +4547,7 @@
45484547 }
45494548 }
45504549 else
4551- /* Use cursor line only. */
4550+ // Use cursor line only.
45524551 ret = curwin->w_cursor.lnum;
45534552
45544553 return ret;
@@ -4557,7 +4556,7 @@
45574556 static void
45584557 gui_update_horiz_scrollbar(int force)
45594558 {
4560- long value, size, max; /* need 32 bit ints here */
4559+ long value, size, max; // need 32 bit ints here
45614560
45624561 if (!gui.which_scrollbars[SBAR_BOTTOM])
45634562 return;
@@ -4597,7 +4596,7 @@
45974596
45984597 if (virtual_active())
45994598 {
4600- /* May move the cursor even further to the right. */
4599+ // May move the cursor even further to the right.
46014600 if (curwin->w_virtcol >= (colnr_T)max)
46024601 max = curwin->w_virtcol;
46034602 }
@@ -4605,8 +4604,8 @@
46054604 #ifndef SCROLL_PAST_END
46064605 max += curwin->w_width - 1;
46074606 #endif
4608- /* The line number isn't scrolled, thus there is less space when
4609- * 'number' or 'relativenumber' is set (also for 'foldcolumn'). */
4607+ // The line number isn't scrolled, thus there is less space when
4608+ // 'number' or 'relativenumber' is set (also for 'foldcolumn').
46104609 size -= curwin_col_off();
46114610 #ifndef SCROLL_PAST_END
46124611 max -= curwin_col_off();
@@ -4615,7 +4614,7 @@
46154614
46164615 #ifndef SCROLL_PAST_END
46174616 if (value > max - size + 1)
4618- value = max - size + 1; /* limit the value to allowable range */
4617+ value = max - size + 1; // limit the value to allowable range
46194618 #endif
46204619
46214620 #ifdef FEAT_RIGHTLEFT
@@ -4647,7 +4646,7 @@
46474646 int
46484647 gui_do_horiz_scroll(long_u leftcol, int compute_longest_lnum)
46494648 {
4650- /* no wrapping, no scrolling */
4649+ // no wrapping, no scrolling
46514650 if (curwin->w_p_wrap)
46524651 return FALSE;
46534652
@@ -4656,8 +4655,8 @@
46564655
46574656 curwin->w_leftcol = (colnr_T)leftcol;
46584657
4659- /* When the line of the cursor is too short, move the cursor to the
4660- * longest visible line. */
4658+ // When the line of the cursor is too short, move the cursor to the
4659+ // longest visible line.
46614660 if (vim_strchr(p_go, GO_HORSCROLL) == NULL
46624661 && !virtual_active()
46634662 && (colnr_T)leftcol > scroll_line_len(curwin->w_cursor.lnum))
@@ -4667,7 +4666,7 @@
46674666 curwin->w_cursor.lnum = gui_find_longest_lnum();
46684667 curwin->w_cursor.col = 0;
46694668 }
4670- /* Do a sanity check on "longest_lnum", just in case. */
4669+ // Do a sanity check on "longest_lnum", just in case.
46714670 else if (longest_lnum >= curwin->w_topline
46724671 && longest_lnum < curwin->w_botline)
46734672 {
@@ -4756,8 +4755,8 @@
47564755 void
47574756 init_gui_options(void)
47584757 {
4759- /* Set the 'background' option according to the lightness of the
4760- * background color, unless the user has set it already. */
4758+ // Set the 'background' option according to the lightness of the
4759+ // background color, unless the user has set it already.
47614760 if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0)
47624761 {
47634762 set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0);
@@ -4771,7 +4770,7 @@
47714770 {
47724771 win_T *wp;
47734772
4774- /* Nothing to do if GUI hasn't started yet. */
4773+ // Nothing to do if GUI hasn't started yet.
47754774 if (!gui.in_use)
47764775 return;
47774776
@@ -4802,9 +4801,9 @@
48024801 xim_set_focus(in_focus);
48034802 # endif
48044803
4805- /* Put events in the input queue only when allowed.
4806- * ui_focus_change() isn't called directly, because it invokes
4807- * autocommands and that must not happen asynchronously. */
4804+ // Put events in the input queue only when allowed.
4805+ // ui_focus_change() isn't called directly, because it invokes
4806+ // autocommands and that must not happen asynchronously.
48084807 if (!hold_gui_events)
48094808 {
48104809 char_u bytes[3];
@@ -4828,29 +4827,29 @@
48284827 char_u st[8];
48294828
48304829 #ifdef FEAT_MOUSESHAPE
4831- /* Get window pointer, and update mouse shape as well. */
4830+ // Get window pointer, and update mouse shape as well.
48324831 wp = xy2win(x, y, IGNORE_POPUP);
48334832 #endif
48344833
4835- /* Only handle this when 'mousefocus' set and ... */
4834+ // Only handle this when 'mousefocus' set and ...
48364835 if (p_mousef
4837- && !hold_gui_events /* not holding events */
4838- && (State & (NORMAL|INSERT))/* Normal/Visual/Insert mode */
4839- && State != HITRETURN /* but not hit-return prompt */
4840- && msg_scrolled == 0 /* no scrolled message */
4841- && !need_mouse_correct /* not moving the pointer */
4842- && gui.in_focus) /* gvim in focus */
4836+ && !hold_gui_events // not holding events
4837+ && (State & (NORMAL|INSERT))// Normal/Visual/Insert mode
4838+ && State != HITRETURN // but not hit-return prompt
4839+ && msg_scrolled == 0 // no scrolled message
4840+ && !need_mouse_correct // not moving the pointer
4841+ && gui.in_focus) // gvim in focus
48434842 {
4844- /* Don't move the mouse when it's left or right of the Vim window */
4843+ // Don't move the mouse when it's left or right of the Vim window
48454844 if (x < 0 || x > Columns * gui.char_width)
48464845 return;
48474846 #ifndef FEAT_MOUSESHAPE
48484847 wp = xy2win(x, y, IGNORE_POPUP);
48494848 #endif
48504849 if (wp == curwin || wp == NULL)
4851- return; /* still in the same old window, or none at all */
4852-
4853- /* Ignore position in the tab pages line. */
4850+ return; // still in the same old window, or none at all
4851+
4852+ // Ignore position in the tab pages line.
48544853 if (Y_2_ROW(y) < tabline_height())
48554854 return;
48564855
@@ -4862,7 +4861,7 @@
48624861 */
48634862 if (finish_op)
48644863 {
4865- /* abort the current operator first */
4864+ // abort the current operator first
48664865 st[0] = ESC;
48674866 add_to_input_buf(st, 1);
48684867 }
@@ -4878,7 +4877,7 @@
48784877 st[3] = (char_u)MOUSE_RELEASE;
48794878 add_to_input_buf(st, 8);
48804879 #ifdef FEAT_GUI_GTK
4881- /* Need to wake up the main loop */
4880+ // Need to wake up the main loop
48824881 if (gtk_main_level() > 0)
48834882 gtk_main_quit();
48844883 #endif
@@ -4937,7 +4936,7 @@
49374936 need_mouse_correct = FALSE;
49384937
49394938 wp = gui_mouse_window(IGNORE_POPUP);
4940- if (wp != curwin && wp != NULL) /* If in other than current window */
4939+ if (wp != curwin && wp != NULL) // If in other than current window
49414940 {
49424941 validate_cline_row();
49434942 gui_mch_setmouse((int)W_ENDCOL(curwin) * gui.char_width - 3,
@@ -4959,7 +4958,7 @@
49594958
49604959 row = Y_2_ROW(y);
49614960 col = X_2_COL(x);
4962- if (row < 0 || col < 0) /* before first window */
4961+ if (row < 0 || col < 0) // before first window
49634962 return NULL;
49644963 wp = mouse_find_win(&row, &col, popup);
49654964 if (wp == NULL)
@@ -4972,7 +4971,7 @@
49724971 else
49734972 update_mouseshape(SHAPE_IDX_MORE);
49744973 }
4975- else if (row > wp->w_height) /* below status line */
4974+ else if (row > wp->w_height) // below status line
49764975 update_mouseshape(SHAPE_IDX_CLINE);
49774976 else if (!(State & CMDLINE) && wp->w_vsep_width > 0 && col == wp->w_width
49784977 && (row != wp->w_height || !stl_connected(wp)) && msg_scrolled == 0)
@@ -5013,8 +5012,8 @@
50135012 emsg(_(e_nogvim));
50145013 return;
50155014 #else
5016- /* Clear the command. Needed for when forking+exiting, to avoid part
5017- * of the argument ending up after the shell prompt. */
5015+ // Clear the command. Needed for when forking+exiting, to avoid part
5016+ // of the argument ending up after the shell prompt.
50185017 msg_clr_eos_force();
50195018 # ifdef GUI_MAY_SPAWN
50205019 if (!ends_excmd(*eap->arg))
@@ -5098,11 +5097,11 @@
50985097 fflush(stderr);
50995098 else if (error_ga.ga_data != NULL)
51005099 {
5101- /* avoid putting up a message box with blanks only */
5100+ // avoid putting up a message box with blanks only
51025101 for (p = (char_u *)error_ga.ga_data; *p != NUL; ++p)
51035102 if (!isspace(*p))
51045103 {
5105- /* Truncate a very long message, it will go off-screen. */
5104+ // Truncate a very long message, it will go off-screen.
51065105 if (STRLEN(p) > 2000)
51075106 STRCPY(p + 2000 - 14, "...(truncated)");
51085107 (void)do_dialog(VIM_ERROR, (char_u *)_("Error"),
@@ -5150,7 +5149,7 @@
51505149 update_topline();
51515150 validate_cursor();
51525151
5153- /* Trigger CursorMoved if the cursor moved. */
5152+ // Trigger CursorMoved if the cursor moved.
51545153 if (!finish_op && (has_cursormoved()
51555154 # ifdef FEAT_PROP_POPUP
51565155 || popup_visible
@@ -5190,7 +5189,7 @@
51905189 need_cursor_line_redraw = FALSE;
51915190 }
51925191 # endif
5193- update_screen(0); /* may need to update the screen */
5192+ update_screen(0); // may need to update the screen
51945193 setcursor();
51955194 out_flush_cursor(TRUE, FALSE);
51965195 }
@@ -5205,8 +5204,8 @@
52055204 char_u *
52065205 get_find_dialog_text(
52075206 char_u *arg,
5208- int *wwordp, /* return: TRUE if \< \> found */
5209- int *mcasep) /* return: TRUE if \C found */
5207+ int *wwordp, // return: TRUE if \< \> found
5208+ int *mcasep) // return: TRUE if \C found
52105209 {
52115210 char_u *text;
52125211
@@ -5222,14 +5221,14 @@
52225221 int len = (int)STRLEN(text);
52235222 int i;
52245223
5225- /* Remove "\V" */
5224+ // Remove "\V"
52265225 if (len >= 2 && STRNCMP(text, "\\V", 2) == 0)
52275226 {
52285227 mch_memmove(text, text + 2, (size_t)(len - 1));
52295228 len -= 2;
52305229 }
52315230
5232- /* Recognize "\c" and "\C" and remove. */
5231+ // Recognize "\c" and "\C" and remove.
52335232 if (len >= 2 && *text == '\\' && (text[1] == 'c' || text[1] == 'C'))
52345233 {
52355234 *mcasep = (text[1] == 'C');
@@ -5237,7 +5236,7 @@
52375236 len -= 2;
52385237 }
52395238
5240- /* Recognize "\<text\>" and remove. */
5239+ // Recognize "\<text\>" and remove.
52415240 if (len >= 4
52425241 && STRNCMP(text, "\\<", 2) == 0
52435242 && STRNCMP(text + len - 2, "\\>", 2) == 0)
@@ -5247,7 +5246,7 @@
52475246 text[len - 4] = NUL;
52485247 }
52495248
5250- /* Recognize "\/" or "\?" and remove. */
5249+ // Recognize "\/" or "\?" and remove.
52515250 for (i = 0; i + 1 < len; ++i)
52525251 if (text[i] == '\\' && (text[i + 1] == '/'
52535252 || text[i + 1] == '?'))
@@ -5266,10 +5265,10 @@
52665265 */
52675266 int
52685267 gui_do_findrepl(
5269- int flags, /* one of FRD_REPLACE, FRD_FINDNEXT, etc. */
5268+ int flags, // one of FRD_REPLACE, FRD_FINDNEXT, etc.
52705269 char_u *find_text,
52715270 char_u *repl_text,
5272- int down) /* Search downwards. */
5271+ int down) // Search downwards.
52735272 {
52745273 garray_T ga;
52755274 int i;
@@ -5279,13 +5278,13 @@
52795278 int save_did_emsg = did_emsg;
52805279 static int busy = FALSE;
52815280
5282- /* When the screen is being updated we should not change buffers and
5283- * windows structures, it may cause freed memory to be used. Also don't
5284- * do this recursively (pressing "Find" quickly several times. */
5281+ // When the screen is being updated we should not change buffers and
5282+ // windows structures, it may cause freed memory to be used. Also don't
5283+ // do this recursively (pressing "Find" quickly several times.
52855284 if (updating_screen || busy)
52865285 return FALSE;
52875286
5288- /* refuse replace when text cannot be changed */
5287+ // refuse replace when text cannot be changed
52895288 if ((type == FRD_REPLACE || type == FRD_REPLACEALL) && text_locked())
52905289 return FALSE;
52915290
@@ -5302,7 +5301,7 @@
53025301 ga_concat(&ga, (char_u *)"\\c");
53035302 if (flags & FRD_WHOLE_WORD)
53045303 ga_concat(&ga, (char_u *)"\\<");
5305- /* escape / and \ */
5304+ // escape slash and backslash
53065305 p = vim_strsave_escaped(find_text, (char_u *)"/\\");
53075306 if (p != NULL)
53085307 ga_concat(&ga, p);
@@ -5313,7 +5312,7 @@
53135312 if (type == FRD_REPLACEALL)
53145313 {
53155314 ga_concat(&ga, (char_u *)"/");
5316- /* escape / and \ */
5315+ // escape slash and backslash
53175316 p = vim_strsave_escaped(repl_text, (char_u *)"/\\");
53185317 if (p != NULL)
53195318 ga_concat(&ga, p);
@@ -5324,8 +5323,8 @@
53245323
53255324 if (type == FRD_REPLACE)
53265325 {
5327- /* Do the replacement when the text at the cursor matches. Thus no
5328- * replacement is done if the cursor was moved! */
5326+ // Do the replacement when the text at the cursor matches. Thus no
5327+ // replacement is done if the cursor was moved!
53295328 regmatch.regprog = vim_regcomp(ga.ga_data, RE_MAGIC + RE_STRING);
53305329 regmatch.rm_ic = 0;
53315330 if (regmatch.regprog != NULL)
@@ -5334,13 +5333,13 @@
53345333 if (vim_regexec_nl(&regmatch, p, (colnr_T)0)
53355334 && regmatch.startp[0] == p)
53365335 {
5337- /* Clear the command line to remove any old "No match"
5338- * error. */
5336+ // Clear the command line to remove any old "No match"
5337+ // error.
53395338 msg_end_prompt();
53405339
53415340 if (u_save_cursor() == OK)
53425341 {
5343- /* A button was pressed thus undo should be synced. */
5342+ // A button was pressed thus undo should be synced.
53445343 u_sync(FALSE);
53455344
53465345 del_bytes((long)(regmatch.endp[0] - regmatch.startp[0]),
@@ -5356,7 +5355,7 @@
53565355
53575356 if (type == FRD_REPLACEALL)
53585357 {
5359- /* A button was pressed, thus undo should be synced. */
5358+ // A button was pressed, thus undo should be synced.
53605359 u_sync(FALSE);
53615360 do_cmdline_cmd(ga.ga_data);
53625361 }
@@ -5364,8 +5363,8 @@
53645363 {
53655364 int searchflags = SEARCH_MSG + SEARCH_MARK;
53665365
5367- /* Search for the next match.
5368- * Don't skip text under cursor for single replace. */
5366+ // Search for the next match.
5367+ // Don't skip text under cursor for single replace.
53695368 if (type == FRD_REPLACE)
53705369 searchflags += SEARCH_START;
53715370 i = msg_scroll;
@@ -5375,26 +5374,26 @@
53755374 }
53765375 else
53775376 {
5378- /* We need to escape '?' if and only if we are searching in the up
5379- * direction */
5377+ // We need to escape '?' if and only if we are searching in the up
5378+ // direction
53805379 p = vim_strsave_escaped(ga.ga_data, (char_u *)"?");
53815380 if (p != NULL)
53825381 (void)do_search(NULL, '?', p, 1L, searchflags, NULL);
53835382 vim_free(p);
53845383 }
53855384
5386- msg_scroll = i; /* don't let an error message set msg_scroll */
5385+ msg_scroll = i; // don't let an error message set msg_scroll
53875386 }
53885387
5389- /* Don't want to pass did_emsg to other code, it may cause disabling
5390- * syntax HL if we were busy redrawing. */
5388+ // Don't want to pass did_emsg to other code, it may cause disabling
5389+ // syntax HL if we were busy redrawing.
53915390 did_emsg = save_did_emsg;
53925391
53935392 if (State & (NORMAL | INSERT))
53945393 {
5395- gui_update_screen(); /* update the screen */
5396- msg_didout = 0; /* overwrite any message */
5397- need_wait_return = FALSE; /* don't wait for return */
5394+ gui_update_screen(); // update the screen
5395+ msg_didout = 0; // overwrite any message
5396+ need_wait_return = FALSE; // don't wait for return
53985397 }
53995398
54005399 vim_free(ga.ga_data);
@@ -5432,9 +5431,9 @@
54325431 {
54335432 char_u *p = cookie;
54345433
5435- /* If Shift held down, change to first file's directory. If the first
5436- * item is a directory, change to that directory (and let the explorer
5437- * plugin show the contents). */
5434+ // If Shift held down, change to first file's directory. If the first
5435+ // item is a directory, change to that directory (and let the explorer
5436+ // plugin show the contents).
54385437 if (p != NULL)
54395438 {
54405439 if (mch_isdir(p))
@@ -5447,7 +5446,7 @@
54475446 vim_free(p);
54485447 }
54495448
5450- /* Update the screen display */
5449+ // Update the screen display
54515450 update_screen(NOT_VALID);
54525451 # ifdef FEAT_MENU
54535452 gui_update_menus(0);
@@ -5500,9 +5499,9 @@
55005499 if (i > 0)
55015500 add_to_input_buf((char_u*)" ", 1);
55025501
5503- /* We don't know what command is used thus we can't be sure
5504- * about which characters need to be escaped. Only escape the
5505- * most common ones. */
5502+ // We don't know what command is used thus we can't be sure
5503+ // about which characters need to be escaped. Only escape the
5504+ // most common ones.
55065505 # ifdef BACKSLASH_IN_FILENAME
55075506 p = vim_strsave_escaped(fnames[i], (char_u *)" \t\"|");
55085507 # else
@@ -5518,20 +5517,20 @@
55185517 }
55195518 else
55205519 {
5521- /* Go to the window under mouse cursor, then shorten given "fnames" by
5522- * current window, because a window can have local current dir. */
5520+ // Go to the window under mouse cursor, then shorten given "fnames" by
5521+ // current window, because a window can have local current dir.
55235522 gui_wingoto_xy(x, y);
55245523 shorten_filenames(fnames, count);
55255524
5526- /* If Shift held down, remember the first item. */
5525+ // If Shift held down, remember the first item.
55275526 if ((modifiers & MOUSE_SHIFT) != 0)
55285527 p = vim_strsave(fnames[0]);
55295528 else
55305529 p = NULL;
55315530
5532- /* Handle the drop, :edit or :split to get to the file. This also
5533- * frees fnames[]. Skip this if there is only one item, it's a
5534- * directory and Shift is held down. */
5531+ // Handle the drop, :edit or :split to get to the file. This also
5532+ // frees fnames[]. Skip this if there is only one item, it's a
5533+ // directory and Shift is held down.
55355534 if (count == 1 && (modifiers & MOUSE_SHIFT) != 0
55365535 && mch_isdir(fnames[0]))
55375536 {
diff -r 04ce3b8a50ed -r 79e10adc821d src/gui_at_fs.c
--- a/src/gui_at_fs.c Sun Dec 01 21:45:05 2019 +0100
+++ b/src/gui_at_fs.c Sun Dec 01 22:15:03 2019 +0100
@@ -43,11 +43,11 @@
4343
4444 #include "vim.h"
4545
46-/* Only include this when using the file browser */
46+// Only include this when using the file browser
4747
4848 #ifdef FEAT_BROWSE
4949
50-/* Weird complication: for "make lint" Text.h doesn't combine with Xm.h */
50+// Weird complication: for "make lint" Text.h doesn't combine with Xm.h
5151 #if defined(FEAT_GUI_MOTIF) && defined(FMT8BIT)
5252 # undef FMT8BIT
5353 #endif
@@ -56,7 +56,7 @@
5656 # include "gui_at_sb.h"
5757 #endif
5858
59-/***************** SFinternal.h */
59+////////////////// SFinternal.h
6060
6161 #include <X11/Intrinsic.h>
6262 #include <X11/StringDefs.h>
@@ -170,7 +170,7 @@
170170
171171 static int SFstatus = SEL_FILE_NULL;
172172
173-/***************** forward declare static functions */
173+///////////////// forward declare static functions
174174
175175 static void SFsetText(char *path);
176176 static void SFtextChanged(void);
@@ -184,7 +184,7 @@
184184 static Boolean SFworkProc(void);
185185 static int SFcompareEntries(const void *p, const void *q);
186186
187-/***************** xstat.h */
187+////////////////// xstat.h
188188
189189 #ifndef S_IXUSR
190190 # define S_IXUSR 0100
@@ -198,7 +198,7 @@
198198
199199 #define S_ISXXX(m) ((m) & (S_IXUSR | S_IXGRP | S_IXOTH))
200200
201-/***************** Path.c */
201+////////////////// Path.c
202202
203203 #include <pwd.h>
204204
@@ -515,7 +515,7 @@
515515 SFhomeDir.path = SFcurrentPath;
516516 SFhomeDir.entries = entries;
517517 SFhomeDir.nEntries = i;
518- SFhomeDir.vOrigin = 0; /* :-) */
518+ SFhomeDir.vOrigin = 0; // :-)
519519 SFhomeDir.nChars = maxChars + 2;
520520 SFhomeDir.hOrigin = 0;
521521 SFhomeDir.changed = 1;
@@ -969,7 +969,7 @@
969969 SFdirModTimer, (XtPointer) NULL);
970970 }
971971
972-/* Return a single character describing what kind of file STATBUF is. */
972+// Return a single character describing what kind of file STATBUF is.
973973
974974 static char
975975 SFstatChar(stat_T *statBuf)
@@ -981,11 +981,11 @@
981981 #ifdef S_ISSOCK
982982 if (S_ISSOCK (statBuf->st_mode))
983983 return '=';
984-#endif /* S_ISSOCK */
984+#endif // S_ISSOCK
985985 return ' ';
986986 }
987987
988-/***************** Draw.c */
988+////////////////// Draw.c
989989
990990 #ifdef FEAT_GUI_NEXTAW
991991 # include <X11/neXtaw/Cardinals.h>
@@ -1604,7 +1604,7 @@
16041604 {
16051605 int nw;
16061606
1607- /* sanity */
1607+ // sanity
16081608 if (SFcurrentInvert[n] != -1)
16091609 {
16101610 SFinvertEntry(n);
@@ -1980,7 +1980,7 @@
19801980 return True;
19811981 }
19821982
1983-/***************** Dir.c */
1983+////////////////// Dir.c
19841984
19851985 static int
19861986 SFcompareEntries(const void *p, const void *q)
@@ -2020,7 +2020,7 @@
20202020
20212021 while ((dp = readdir(dirp)))
20222022 {
2023- /* Ignore "." and ".." */
2023+ // Ignore "." and ".."
20242024 if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0)
20252025 continue;
20262026 if (i >= Alloc)
@@ -2051,7 +2051,7 @@
20512051 return 0;
20522052 }
20532053
2054-/***************** SFinternal.h */
2054+////////////////// SFinternal.h
20552055
20562056 #include <sys/param.h>
20572057 #include <X11/cursorfont.h>
@@ -2202,7 +2202,7 @@
22022202 XSetForeground(gui.dpy, SFtextGC, fg);
22032203 XSetForeground(gui.dpy, SFlineGC, fg);
22042204
2205- /* This is an xor GC, so combine the fg and background */
2205+ // This is an xor GC, so combine the fg and background
22062206 XSetBackground(gui.dpy, SFinvertGC, fg ^ bg);
22072207 XSetForeground(gui.dpy, SFinvertGC, fg ^ bg);
22082208 }
@@ -2250,7 +2250,7 @@
22502250 XtNtitle, prompt,
22512251 NULL);
22522252
2253- /* Add WM_DELETE_WINDOW protocol */
2253+ // Add WM_DELETE_WINDOW protocol
22542254 XtAppAddActions(XtWidgetToApplicationContext(selFile),
22552255 actions, XtNumber(actions));
22562256 XtOverrideTranslations(selFile,
@@ -2522,7 +2522,7 @@
25222522 XtSetMappedWhenManaged(selFile, False);
25232523 XtRealizeWidget(selFile);
25242524
2525- /* Add WM_DELETE_WINDOW protocol */
2525+ // Add WM_DELETE_WINDOW protocol
25262526 SFwmDeleteWindow = XInternAtom(SFdisplay, "WM_DELETE_WINDOW", False);
25272527 XSetWMProtocols(SFdisplay, XtWindow(selFile), &SFwmDeleteWindow, 1);
25282528
@@ -2609,7 +2609,7 @@
26092609 XtNstring, &wcbuf,
26102610 NULL);
26112611 mbslength = wcstombs(NULL, wcbuf, 0);
2612- /* Hack: some broken wcstombs() returns zero, just get a large buffer */
2612+ // Hack: some broken wcstombs() returns zero, just get a large buffer
26132613 if (mbslength == 0 && wcbuf != NULL && wcbuf[0] != 0)
26142614 mbslength = MAXPATHL;
26152615 buf=(char *)XtMalloc(mbslength + 1);
@@ -2645,7 +2645,7 @@
26452645 guicolor_T fg,
26462646 guicolor_T bg,
26472647 guicolor_T scroll_fg,
2648- guicolor_T scroll_bg) /* The "Scrollbar" group colors */
2648+ guicolor_T scroll_bg) // The "Scrollbar" group colors
26492649 {
26502650 static int firstTime = 1;
26512651 XEvent event;
@@ -2731,4 +2731,4 @@
27312731 }
27322732 }
27332733 }
2734-#endif /* FEAT_BROWSE */
2734+#endif // FEAT_BROWSE
diff -r 04ce3b8a50ed -r 79e10adc821d src/gui_at_sb.c
--- a/src/gui_at_sb.c Sun Dec 01 21:45:05 2019 +0100
+++ b/src/gui_at_sb.c Sun Dec 01 22:15:03 2019 +0100
@@ -56,9 +56,9 @@
5656
5757 */
5858
59-/* ScrollBar.c */
60-/* created by weissman, Mon Jul 7 13:20:03 1986 */
61-/* converted by swick, Thu Aug 27 1987 */
59+// ScrollBar.c
60+// created by weissman, Mon Jul 7 13:20:03 1986
61+// converted by swick, Thu Aug 27 1987
6262
6363 #include "vim.h"
6464
@@ -70,7 +70,7 @@
7070
7171 #include <X11/Xmu/Drawing.h>
7272
73-/* Private definitions. */
73+// Private definitions.
7474
7575 static char defaultTranslations[] =
7676 "<Btn1Down>: NotifyScroll()\n\
@@ -164,7 +164,7 @@
164164
165165 ScrollbarClassRec vim_scrollbarClassRec =
166166 {
167- { /* core fields */
167+ { // core fields
168168 /* superclass */ (WidgetClass) &simpleClassRec,
169169 /* class_name */ "Scrollbar",
170170 /* size */ sizeof(ScrollbarRec),
@@ -198,13 +198,13 @@
198198 /* display_accelerator*/ XtInheritDisplayAccelerator,
199199 /* extension */ NULL
200200 },
201- { /* simple fields */
201+ { // simple fields
202202 /* change_sensitive */ XtInheritChangeSensitive,
203203 #ifndef OLDXAW
204204 /* extension */ NULL
205205 #endif
206206 },
207- { /* scrollbar fields */
207+ { // scrollbar fields
208208 /* empty */ 0
209209 }
210210 };
@@ -240,7 +240,7 @@
240240 int fill,
241241 int draw_shadow)
242242 {
243- int tlen = bottom - top; /* length of thumb in pixels */
243+ int tlen = bottom - top; // length of thumb in pixels
244244 int sw, margin, floor;
245245 int lx, ly, lw, lh;
246246
@@ -273,24 +273,24 @@
273273 {
274274 if (!(sbw->scrollbar.orientation == XtorientHorizontal))
275275 {
276- /* Top border */
276+ // Top border
277277 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
278278 sbw->scrollbar.top_shadow_GC,
279279 lx, ly, lx + lw - 1, ly);
280280
281- /* Bottom border */
281+ // Bottom border
282282 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
283283 sbw->scrollbar.bot_shadow_GC,
284284 lx, ly + lh - 1, lx + lw - 1, ly + lh - 1);
285285 }
286286 else
287287 {
288- /* Left border */
288+ // Left border
289289 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
290290 sbw->scrollbar.top_shadow_GC,
291291 lx, ly, lx, ly + lh - 1);
292292
293- /* Right border */
293+ // Right border
294294 XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
295295 sbw->scrollbar.bot_shadow_GC,
296296 lx + lw - 1, ly, lx + lw - 1, ly + lh - 1);
@@ -306,24 +306,24 @@
306306
307307 if (!(sbw->scrollbar.orientation == XtorientHorizontal))
308308 {
309- /* Left border */
309+ // Left border
310310 XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
311311 sbw->scrollbar.top_shadow_GC,
312312 lx, ly, lx, ly + lh - 1);
313313
314- /* Right border */
314+ // Right border
315315 XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
316316 sbw->scrollbar.bot_shadow_GC,
317317 lx + lw - 1, ly, lx + lw - 1, ly + lh - 1);
318318 }
319319 else
320320 {
321- /* Top border */
321+ // Top border
322322 XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
323323 sbw->scrollbar.top_shadow_GC,
324324 lx, ly, lx + lw - 1, ly);
325325
326- /* Bottom border */
326+ // Bottom border
327327 XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
328328 sbw->scrollbar.bot_shadow_GC,
329329 lx, ly + lh - 1, lx + lw - 1, ly + lh - 1);
@@ -336,11 +336,11 @@
336336 }
337337 }
338338
339-/* Paint the thumb in the area specified by sbw->top and
340- sbw->shown. The old area is erased. The painting and
341- erasing is done cleverly so that no flickering will occur.
339+/*
340+ * Paint the thumb in the area specified by sbw->top and
341+ * sbw->shown. The old area is erased. The painting and
342+ * erasing is done cleverly so that no flickering will occur.
342343 */
343-
344344 static void
345345 PaintThumb(ScrollbarWidget sbw)
346346 {
@@ -369,7 +369,7 @@
369369 if (newbot > oldbot)
370370 FillArea(sbw, AT_MAX(newtop, oldbot-1), newbot, 1,0);
371371
372- /* Only draw the missing shadows */
372+ // Only draw the missing shadows
373373 FillArea(sbw, newtop, newbot, 0, 1);
374374 }
375375 }
@@ -408,7 +408,7 @@
408408 point[5].x = thickness / 2;
409409 point[5].y = sbw->scrollbar.length - sbw->scrollbar.shadow_width - 1;
410410
411- /* horizontal arrows require that x and y coordinates be swapped */
411+ // horizontal arrows require that x and y coordinates be swapped
412412 if (sbw->scrollbar.orientation == XtorientHorizontal)
413413 {
414414 int n;
@@ -420,7 +420,7 @@
420420 point[n].y = swap;
421421 }
422422 }
423- /* draw the up/left arrow */
423+ // draw the up/left arrow
424424 XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
425425 sbw->scrollbar.gc,
426426 point, 3,
@@ -433,7 +433,7 @@
433433 sbw->scrollbar.top_shadow_GC,
434434 point[0].x, point[0].y,
435435 point[2].x, point[2].y);
436- /* draw the down/right arrow */
436+ // draw the down/right arrow
437437 XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw),
438438 sbw->scrollbar.gc,
439439 point+3, 3,
@@ -497,8 +497,8 @@
497497 gcValues.fill_style = FillSolid;
498498 mask |= GCFillStyle;
499499 }
500- /* the creation should be non-caching, because */
501- /* we now set and clear clip masks on the gc returned */
500+ // the creation should be non-caching, because
501+ // we now set and clear clip masks on the gc returned
502502 sbw->scrollbar.gc = XtGetGC (w, mask, &gcValues);
503503 }
504504
@@ -519,8 +519,8 @@
519519
520520 static void
521521 Initialize(
522- Widget request UNUSED, /* what the client asked for */
523- Widget new, /* what we're going to give him */
522+ Widget request UNUSED, // what the client asked for
523+ Widget new, // what we're going to give him
524524 ArgList args UNUSED,
525525 Cardinal *num_args UNUSED)
526526 {
@@ -551,16 +551,16 @@
551551 Mask *valueMask,
552552 XSetWindowAttributes *attributes)
553553 {
554- /* The Simple widget actually stuffs the value in the valuemask. */
554+ // The Simple widget actually stuffs the value in the valuemask.
555555 (*vim_scrollbarWidgetClass->core_class.superclass->core_class.realize)
556556 (w, valueMask, attributes);
557557 }
558558
559559 static Boolean
560560 SetValues(
561- Widget current, /* what I am */
562- Widget request UNUSED, /* what he wants me to be */
563- Widget desired, /* what I will become */
561+ Widget current, // what I am
562+ Widget request UNUSED, // what he wants me to be
563+ Widget desired, // what I will become
564564 ArgList args UNUSED,
565565 Cardinal *num_args UNUSED)
566566 {
@@ -600,8 +600,8 @@
600600 static void
601601 Resize(Widget w)
602602 {
603- /* ForgetGravity has taken care of background, but thumb may
604- * have to move as a result of the new size. */
603+ // ForgetGravity has taken care of background, but thumb may
604+ // have to move as a result of the new size.
605605 SetDimensions ((ScrollbarWidget) w);
606606 Redisplay(w, (XEvent*) NULL, (Region)NULL);
607607 }
@@ -633,11 +633,11 @@
633633 if (region == NULL ||
634634 XRectInRegion (region, x, y, width, height) != RectangleOut)
635635 {
636- /* Forces entire thumb to be painted. */
636+ // Forces entire thumb to be painted.
637637 sbw->scrollbar.topLoc = -(sbw->scrollbar.length + 1);
638638 PaintThumb (sbw);
639639 }
640- /* we'd like to be region aware here!!!! */
640+ // we'd like to be region aware here!!!!
641641 PaintArrows(sbw);
642642 }
643643
@@ -693,7 +693,7 @@
693693 {
694694 struct EventData *eventData = (struct EventData*)args;
695695
696- return ((++eventData->count == QLength(dpy)) /* since PeekIf blocks */
696+ return ((++eventData->count == QLength(dpy)) // since PeekIf blocks
697697 || CompareEvents(event, eventData->oldEvent));
698698 }
699699
@@ -719,9 +719,9 @@
719719 static void
720720 ExtractPosition(
721721 XEvent *event,
722- Position *x, /* RETURN */
723- Position *y, /* RETURN */
724- unsigned int *state) /* RETURN */
722+ Position *x, // RETURN
723+ Position *y, // RETURN
724+ unsigned int *state) // RETURN
725725 {
726726 switch (event->type)
727727 {
@@ -771,8 +771,8 @@
771771
772772 ExtractPosition(event, &x, &y, (unsigned int *)NULL);
773773 loc = PICKLENGTH(sbw, x, y);
774- /* if the motion event puts the pointer in thumb, call Move and Notify */
775- /* also call Move and Notify if we're already in continuous scroll mode */
774+ // if the motion event puts the pointer in thumb, call Move and Notify
775+ // also call Move and Notify if we're already in continuous scroll mode
776776 if (sbw->scrollbar.scroll_mode == SMODE_CONT ||
777777 (loc >= sbw->scrollbar.topLoc &&
778778 loc <= sbw->scrollbar.topLoc + (int)sbw->scrollbar.shownLength))
@@ -876,7 +876,7 @@
876876 {
877877 ScrollbarWidget sbw = (ScrollbarWidget) w;
878878
879- if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if scroll continuous */
879+ if (sbw->scrollbar.scroll_mode == SMODE_CONT) // if scroll continuous
880880 return;
881881
882882 if (LookAhead(w, event))
@@ -900,7 +900,7 @@
900900 int call_data = 0;
901901 unsigned int state;
902902
903- if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if scroll continuous */
903+ if (sbw->scrollbar.scroll_mode == SMODE_CONT) // if scroll continuous
904904 return;
905905
906906 if (LookAhead (w, event))
@@ -968,7 +968,7 @@
968968 if (call_data)
969969 XtCallCallbacks(w, XtNscrollProc, (XtPointer)(long_u)call_data);
970970
971- /* establish autoscroll */
971+ // establish autoscroll
972972 if (delay)
973973 sbw->scrollbar.timer_id =
974974 XtAppAddTimeOut(XtWidgetToApplicationContext(w),
@@ -985,9 +985,9 @@
985985 ScrollbarWidget sbw = (ScrollbarWidget) w;
986986
987987 sbw->scrollbar.scroll_mode = SMODE_NONE;
988- /* no need to remove any autoscroll timeout; it will no-op */
989- /* because the scroll_mode is SMODE_NONE */
990- /* but be sure to remove timeout in destroy proc */
988+ // no need to remove any autoscroll timeout; it will no-op
989+ // because the scroll_mode is SMODE_NONE
990+ // but be sure to remove timeout in destroy proc
991991 }
992992
993993 static float
@@ -1016,7 +1016,7 @@
10161016 float top;
10171017 char old_mode = sbw->scrollbar.scroll_mode;
10181018
1019- sbw->scrollbar.scroll_mode = SMODE_CONT; /* indicate continuous scroll */
1019+ sbw->scrollbar.scroll_mode = SMODE_CONT; // indicate continuous scroll
10201020
10211021 if (LookAhead(w, event))
10221022 return;
@@ -1028,7 +1028,7 @@
10281028
10291029 top = FractionLoc(sbw, x, y);
10301030
1031- if (old_mode != SMODE_CONT) /* start dragging: set offset */
1031+ if (old_mode != SMODE_CONT) // start dragging: set offset
10321032 {
10331033 if (event->xbutton.button == Button2)
10341034 sbw->scrollbar.scroll_off = sbw->scrollbar.shown / 2.;
@@ -1045,7 +1045,7 @@
10451045
10461046 sbw->scrollbar.top = top;
10471047 PaintThumb(sbw);
1048- XFlush(XtDisplay(w)); /* re-draw it before Notifying */
1048+ XFlush(XtDisplay(w)); // re-draw it before Notifying
10491049 }
10501050
10511051
@@ -1057,8 +1057,8 @@
10571057 Cardinal *num_params UNUSED)
10581058 {
10591059 ScrollbarWidget sbw = (ScrollbarWidget)w;
1060- /* Use a union to avoid a warning for the weird conversion from float to
1061- * XtPointer. Comes from Xaw/Scrollbar.c. */
1060+ // Use a union to avoid a warning for the weird conversion from float to
1061+ // XtPointer. Comes from Xaw/Scrollbar.c.
10621062 union {
10631063 XtPointer xtp;
10641064 float xtf;
@@ -1067,9 +1067,9 @@
10671067 if (LookAhead(w, event))
10681068 return;
10691069
1070- /* thumbProc is not pretty, but is necessary for backwards
1071- compatibility on those architectures for which it work{s,ed};
1072- the intent is to pass a (truncated) float by value. */
1070+ // thumbProc is not pretty, but is necessary for backwards
1071+ // compatibility on those architectures for which it work{s,ed};
1072+ // the intent is to pass a (truncated) float by value.
10731073 xtpf.xtf = sbw->scrollbar.top;
10741074 XtCallCallbacks(w, XtNthumbProc, xtpf.xtp);
10751075 XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top);
@@ -1137,7 +1137,7 @@
11371137 bot = sbw->scrollbar.top_shadow_GC;
11381138 }
11391139
1140- /* top-left shadow */
1140+ // top-left shadow
11411141 if ((region == NULL) ||
11421142 (XRectInRegion (region, 0, 0, w, s) != RectangleOut) ||
11431143 (XRectInRegion (region, 0, 0, s, h) != RectangleOut))
@@ -1151,7 +1151,7 @@
11511151 XFillPolygon (dpy, win, top, pt, 6, Complex, CoordModeOrigin);
11521152 }
11531153
1154- /* bottom-right shadow */
1154+ // bottom-right shadow
11551155 if ((region == NULL) ||
11561156 (XRectInRegion (region, 0, hms, w, s) != RectangleOut) ||
11571157 (XRectInRegion (region, wms, 0, s, h) != RectangleOut))
@@ -1176,7 +1176,7 @@
11761176 {
11771177 ScrollbarWidget sbw = (ScrollbarWidget) w;
11781178
1179- if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if still thumbing */
1179+ if (sbw->scrollbar.scroll_mode == SMODE_CONT) // if still thumbing
11801180 return;
11811181
11821182 sbw->scrollbar.max = (max > 1.0) ? 1.0 :
diff -r 04ce3b8a50ed -r 79e10adc821d src/gui_athena.c
--- a/src/gui_athena.c Sun Dec 01 21:45:05 2019 +0100
+++ b/src/gui_athena.c Sun Dec 01 22:15:03 2019 +0100
@@ -34,7 +34,7 @@
3434 # include <X11/Xaw/Dialog.h>
3535 # include <X11/Xaw/Text.h>
3636 # include <X11/Xaw/AsciiText.h>
37-#endif /* FEAT_GUI_NEXTAW */
37+#endif // FEAT_GUI_NEXTAW
3838
3939 #ifndef FEAT_GUI_NEXTAW
4040 # include "gui_at_sb.h"
@@ -46,9 +46,9 @@
4646 Widget textArea = (Widget)0;
4747 #ifdef FEAT_MENU
4848 static Widget menuBar = (Widget)0;
49-static XtIntervalId timer = 0; /* 0 = expired, otherwise active */
49+static XtIntervalId timer = 0; // 0 = expired, otherwise active
5050
51-/* Used to figure out menu ordering */
51+// Used to figure out menu ordering
5252 static vimmenu_T *a_cur_menu = NULL;
5353 static Cardinal athena_calculate_ins_pos(Widget);
5454
@@ -96,7 +96,7 @@
9696
9797 if (sb == NULL)
9898 return;
99- else if (sb->wp != NULL) /* Left or right scrollbar */
99+ else if (sb->wp != NULL) // Left or right scrollbar
100100 {
101101 /*
102102 * Careful: need to get scrollbar info out of first (left) scrollbar
@@ -105,7 +105,7 @@
105105 */
106106 sb_info = &sb->wp->w_scrollbars[0];
107107 }
108- else /* Bottom scrollbar */
108+ else // Bottom scrollbar
109109 sb_info = sb;
110110
111111 value = (long)(*((float *)call_data) * (float)(sb_info->max + 1) + 0.001);
@@ -134,7 +134,7 @@
134134
135135 if (sb == NULL)
136136 return;
137- if (sb->wp != NULL) /* Left or right scrollbar */
137+ if (sb->wp != NULL) // Left or right scrollbar
138138 {
139139 /*
140140 * Careful: need to get scrollbar info out of first (left) scrollbar
@@ -144,7 +144,7 @@
144144 sb_info = &sb->wp->w_scrollbars[0];
145145
146146 if (sb_info->size > 5)
147- page = sb_info->size - 2; /* use two lines of context */
147+ page = sb_info->size - 2; // use two lines of context
148148 else
149149 page = sb_info->size;
150150 #ifdef FEAT_GUI_NEXTAW
@@ -177,7 +177,7 @@
177177 }
178178 #endif
179179 }
180- else /* Bottom scrollbar */
180+ else // Bottom scrollbar
181181 {
182182 sb_info = sb;
183183 #ifdef FEAT_GUI_NEXTAW
@@ -194,14 +194,14 @@
194194 data = 1;
195195 }
196196 #endif
197- if (data < -1) /* page-width left */
197+ if (data < -1) // page-width left
198198 {
199199 if (sb->size > 8)
200200 data = -(sb->size - 5);
201201 else
202202 data = -sb->size;
203203 }
204- else if (data > 1) /* page-width right */
204+ else if (data > 1) // page-width right
205205 {
206206 if (sb->size > 8)
207207 data = (sb->size - 5);
@@ -216,8 +216,8 @@
216216 else if (value < 0)
217217 value = 0;
218218
219- /* Update the bottom scrollbar an extra time (why is this needed?? */
220- if (sb->wp == NULL) /* Bottom scrollbar */
219+ // Update the bottom scrollbar an extra time (why is this needed??
220+ if (sb->wp == NULL) // Bottom scrollbar
221221 gui_mch_set_scrollbar_thumb(sb, value, sb->size, sb->max);
222222
223223 gui_drag_scrollbar(sb, value, FALSE);
@@ -235,7 +235,7 @@
235235 */
236236 gui.border_offset = gui.border_width;
237237
238- /* The form containing all the other widgets */
238+ // The form containing all the other widgets
239239 vimForm = XtVaCreateManagedWidget("vimForm",
240240 formWidgetClass, vimShell,
241241 XtNborderWidth, 0,
@@ -243,7 +243,7 @@
243243 gui_athena_scroll_colors(vimForm);
244244
245245 #ifdef FEAT_MENU
246- /* The top menu bar */
246+ // The top menu bar
247247 menuBar = XtVaCreateManagedWidget("menuBar",
248248 boxWidgetClass, vimForm,
249249 XtNresizable, True,
@@ -259,8 +259,8 @@
259259 #endif
260260
261261 #ifdef FEAT_TOOLBAR
262- /* Don't create it Managed, it will be managed when creating the first
263- * item. Otherwise an empty toolbar shows up. */
262+ // Don't create it Managed, it will be managed when creating the first
263+ // item. Otherwise an empty toolbar shows up.
264264 toolBar = XtVaCreateWidget("toolBar",
265265 boxWidgetClass, vimForm,
266266 XtNresizable, True,
@@ -276,7 +276,7 @@
276276 gui_athena_menu_colors(toolBar);
277277 #endif
278278
279- /* The text area. */
279+ // The text area.
280280 textArea = XtVaCreateManagedWidget("textArea",
281281 coreWidgetClass, vimForm,
282282 XtNresizable, True,
@@ -315,7 +315,7 @@
315315 XtNumber(pullAction));
316316 #endif
317317
318- /* Pretend we don't have input focus, we will get an event if we do. */
318+ // Pretend we don't have input focus, we will get an event if we do.
319319 gui.in_focus = FALSE;
320320 }
321321
@@ -352,10 +352,9 @@
352352 to.addr = (XtPointer)&font;
353353 to.size = sizeof(XFontStruct *);
354354 #endif
355- /* Assumption: The menuBar children will use the same font as the
356- * pulldown menu items AND they will all be of type
357- * XtNfont.
358- */
355+ // Assumption: The menuBar children will use the same font as the
356+ // pulldown menu items AND they will all be of type
357+ // XtNfont.
359358 XtVaGetValues(menuBar, XtNchildren, &children,
360359 XtNnumChildren, &num_children,
361360 NULL);
@@ -369,7 +368,7 @@
369368 #endif
370369 ) == False)
371370 return None;
372- /* "font" should now contain data */
371+ // "font" should now contain data
373372 }
374373 else
375374 #ifdef FONTSET_ALWAYS
@@ -449,18 +448,18 @@
449448 static void
450449 get_toolbar_pixmap(vimmenu_T *menu, Pixmap *sen)
451450 {
452- char_u buf[MAXPATHL]; /* buffer storing expanded pathname */
453- char **xpm = NULL; /* xpm array */
451+ char_u buf[MAXPATHL]; // buffer storing expanded pathname
452+ char **xpm = NULL; // xpm array
454453
455- buf[0] = NUL; /* start with NULL path */
454+ buf[0] = NUL; // start with NULL path
456455
457456 if (menu->iconfile != NULL)
458457 {
459- /* Use the "icon=" argument. */
458+ // Use the "icon=" argument.
460459 gui_find_iconfile(menu->iconfile, buf, "xpm");
461460 createXpmImages(buf, NULL, sen);
462461
463- /* If it failed, try using the menu name. */
462+ // If it failed, try using the menu name.
464463 if (*sen == (Pixmap)0 && gui_find_bitmap(menu->name, buf, "xpm") == OK)
465464 createXpmImages(buf, NULL, sen);
466465 if (*sen != (Pixmap)0)
@@ -511,7 +510,7 @@
511510 &color[TOP_SHADOW].pixel,
512511 &color[HIGHLIGHT].pixel);
513512
514- /* Setup the color substitution table */
513+ // Setup the color substitution table
515514 attrs.valuemask = XpmColorSymbols;
516515 attrs.colorsymbols = color;
517516 attrs.numsymbols = 5;
@@ -519,7 +518,7 @@
519518 screenNum = DefaultScreen(gui.dpy);
520519 rootWindow = RootWindow(gui.dpy, screenNum);
521520
522- /* Create the "sensitive" pixmap */
521+ // Create the "sensitive" pixmap
523522 if (xpm != NULL)
524523 status = XpmCreatePixmapFromData(gui.dpy, rootWindow, xpm,
525524 &map, &mask, &attrs);
@@ -532,13 +531,13 @@
532531 GC back_gc;
533532 GC mask_gc;
534533
535- /* Need to create new Pixmaps with the mask applied. */
534+ // Need to create new Pixmaps with the mask applied.
536535 gcvalues.foreground = color[BACKGROUND].pixel;
537536 back_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues);
538537 mask_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues);
539538 XSetClipMask(gui.dpy, mask_gc, mask);
540539
541- /* Create the "sensitive" pixmap. */
540+ // Create the "sensitive" pixmap.
542541 *sen = XCreatePixmap(gui.dpy, rootWindow,
543542 attrs.width, attrs.height,
544543 DefaultDepth(gui.dpy, screenNum));
@@ -567,7 +566,7 @@
567566 Dimension border;
568567 int height;
569568
570- if (!XtIsManaged(toolBar)) /* nothing to do */
569+ if (!XtIsManaged(toolBar)) // nothing to do
571570 return;
572571 XtUnmanageChild(toolBar);
573572 XtVaGetValues(toolBar,
@@ -602,7 +601,7 @@
602601 NULL);
603602 XtManageChild(textArea);
604603 #ifdef FEAT_TOOLBAR
605- /* Give keyboard focus to the textArea instead of the toolbar. */
604+ // Give keyboard focus to the textArea instead of the toolbar.
606605 gui_mch_reset_focus();
607606 #endif
608607 }
@@ -686,7 +685,7 @@
686685
687686 XtUnmanageChild(menuBar);
688687 XtVaGetValues(menuBar, XtNborderWidth, &border, NULL);
689- /* avoid trouble when there are no menu items, and h is 1 */
688+ // avoid trouble when there are no menu items, and h is 1
690689 height = h - 2 * border;
691690 if (height < 0)
692691 height = 1;
@@ -709,19 +708,17 @@
709708 static Cardinal
710709 athena_calculate_ins_pos(Widget widget)
711710 {
712- /* Assume that if the parent of the vimmenu_T is NULL, then we can get
713- * to this menu by traversing "next", starting at "root_menu".
714- *
715- * This holds true for popup menus, toolbar, and toplevel menu items.
716- */
711+ // Assume that if the parent of the vimmenu_T is NULL, then we can get
712+ // to this menu by traversing "next", starting at "root_menu".
713+ //
714+ // This holds true for popup menus, toolbar, and toplevel menu items.
717715
718- /* Popup menus: "id" is NULL. Only submenu_id is valid */
716+ // Popup menus: "id" is NULL. Only submenu_id is valid
719717
720- /* Menus that are not toplevel: "parent" will be non-NULL, "id" &
721- * "submenu_id" will be non-NULL.
722- */
718+ // Menus that are not toplevel: "parent" will be non-NULL, "id" &
719+ // "submenu_id" will be non-NULL.
723720
724- /* Toplevel menus: "parent" is NULL, id is the widget of the menu item */
721+ // Toplevel menus: "parent" is NULL, id is the widget of the menu item
725722
726723 WidgetList children;
727724 Cardinal num_children = 0;
@@ -793,7 +790,7 @@
793790 gui_athena_menu_colors(menu->submenu_id);
794791 gui_athena_menu_font(menu->submenu_id);
795792
796- /* Don't update the menu height when it was set at a fixed value */
793+ // Don't update the menu height when it was set at a fixed value
797794 if (!gui.menu_height_fixed)
798795 {
799796 /*
@@ -827,9 +824,8 @@
827824
828825 XtVaSetValues(menu->id, XtNrightBitmap, pullerBitmap,
829826 NULL);
830- /* If there are other menu items that are not pulldown menus,
831- * we need to adjust the right margins of those, too.
832- */
827+ // If there are other menu items that are not pulldown menus,
828+ // we need to adjust the right margins of those, too.
833829 {
834830 WidgetList children;
835831 Cardinal num_children;
@@ -865,11 +861,10 @@
865861 a_cur_menu = NULL;
866862 }
867863
868-/* Used to determine whether a SimpleMenu has pulldown entries.
869- *
870- * "id" is the parent of the menu items.
871- * Ignore widget "ignore" in the pane.
872- */
864+// Used to determine whether a SimpleMenu has pulldown entries.
865+//
866+// "id" is the parent of the menu items.
867+// Ignore widget "ignore" in the pane.
873868 static Boolean
874869 gui_athena_menu_has_submenus(Widget id, Widget ignore)
875870 {
@@ -900,8 +895,8 @@
900895 {
901896 XtUnmanageChild(id);
902897 XtVaSetValues(id, XtNfontSet, gui.menu_fontset, NULL);
903- /* We should force the widget to recalculate its
904- * geometry now. */
898+ // We should force the widget to recalculate its
899+ // geometry now.
905900 XtManageChild(id);
906901 }
907902 else
@@ -929,7 +924,7 @@
929924 if (has_submenu(id))
930925 XtVaSetValues(id, XtNrightBitmap, pullerBitmap, NULL);
931926
932- /* Force the widget to recalculate its geometry now. */
927+ // Force the widget to recalculate its geometry now.
933928 if (managed)
934929 XtManageChild(id);
935930 }
@@ -953,10 +948,9 @@
953948 gui_mch_submenu_change(root_menu, FALSE);
954949
955950 {
956- /* Iterate through the menubar menu items and get the height of
957- * each one. The menu bar height is set to the maximum of all
958- * the heights.
959- */
951+ // Iterate through the menubar menu items and get the height of
952+ // each one. The menu bar height is set to the maximum of all
953+ // the heights.
960954 vimmenu_T *mp;
961955 int max_height = 9999;
962956
@@ -975,7 +969,7 @@
975969 }
976970 if (max_height != 9999)
977971 {
978- /* Don't update the menu height when it was set at a fixed value */
972+ // Don't update the menu height when it was set at a fixed value
979973 if (!gui.menu_height_fixed)
980974 {
981975 Dimension space, border;
@@ -988,12 +982,11 @@
988982 }
989983 }
990984 }
991- /* Now, to simulate the window being resized. Only, this
992- * will resize the window to its current state.
993- *
994- * There has to be a better way, but I do not see one at this time.
995- * (David Harrison)
996- */
985+ // Now, to simulate the window being resized. Only, this
986+ // will resize the window to its current state.
987+ //
988+ // There has to be a better way, but I do not see one at this time.
989+ // (David Harrison)
997990 {
998991 Position w, h;
999992
@@ -1048,7 +1041,7 @@
10481041 static void
10491042 gui_mch_submenu_change(
10501043 vimmenu_T *menu,
1051- int colors) /* TRUE for colors, FALSE for font */
1044+ int colors) // TRUE for colors, FALSE for font
10521045 {
10531046 vimmenu_T *mp;
10541047
@@ -1060,8 +1053,8 @@
10601053 {
10611054 gui_athena_menu_colors(mp->id);
10621055 #ifdef FEAT_TOOLBAR
1063- /* For a toolbar item: Free the pixmap and allocate a new one,
1064- * so that the background color is right. */
1056+ // For a toolbar item: Free the pixmap and allocate a new one,
1057+ // so that the background color is right.
10651058 if (mp->image != (Pixmap)0)
10661059 {
10671060 XFreePixmap(gui.dpy, mp->image);
@@ -1071,7 +1064,7 @@
10711064 }
10721065
10731066 # ifdef FEAT_BEVAL_GUI
1074- /* If we have a tooltip, then we need to change its colors */
1067+ // If we have a tooltip, then we need to change its colors
10751068 if (mp->tip != NULL)
10761069 {
10771070 Arg args[2];
@@ -1089,9 +1082,8 @@
10891082 {
10901083 gui_athena_menu_font(mp->id);
10911084 #ifdef FEAT_BEVAL_GUI
1092- /* If we have a tooltip, then we need to change its font */
1093- /* Assume XtNinternational == True (in createBalloonEvalWindow)
1094- */
1085+ // If we have a tooltip, then we need to change its font
1086+ // Assume XtNinternational == True (in createBalloonEvalWindow)
10951087 if (mp->tip != NULL)
10961088 {
10971089 Arg args[1];
@@ -1106,7 +1098,7 @@
11061098
11071099 if (mp->children != NULL)
11081100 {
1109- /* Set the colors/font for the tear off widget */
1101+ // Set the colors/font for the tear off widget
11101102 if (mp->submenu_id != (Widget)0)
11111103 {
11121104 if (colors)
@@ -1114,7 +1106,7 @@
11141106 else
11151107 gui_athena_menu_font(mp->submenu_id);
11161108 }
1117- /* Set the colors for the children */
1109+ // Set the colors for the children
11181110 gui_mch_submenu_change(mp->children, colors);
11191111 }
11201112 }
@@ -1171,18 +1163,15 @@
11711163 }
11721164 XtSetArg(args[n], XtNhighlightThickness, 0); n++;
11731165 type = commandWidgetClass;
1174- /* TODO: figure out the position in the toolbar?
1175- * This currently works fine for the default toolbar, but
1176- * what if we add/remove items during later runtime?
1177- */
1166+ // TODO: figure out the position in the toolbar?
1167+ // This currently works fine for the default toolbar, but
1168+ // what if we add/remove items during later runtime?
11781169
1179- /* NOTE: "idx" isn't used here. The position is calculated by
1180- * athena_calculate_ins_pos(). The position it calculates
1181- * should be equal to "idx".
1182- */
1183- /* TODO: Could we just store "idx" and use that as the child
1184- * placement?
1185- */
1170+ // NOTE: "idx" isn't used here. The position is calculated by
1171+ // athena_calculate_ins_pos(). The position it calculates
1172+ // should be equal to "idx".
1173+ // TODO: Could we just store "idx" and use that as the child
1174+ // placement?
11861175
11871176 if (menu->id == NULL)
11881177 {
@@ -1206,10 +1195,10 @@
12061195 gui_mch_show_toolbar(TRUE);
12071196 gui.toolbar_height = gui_mch_compute_toolbar_height();
12081197 return;
1209- } /* toolbar menu item */
1198+ } // toolbar menu item
12101199 # endif
12111200
1212- /* Add menu separator */
1201+ // Add menu separator
12131202 if (menu_is_separator(menu->name))
12141203 {
12151204 menu->submenu_id = (Widget)0;
@@ -1235,10 +1224,9 @@
12351224 if (menu->id == (Widget)0)
12361225 return;
12371226
1238- /* If there are other "pulldown" items in this pane, then adjust
1239- * the right margin to accommodate the arrow pixmap, otherwise
1240- * the right margin will be the same as the left margin.
1241- */
1227+ // If there are other "pulldown" items in this pane, then adjust
1228+ // the right margin to accommodate the arrow pixmap, otherwise
1229+ // the right margin will be the same as the left margin.
12421230 {
12431231 Dimension left_margin;
12441232
@@ -1263,16 +1251,15 @@
12631251 void
12641252 gui_mch_show_toolbar(int showit)
12651253 {
1266- Cardinal numChildren; /* how many children toolBar has */
1254+ Cardinal numChildren; // how many children toolBar has
12671255
12681256 if (toolBar == (Widget)0)
12691257 return;
12701258 XtVaGetValues(toolBar, XtNnumChildren, &numChildren, NULL);
12711259 if (showit && numChildren > 0)
12721260 {
1273- /* Assume that we want to show the toolbar if p_toolbar contains valid
1274- * option settings, therefore p_toolbar must not be NULL.
1275- */
1261+ // Assume that we want to show the toolbar if p_toolbar contains valid
1262+ // option settings, therefore p_toolbar must not be NULL.
12761263 WidgetList children;
12771264
12781265 XtVaGetValues(toolBar, XtNchildren, &children, NULL);
@@ -1296,12 +1283,11 @@
12961283 for (toolbar = root_menu; toolbar; toolbar = toolbar->next)
12971284 if (menu_is_toolbar(toolbar->dname))
12981285 break;
1299- /* Assumption: toolbar is NULL if there is no toolbar,
1300- * otherwise it contains the toolbar menu structure.
1301- *
1302- * Assumption: "numChildren" == the number of items in the list
1303- * of items beginning with toolbar->children.
1304- */
1286+ // Assumption: toolbar is NULL if there is no toolbar,
1287+ // otherwise it contains the toolbar menu structure.
1288+ //
1289+ // Assumption: "numChildren" == the number of items in the list
1290+ // of items beginning with toolbar->children.
13051291 if (toolbar)
13061292 {
13071293 for (cur = toolbar->children; cur; cur = cur->next)
@@ -1309,9 +1295,8 @@
13091295 Arg args[2];
13101296 int n = 0;
13111297
1312- /* Enable/Disable tooltip (OK to enable while currently
1313- * enabled)
1314- */
1298+ // Enable/Disable tooltip (OK to enable while currently
1299+ // enabled)
13151300 if (cur->tip != NULL)
13161301 (*action)(cur->tip);
13171302 if (text == 1)
@@ -1387,12 +1372,12 @@
13871372 int
13881373 gui_mch_compute_toolbar_height(void)
13891374 {
1390- Dimension height; /* total Toolbar height */
1391- Dimension whgt; /* height of each widget */
1392- Dimension marginHeight; /* XmNmarginHeight of toolBar */
1393- Dimension shadowThickness; /* thickness of Xtparent(toolBar) */
1394- WidgetList children; /* list of toolBar's children */
1395- Cardinal numChildren; /* how many children toolBar has */
1375+ Dimension height; // total Toolbar height
1376+ Dimension whgt; // height of each widget
1377+ Dimension marginHeight; // XmNmarginHeight of toolBar
1378+ Dimension shadowThickness; // thickness of Xtparent(toolBar)
1379+ WidgetList children; // list of toolBar's children
1380+ Cardinal numChildren; // how many children toolBar has
13961381 int i;
13971382
13981383 height = 0;
@@ -1438,7 +1423,7 @@
14381423 void
14391424 gui_mch_toggle_tearoffs(int enable UNUSED)
14401425 {
1441- /* no tearoff menus */
1426+ // no tearoff menus
14421427 }
14431428
14441429 void
@@ -1464,23 +1449,21 @@
14641449 {
14651450 Widget parent;
14661451
1467- /* There is no item for the toolbar. */
1452+ // There is no item for the toolbar.
14681453 if (menu->id == (Widget)0)
14691454 return;
14701455
14711456 parent = XtParent(menu->id);
14721457
1473- /* When removing the last "pulldown" menu item from a pane, adjust the
1474- * right margins of the remaining widgets.
1475- */
1458+ // When removing the last "pulldown" menu item from a pane, adjust the
1459+ // right margins of the remaining widgets.
14761460 if (menu->submenu_id != (Widget)0)
14771461 {
1478- /* Go through the menu items in the parent of this item and
1479- * adjust their margins, if necessary.
1480- * This takes care of the case when we delete the last menu item in a
1481- * pane that has a submenu. In this case, there will be no arrow
1482- * pixmaps shown anymore.
1483- */
1462+ // Go through the menu items in the parent of this item and
1463+ // adjust their margins, if necessary.
1464+ // This takes care of the case when we delete the last menu item in a
1465+ // pane that has a submenu. In this case, there will be no arrow
1466+ // pixmaps shown anymore.
14841467 {
14851468 WidgetList children;
14861469 Cardinal num_children;
@@ -1515,11 +1498,10 @@
15151498 }
15161499 }
15171500 }
1518- /* Please be sure to destroy the parent widget first (i.e. menu->id).
1519- *
1520- * This code should be basically identical to that in the file gui_motif.c
1521- * because they are both Xt based.
1522- */
1501+ // Please be sure to destroy the parent widget first (i.e. menu->id).
1502+ //
1503+ // This code should be basically identical to that in the file gui_motif.c
1504+ // because they are both Xt based.
15231505 if (menu->id != (Widget)0)
15241506 {
15251507 Cardinal num_children;
@@ -1535,15 +1517,14 @@
15351517 #if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL_GUI)
15361518 if (parent == toolBar && menu->tip != NULL)
15371519 {
1538- /* We try to destroy this before the actual menu, because there are
1539- * callbacks, etc. that will be unregistered during the tooltip
1540- * destruction.
1541- *
1542- * If you call "gui_mch_destroy_beval_area()" after destroying
1543- * menu->id, then the tooltip's window will have already been
1544- * deallocated by Xt, and unknown behaviour will ensue (probably
1545- * a core dump).
1546- */
1520+ // We try to destroy this before the actual menu, because there are
1521+ // callbacks, etc. that will be unregistered during the tooltip
1522+ // destruction.
1523+ //
1524+ // If you call "gui_mch_destroy_beval_area()" after destroying
1525+ // menu->id, then the tooltip's window will have already been
1526+ // deallocated by Xt, and unknown behaviour will ensue (probably
1527+ // a core dump).
15471528 gui_mch_destroy_beval_area(menu->tip);
15481529 menu->tip = NULL;
15491530 }
@@ -1555,15 +1536,14 @@
15551536 * will be deleted soon anyway, and it will delete its children like
15561537 * all good widgets do.
15571538 */
1558- /* NOTE: The cause of the BadValue X Protocol Error is because when the
1559- * last child is destroyed, it is first unmanaged, thus causing a
1560- * geometry resize request from the parent Shell widget.
1561- * Since the Shell widget has no more children, it is resized to have
1562- * width/height of 0. XConfigureWindow() is then called with the
1563- * width/height of 0, which generates the BadValue.
1564- *
1565- * This happens in phase two of the widget destruction process.
1566- */
1539+ // NOTE: The cause of the BadValue X Protocol Error is because when the
1540+ // last child is destroyed, it is first unmanaged, thus causing a
1541+ // geometry resize request from the parent Shell widget.
1542+ // Since the Shell widget has no more children, it is resized to have
1543+ // width/height of 0. XConfigureWindow() is then called with the
1544+ // width/height of 0, which generates the BadValue.
1545+ //
1546+ // This happens in phase two of the widget destruction process.
15671547 {
15681548 if (parent != menuBar
15691549 #ifdef FEAT_TOOLBAR
@@ -1588,7 +1568,7 @@
15881568 #ifdef FEAT_TOOLBAR
15891569 else if (parent == toolBar)
15901570 {
1591- /* When removing last toolbar item, don't display the toolbar. */
1571+ // When removing last toolbar item, don't display the toolbar.
15921572 XtVaGetValues(toolBar, XtNnumChildren, &num_children, NULL);
15931573 if (num_children == 0)
15941574 gui_mch_show_toolbar(FALSE);
@@ -1620,7 +1600,7 @@
16201600 XtVaGetValues(w, XtNrightBitmap, &p, NULL);
16211601 if ((p != None) && (p != XtUnspecifiedPixmap))
16221602 {
1623- /* We are dealing with an item that has a submenu */
1603+ // We are dealing with an item that has a submenu
16241604 popup = get_popup_entry(XtParent(w));
16251605 if (popup == (Widget)0)
16261606 return;
@@ -1629,7 +1609,8 @@
16291609 }
16301610 }
16311611
1632-/* This routine is used to calculate the position (in screen coordinates)
1612+/*
1613+ * This routine is used to calculate the position (in screen coordinates)
16331614 * where a submenu should appear relative to the menu entry that popped it
16341615 * up. It should appear even with and just slightly to the left of the
16351616 * rightmost end of the menu entry that caused the popup.
@@ -1642,12 +1623,12 @@
16421623 XtPointer client_data,
16431624 XtPointer call_data UNUSED)
16441625 {
1645- /* Assumption: XtIsSubclass(XtParent(w),simpleMenuWidgetClass) */
1626+ // Assumption: XtIsSubclass(XtParent(w),simpleMenuWidgetClass)
16461627 vimmenu_T *menu = (vimmenu_T *)client_data;
16471628 Dimension width;
16481629 Position root_x, root_y;
16491630
1650- /* First, popdown any siblings that may have menus popped up */
1631+ // First, popdown any siblings that may have menus popped up
16511632 {
16521633 vimmenu_T *i;
16531634
@@ -1660,8 +1641,8 @@
16601641 XtVaGetValues(XtParent(w),
16611642 XtNwidth, &width,
16621643 NULL);
1663- /* Assumption: XawSimpleMenuGetActiveEntry(XtParent(w)) == menu->id */
1664- /* i.e. This IS the active entry */
1644+ // Assumption: XawSimpleMenuGetActiveEntry(XtParent(w)) == menu->id
1645+ // i.e. This IS the active entry
16651646 XtTranslateCoords(menu->id,width - 5, 0, &root_x, &root_y);
16661647 XtVaSetValues(w, XtNx, root_x,
16671648 XtNy, root_y,
@@ -1696,7 +1677,9 @@
16961677 }
16971678 }
16981679
1699-/* Used to determine if the given widget has a submenu that can be popped up. */
1680+/*
1681+ * Used to determine if the given widget has a submenu that can be popped up.
1682+ */
17001683 static Boolean
17011684 has_submenu(Widget widget)
17021685 {
@@ -1740,7 +1723,7 @@
17401723 {
17411724 if (timer)
17421725 {
1743- /* If the timeout hasn't been triggered, remove it */
1726+ // If the timeout hasn't been triggered, remove it
17441727 XtRemoveTimeOut(timer);
17451728 }
17461729 gui_athena_popdown_submenus_action(w,event,args,nargs);
@@ -1760,22 +1743,22 @@
17601743 {
17611744 Widget menuw;
17621745
1763- /* Get the active entry for the current menu */
1746+ // Get the active entry for the current menu
17641747 if ((menuw = XawSimpleMenuGetActiveEntry(w)) == (Widget)0)
17651748 return NULL;
17661749
17671750 return submenu_widget(menuw);
17681751 }
17691752
1770-/* Given the widget that has been determined to have a submenu, return the submenu widget
1771- * that is to be popped up.
1753+/*
1754+ * Given the widget that has been determined to have a submenu, return the
1755+ * submenu widget that is to be popped up.
17721756 */
17731757 static Widget
17741758 submenu_widget(Widget widget)
17751759 {
1776- /* Precondition: has_submenu(widget) == True
1777- * XtIsSubclass(XtParent(widget),simpleMenuWidgetClass) == True
1778- */
1760+ // Precondition: has_submenu(widget) == True
1761+ // XtIsSubclass(XtParent(widget),simpleMenuWidgetClass) == True
17791762
17801763 char_u *pullright_name;
17811764 Widget popup;
@@ -1785,8 +1768,8 @@
17851768 vim_free(pullright_name);
17861769
17871770 return popup;
1788- /* Postcondition: (popup != NULL) implies
1789- * (XtIsSubclass(popup,simpleMenuWidgetClass) == True) */
1771+ // Postcondition: (popup != NULL) implies
1772+ // (XtIsSubclass(popup,simpleMenuWidgetClass) == True)
17901773 }
17911774
17921775 void
@@ -1799,7 +1782,7 @@
17991782 if (menu->submenu_id == (Widget)0)
18001783 return;
18011784
1802- /* Position the popup menu at the pointer */
1785+ // Position the popup menu at the pointer
18031786 if (XQueryPointer(gui.dpy, XtWindow(vimShell), &root, &child,
18041787 &rootx, &rooty, &winx, &winy, &mask))
18051788 {
@@ -1819,7 +1802,7 @@
18191802 XtPopupSpringLoaded(menu->submenu_id);
18201803 }
18211804
1822-#endif /* FEAT_MENU */
1805+#endif // FEAT_MENU
18231806
18241807 /*
18251808 * Set the menu and scrollbar colors to their default values.
@@ -1866,7 +1849,7 @@
18661849 */
18671850 if (max == 0)
18681851 {
1869- /* So you can't scroll it at all (normally it scrolls past end) */
1852+ // So you can't scroll it at all (normally it scrolls past end)
18701853 #ifdef FEAT_GUI_NEXTAW
18711854 XawScrollbarSetThumb(sb->id, 0.0, 1.0);
18721855 #else
@@ -1921,7 +1904,7 @@
19211904 void
19221905 gui_mch_create_scrollbar(
19231906 scrollbar_T *sb,
1924- int orient) /* SBAR_VERT or SBAR_HORIZ */
1907+ int orient) // SBAR_VERT or SBAR_HORIZ
19251908 {
19261909 sb->id = XtVaCreateWidget("scrollBar",
19271910 #ifdef FEAT_GUI_NEXTAW
@@ -1971,7 +1954,7 @@
19711954 XtNbackground, gui.scroll_bg_pixel,
19721955 NULL);
19731956
1974- /* This is needed for the rectangle below the vertical scrollbars. */
1957+ // This is needed for the rectangle below the vertical scrollbars.
19751958 if (sb == &gui.bottom_sbar && vimForm != (Widget)0)
19761959 gui_athena_scroll_colors(vimForm);
19771960 }
@@ -1992,17 +1975,17 @@
19921975 */
19931976 char_u *
19941977 gui_mch_browse(
1995- int saving UNUSED, /* select file to write */
1996- char_u *title, /* title for the window */
1997- char_u *dflt, /* default name */
1998- char_u *ext UNUSED, /* extension added */
1999- char_u *initdir, /* initial directory, NULL for current dir */
2000- char_u *filter UNUSED) /* file name filter */
1978+ int saving UNUSED, // select file to write
1979+ char_u *title, // title for the window
1980+ char_u *dflt, // default name
1981+ char_u *ext UNUSED, // extension added
1982+ char_u *initdir, // initial directory, NULL for current dir
1983+ char_u *filter UNUSED) // file name filter
20011984 {
20021985 Position x, y;
20031986 char_u dirbuf[MAXPATHL];
20041987
2005- /* Concatenate "initdir" and "dflt". */
1988+ // Concatenate "initdir" and "dflt".
20061989 if (initdir == NULL || *initdir == NUL)
20071990 mch_dirname(dirbuf, MAXPATHL);
20081991 else if (STRLEN(initdir) + 2 < MAXPATHL)
@@ -2016,7 +1999,7 @@
20161999 STRCAT(dirbuf, dflt);
20172000 }
20182001
2019- /* Position the file selector just below the menubar */
2002+ // Position the file selector just below the menubar
20202003 XtTranslateCoords(vimShell, (Position)0, (Position)
20212004 #ifdef FEAT_MENU
20222005 gui.menu_height
@@ -2111,13 +2094,13 @@
21112094 title = (char_u *)_("Vim dialog");
21122095 dialogStatus = -1;
21132096
2114- /* if our pointer is currently hidden, then we should show it. */
2097+ // if our pointer is currently hidden, then we should show it.
21152098 gui_mch_mousehide(FALSE);
21162099
2117- /* Check 'v' flag in 'guioptions': vertical button placement. */
2100+ // Check 'v' flag in 'guioptions': vertical button placement.
21182101 vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL);
21192102
2120- /* The shell is created each time, to make sure it is resized properly */
2103+ // The shell is created each time, to make sure it is resized properly
21212104 dialogshell = XtVaCreatePopupShell("dialogShell",
21222105 transientShellWidgetClass, vimShell,
21232106 XtNtitle, title,
@@ -2170,7 +2153,7 @@
21702153 XtSetKeyboardFocus(dialog, dialogtextfield);
21712154 }
21722155
2173- /* make a copy, so that we can insert NULs */
2156+ // make a copy, so that we can insert NULs
21742157 buts = vim_strsave(buttons);
21752158 if (buts == NULL)
21762159 return -1;
@@ -2213,7 +2196,7 @@
22132196
22142197 XtRealizeWidget(dialogshell);
22152198
2216- /* Setup for catching the close-window event, don't let it close Vim! */
2199+ // Setup for catching the close-window event, don't let it close Vim!
22172200 dialogatom = XInternAtom(gui.dpy, "WM_DELETE_WINDOW", False);
22182201 XSetWMProtocols(gui.dpy, XtWindow(dialogshell), &dialogatom, 1);
22192202 XtAddEventHandler(dialogshell, NoEventMask, True, dialog_wm_handler, NULL);
@@ -2236,8 +2219,8 @@
22362219 y = 0;
22372220 XtVaSetValues(dialogshell, XtNx, x, XtNy, y, NULL);
22382221
2239- /* Position the mouse pointer in the dialog, required for when focus
2240- * follows mouse. */
2222+ // Position the mouse pointer in the dialog, required for when focus
2223+ // follows mouse.
22412224 XWarpPointer(gui.dpy, (Window)0, XtWindow(dialogshell), 0, 0, 0, 0, 20, 40);
22422225
22432226
diff -r 04ce3b8a50ed -r 79e10adc821d src/gui_beval.c
--- a/src/gui_beval.c Sun Dec 01 21:45:05 2019 +0100
+++ b/src/gui_beval.c Sun Dec 01 22:15:03 2019 +0100
@@ -12,7 +12,7 @@
1212
1313 #if defined(FEAT_BEVAL_GUI) || defined(PROTO)
1414
15-/* on Win32 only get_beval_info() is required */
15+// on Win32 only get_beval_info() is required
1616 #if !defined(FEAT_GUI_MSWIN) || defined(PROTO)
1717
1818 #ifdef FEAT_GUI_GTK
@@ -32,7 +32,7 @@
3232 # include <Xm/AtomMgr.h>
3333 # include <Xm/Protocols.h>
3434 # else
35- /* Assume Athena */
35+ // Assume Athena
3636 # include <X11/Shell.h>
3737 # ifdef FEAT_GUI_NEXTAW
3838 # include <X11/neXtaw/Label.h>
@@ -95,7 +95,7 @@
9595 void *clientData)
9696 {
9797 #ifndef FEAT_GUI_GTK
98- char *display_name; /* get from gui.dpy */
98+ char *display_name; // get from gui.dpy
9999 int screen_num;
100100 char *p;
101101 #endif
@@ -157,7 +157,7 @@
157157 {
158158 cancelBalloon(beval);
159159 removeEventHandler(beval);
160- /* Children will automatically be destroyed */
160+ // Children will automatically be destroyed
161161 # ifdef FEAT_GUI_GTK
162162 gtk_widget_destroy(beval->balloonShell);
163163 # else
@@ -198,7 +198,7 @@
198198 return current_beval;
199199 }
200200 #endif
201-#endif /* !FEAT_GUI_MSWIN */
201+#endif // !FEAT_GUI_MSWIN
202202
203203 #if defined(FEAT_NETBEANS_INTG) || defined(FEAT_EVAL) || defined(PROTO)
204204 # if !defined(FEAT_GUI_MSWIN) || defined(PROTO)
@@ -216,8 +216,8 @@
216216 else
217217 undrawBalloon(beval);
218218 }
219-# endif /* !FEAT_GUI_MSWIN */
220-#endif /* FEAT_NETBEANS_INTG || PROTO */
219+# endif // !FEAT_GUI_MSWIN
220+#endif // FEAT_NETBEANS_INTG || PROTO
221221
222222 #if !defined(FEAT_GUI_MSWIN) || defined(PROTO)
223223 #if defined(FEAT_BEVAL_TIP) || defined(PROTO)
@@ -344,7 +344,7 @@
344344 break;
345345 }
346346
347- return FALSE; /* continue emission */
347+ return FALSE; // continue emission
348348 }
349349
350350 static gint
@@ -364,7 +364,7 @@
364364 break;
365365 }
366366
367- return FALSE; /* continue emission */
367+ return FALSE; // continue emission
368368 }
369369
370370 static void
@@ -383,7 +383,7 @@
383383 beval->state = state;
384384 cancelBalloon(beval);
385385
386- /* Mouse buttons are pressed - no balloon now */
386+ // Mouse buttons are pressed - no balloon now
387387 if (!(state & ((int)GDK_BUTTON1_MASK | (int)GDK_BUTTON2_MASK
388388 | (int)GDK_BUTTON3_MASK)))
389389 {
@@ -431,8 +431,8 @@
431431 ? (int)GDK_CONTROL_MASK : 0);
432432 break;
433433 default:
434- /* Don't do this for key release, we apparently get these with
435- * focus changes in some GTK version. */
434+ // Don't do this for key release, we apparently get these with
435+ // focus changes in some GTK version.
436436 if (is_keypress)
437437 cancelBalloon(beval);
438438 break;
@@ -455,7 +455,7 @@
455455 */
456456 requestBalloon(beval);
457457
458- return FALSE; /* don't call me again */
458+ return FALSE; // don't call me again
459459 }
460460
461461 # if GTK_CHECK_VERSION(3,0,0)
@@ -499,11 +499,11 @@
499499 &event->area, widget, "tooltip",
500500 0, 0, -1, -1);
501501
502- return FALSE; /* continue emission */
502+ return FALSE; // continue emission
503503 }
504-# endif /* !GTK_CHECK_VERSION(3,0,0) */
504+# endif // !GTK_CHECK_VERSION(3,0,0)
505505
506-#else /* !FEAT_GUI_GTK */
506+#else // !FEAT_GUI_GTK
507507
508508 static void
509509 addEventHandler(Widget target, BalloonEval *beval)
@@ -551,8 +551,8 @@
551551 static void
552552 pointerEvent(BalloonEval *beval, XEvent *event)
553553 {
554- Position distance; /* a measure of how much the pointer moved */
555- Position delta; /* used to compute distance */
554+ Position distance; // a measure of how much the pointer moved
555+ Position delta; // used to compute distance
556556
557557 switch (event->type)
558558 {
@@ -575,7 +575,7 @@
575575 beval->state = event->xmotion.state;
576576 if (beval->state & (Button1Mask|Button2Mask|Button3Mask))
577577 {
578- /* Mouse buttons are pressed - no balloon now */
578+ // Mouse buttons are pressed - no balloon now
579579 cancelBalloon(beval);
580580 }
581581 else if (beval->state & (Mod1Mask|Mod2Mask|Mod3Mask))
@@ -663,9 +663,9 @@
663663 break;
664664
665665 case LeaveNotify:
666- /* Ignore LeaveNotify events that are not "normal".
667- * Apparently we also get it when somebody else grabs focus.
668- * Happens for me every two seconds (some clipboard tool?) */
666+ // Ignore LeaveNotify events that are not "normal".
667+ // Apparently we also get it when somebody else grabs focus.
668+ // Happens for me every two seconds (some clipboard tool?)
669669 if (event->xcrossing.mode == NotifyNormal)
670670 cancelBalloon(beval);
671671 break;
@@ -694,14 +694,14 @@
694694 requestBalloon(beval);
695695 }
696696
697-#endif /* !FEAT_GUI_GTK */
697+#endif // !FEAT_GUI_GTK
698698
699699 static void
700700 requestBalloon(BalloonEval *beval)
701701 {
702702 if (beval->showState != ShS_PENDING)
703703 {
704- /* Determine the beval to display */
704+ // Determine the beval to display
705705 if (beval->msgCB != NULL)
706706 {
707707 beval->showState = ShS_PENDING;
@@ -733,7 +733,7 @@
733733 int uc;
734734 PangoAttrList *attr_list;
735735
736- /* Convert to UTF-8 if it isn't already */
736+ // Convert to UTF-8 if it isn't already
737737 if (output_conv.vc_type != CONV_NONE)
738738 {
739739 convbuf = string_convert(&output_conv, text, NULL);
@@ -741,14 +741,14 @@
741741 text = convbuf;
742742 }
743743
744- /* First let's see how much we need to allocate */
744+ // First let's see how much we need to allocate
745745 len = 0;
746746 for (p = text; *p != NUL; p += charlen)
747747 {
748- if ((*p & 0x80) == 0) /* be quick for ASCII */
748+ if ((*p & 0x80) == 0) // be quick for ASCII
749749 {
750750 charlen = 1;
751- len += IS_NONPRINTABLE(*p) ? 2 : 1; /* nonprintable: ^X */
751+ len += IS_NONPRINTABLE(*p) ? 2 : 1; // nonprintable: ^X
752752 }
753753 else
754754 {
@@ -756,14 +756,14 @@
756756 uc = utf_ptr2char(p);
757757
758758 if (charlen != utf_char2len(uc))
759- charlen = 1; /* reject overlong sequences */
759+ charlen = 1; // reject overlong sequences
760760
761- if (charlen == 1 || uc < 0xa0) /* illegal byte or */
762- len += 4; /* control char: <xx> */
761+ if (charlen == 1 || uc < 0xa0) // illegal byte or
762+ len += 4; // control char: <xx>
763763 else if (!utf_printable(uc))
764- /* Note: we assume here that utf_printable() doesn't
765- * care about characters outside the BMP. */
766- len += 6; /* nonprintable: <xxxx> */
764+ // Note: we assume here that utf_printable() doesn't
765+ // care about characters outside the BMP.
766+ len += 6; // nonprintable: <xxxx>
767767 else
768768 len += charlen;
769769 }
@@ -772,7 +772,7 @@
772772 attr_list = pango_attr_list_new();
773773 buf = alloc(len + 1);
774774
775- /* Now go for the real work */
775+ // Now go for the real work
776776 if (buf != NULL)
777777 {
778778 attrentry_T *aep;
@@ -787,7 +787,7 @@
787787 GdkColor color = { 0, 0, 0, 0 };
788788 #endif
789789
790- /* Look up the RGB values of the SpecialKey foreground color. */
790+ // Look up the RGB values of the SpecialKey foreground color.
791791 aep = syn_gui_attr2entry(HL_ATTR(HLF_8));
792792 pixel = (aep != NULL) ? aep->ae_u.gui.fg_color : INVALCOLOR;
793793 if (pixel != INVALCOLOR)
@@ -807,7 +807,7 @@
807807 p = text;
808808 while (*p != NUL)
809809 {
810- /* Be quick for ASCII */
810+ // Be quick for ASCII
811811 if ((*p & 0x80) == 0 && !IS_NONPRINTABLE(*p))
812812 {
813813 *pdest++ = *p++;
@@ -818,29 +818,29 @@
818818 uc = utf_ptr2char(p);
819819
820820 if (charlen != utf_char2len(uc))
821- charlen = 1; /* reject overlong sequences */
821+ charlen = 1; // reject overlong sequences
822822
823823 if (charlen == 1 || uc < 0xa0 || !utf_printable(uc))
824824 {
825825 int outlen;
826826
827- /* Careful: we can't just use transchar_byte() here,
828- * since 'encoding' is not necessarily set to "utf-8". */
827+ // Careful: we can't just use transchar_byte() here,
828+ // since 'encoding' is not necessarily set to "utf-8".
829829 if (*p & 0x80 && charlen == 1)
830830 {
831- transchar_hex(pdest, *p); /* <xx> */
831+ transchar_hex(pdest, *p); // <xx>
832832 outlen = 4;
833833 }
834834 else if (uc >= 0x80)
835835 {
836- /* Note: we assume here that utf_printable() doesn't
837- * care about characters outside the BMP. */
838- transchar_hex(pdest, uc); /* <xx> or <xxxx> */
836+ // Note: we assume here that utf_printable() doesn't
837+ // care about characters outside the BMP.
838+ transchar_hex(pdest, uc); // <xx> or <xxxx>
839839 outlen = (uc < 0x100) ? 4 : 6;
840840 }
841841 else
842842 {
843- transchar_nonprint(pdest, *p); /* ^X */
843+ transchar_nonprint(pdest, *p); // ^X
844844 outlen = 2;
845845 }
846846 if (pixel != INVALCOLOR)
@@ -940,36 +940,36 @@
940940 pango_layout_set_wrap(layout, PANGO_WRAP_WORD);
941941 # endif
942942 pango_layout_set_width(layout,
943- /* try to come up with some reasonable width */
943+ // try to come up with some reasonable width
944944 PANGO_SCALE * CLAMP(gui.num_cols * gui.char_width,
945945 screen_w / 2,
946946 MAX(20, screen_w - 20)));
947947
948- /* Calculate the balloon's width and height. */
948+ // Calculate the balloon's width and height.
949949 # if GTK_CHECK_VERSION(3,0,0)
950950 gtk_widget_get_preferred_size(beval->balloonShell, &requisition, NULL);
951951 # else
952952 gtk_widget_size_request(beval->balloonShell, &requisition);
953953 # endif
954954
955- /* Compute position of the balloon area */
955+ // Compute position of the balloon area
956956 gdk_window_get_origin(gtk_widget_get_window(beval->target), &x, &y);
957957 x += beval->x;
958958 y += beval->y;
959959
960- /* Get out of the way of the mouse pointer */
960+ // Get out of the way of the mouse pointer
961961 if (x + x_offset + requisition.width > screen_x + screen_w)
962962 y_offset += 15;
963963 if (y + y_offset + requisition.height > screen_y + screen_h)
964964 y_offset = -requisition.height - EVAL_OFFSET_Y;
965965
966- /* Sanitize values */
966+ // Sanitize values
967967 x = CLAMP(x + x_offset, 0,
968968 MAX(0, screen_x + screen_w - requisition.width));
969969 y = CLAMP(y + y_offset, 0,
970970 MAX(0, screen_y + screen_h - requisition.height));
971971
972- /* Show the balloon */
972+ // Show the balloon
973973 # if GTK_CHECK_VERSION(3,0,0)
974974 gtk_window_move(GTK_WINDOW(beval->balloonShell), x, y);
975975 # else
@@ -1048,7 +1048,7 @@
10481048 gtk_container_add(GTK_CONTAINER(beval->balloonShell), beval->balloonLabel);
10491049 }
10501050
1051-#else /* !FEAT_GUI_GTK */
1051+#else // !FEAT_GUI_GTK
10521052
10531053 /*
10541054 * Draw a balloon.
@@ -1063,15 +1063,15 @@
10631063
10641064 if (beval->msg != NULL)
10651065 {
1066- /* Show the Balloon */
1066+ // Show the Balloon
10671067
1068- /* Calculate the label's width and height */
1068+ // Calculate the label's width and height
10691069 #ifdef FEAT_GUI_MOTIF
10701070 XmString s;
10711071
1072- /* For the callback function we parse NL characters to create a
1073- * multi-line label. This doesn't work for all languages, but
1074- * XmStringCreateLocalized() doesn't do multi-line labels... */
1072+ // For the callback function we parse NL characters to create a
1073+ // multi-line label. This doesn't work for all languages, but
1074+ // XmStringCreateLocalized() doesn't do multi-line labels...
10751075 if (beval->msgCB != NULL)
10761076 s = XmStringCreateLtoR((char *)beval->msg, XmFONTLIST_DEFAULT_TAG);
10771077 else
@@ -1092,8 +1092,8 @@
10921092 h += gui.border_offset << 1;
10931093 XtVaSetValues(beval->balloonLabel, XmNlabelString, s, NULL);
10941094 XmStringFree(s);
1095-#else /* Athena */
1096- /* Assume XtNinternational == True */
1095+#else // Athena
1096+ // Assume XtNinternational == True
10971097 XFontSet fset;
10981098 XFontSetExtents *ext;
10991099
@@ -1108,7 +1108,7 @@
11081108 XtVaSetValues(beval->balloonLabel, XtNlabel, beval->msg, NULL);
11091109 #endif
11101110
1111- /* Compute position of the balloon area */
1111+ // Compute position of the balloon area
11121112 tx = beval->x_root + EVAL_OFFSET_X;
11131113 ty = beval->y_root + EVAL_OFFSET_Y;
11141114 if ((tx + w) > beval->screen_width)
@@ -1121,13 +1121,13 @@
11211121 XmNy, ty,
11221122 NULL);
11231123 #else
1124- /* Athena */
1124+ // Athena
11251125 XtVaSetValues(beval->balloonShell,
11261126 XtNx, tx,
11271127 XtNy, ty,
11281128 NULL);
11291129 #endif
1130- /* Set tooltip colors */
1130+ // Set tooltip colors
11311131 {
11321132 Arg args[2];
11331133
@@ -1136,7 +1136,7 @@
11361136 args[0].value = gui.tooltip_bg_pixel;
11371137 args[1].name = XmNforeground;
11381138 args[1].value = gui.tooltip_fg_pixel;
1139-#else /* Athena */
1139+#else // Athena
11401140 args[0].name = XtNbackground;
11411141 args[0].value = gui.tooltip_bg_pixel;
11421142 args[1].name = XtNforeground;
@@ -1194,7 +1194,7 @@
11941194 beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval",
11951195 overrideShellWidgetClass, gui.dpy, args, n);
11961196 #else
1197- /* Athena */
1197+ // Athena
11981198 XtSetArg(args[n], XtNallowShellResize, True); n++;
11991199 beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval",
12001200 overrideShellWidgetClass, gui.dpy, args, n);
@@ -1213,7 +1213,7 @@
12131213 beval->balloonLabel = XtCreateManagedWidget("balloonLabel",
12141214 xmLabelWidgetClass, beval->balloonShell, args, n);
12151215 }
1216-#else /* FEAT_GUI_ATHENA */
1216+#else // FEAT_GUI_ATHENA
12171217 XtSetArg(args[n], XtNforeground, gui.tooltip_fg_pixel); n++;
12181218 XtSetArg(args[n], XtNbackground, gui.tooltip_bg_pixel); n++;
12191219 XtSetArg(args[n], XtNinternational, True); n++;
@@ -1223,7 +1223,7 @@
12231223 #endif
12241224 }
12251225
1226-#endif /* !FEAT_GUI_GTK */
1227-#endif /* !FEAT_GUI_MSWIN */
1226+#endif // !FEAT_GUI_GTK
1227+#endif // !FEAT_GUI_MSWIN
12281228
1229-#endif /* FEAT_BEVAL_GUI */
1229+#endif // FEAT_BEVAL_GUI
diff -r 04ce3b8a50ed -r 79e10adc821d src/gui_gtk.c
--- a/src/gui_gtk.c Sun Dec 01 21:45:05 2019 +0100
+++ b/src/gui_gtk.c Sun Dec 01 22:15:03 2019 +0100
@@ -37,8 +37,8 @@
3737 # include "gui_gtk_f.h"
3838 #endif
3939
40-/* GTK defines MAX and MIN, but some system header files as well. Undefine
41- * them and don't use them. */
40+// GTK defines MAX and MIN, but some system header files as well. Undefine
41+// them and don't use them.
4242 #ifdef MIN
4343 # undef MIN
4444 #endif
@@ -47,7 +47,7 @@
4747 #endif
4848
4949 #ifdef FEAT_GUI_GNOME
50-/* Gnome redefines _() and N_(). Grrr... */
50+// Gnome redefines _() and N_(). Grrr...
5151 # ifdef _
5252 # undef _
5353 # endif
@@ -64,7 +64,7 @@
6464 # undef bind_textdomain_codeset
6565 # endif
6666 # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS)
67-# define ENABLE_NLS /* so the texts in the dialog boxes are translated */
67+# define ENABLE_NLS // so the texts in the dialog boxes are translated
6868 # endif
6969 # include <gnome.h>
7070 #endif
@@ -84,7 +84,7 @@
8484
8585 # include <gtk/gtk.h>
8686 #else
87-/* define these items to be able to generate prototypes without GTK */
87+// define these items to be able to generate prototypes without GTK
8888 typedef int GtkWidget;
8989 # define gpointer int
9090 # define guint8 int
@@ -118,20 +118,20 @@
118118 # if GTK_CHECK_VERSION(3,10,0)
119119 static const char * const menu_themed_names[] =
120120 {
121- /* 00 */ "document-new", /* sub. GTK_STOCK_NEW */
122- /* 01 */ "document-open", /* sub. GTK_STOCK_OPEN */
123- /* 02 */ "document-save", /* sub. GTK_STOCK_SAVE */
124- /* 03 */ "edit-undo", /* sub. GTK_STOCK_UNDO */
125- /* 04 */ "edit-redo", /* sub. GTK_STOCK_REDO */
126- /* 05 */ "edit-cut", /* sub. GTK_STOCK_CUT */
127- /* 06 */ "edit-copy", /* sub. GTK_STOCK_COPY */
128- /* 07 */ "edit-paste", /* sub. GTK_STOCK_PASTE */
129- /* 08 */ "document-print", /* sub. GTK_STOCK_PRINT */
130- /* 09 */ "help-browser", /* sub. GTK_STOCK_HELP */
131- /* 10 */ "edit-find", /* sub. GTK_STOCK_FIND */
121+ /* 00 */ "document-new", // sub. GTK_STOCK_NEW
122+ /* 01 */ "document-open", // sub. GTK_STOCK_OPEN
123+ /* 02 */ "document-save", // sub. GTK_STOCK_SAVE
124+ /* 03 */ "edit-undo", // sub. GTK_STOCK_UNDO
125+ /* 04 */ "edit-redo", // sub. GTK_STOCK_REDO
126+ /* 05 */ "edit-cut", // sub. GTK_STOCK_CUT
127+ /* 06 */ "edit-copy", // sub. GTK_STOCK_COPY
128+ /* 07 */ "edit-paste", // sub. GTK_STOCK_PASTE
129+ /* 08 */ "document-print", // sub. GTK_STOCK_PRINT
130+ /* 09 */ "help-browser", // sub. GTK_STOCK_HELP
131+ /* 10 */ "edit-find", // sub. GTK_STOCK_FIND
132132 # if GTK_CHECK_VERSION(3,14,0)
133- /* Use the file names in gui_gtk_res.xml, cutting off the extension.
134- * Similar changes follow. */
133+ // Use the file names in gui_gtk_res.xml, cutting off the extension.
134+ // Similar changes follow.
135135 /* 11 */ "stock_vim_save_all",
136136 /* 12 */ "stock_vim_session_save",
137137 /* 13 */ "stock_vim_session_new",
@@ -142,9 +142,9 @@
142142 /* 13 */ "vim-session-new",
143143 /* 14 */ "vim-session-load",
144144 # endif
145- /* 15 */ "system-run", /* sub. GTK_STOCK_EXECUTE */
146- /* 16 */ "edit-find-replace", /* sub. GTK_STOCK_FIND_AND_REPLACE */
147- /* 17 */ "window-close", /* sub. GTK_STOCK_CLOSE, FIXME: fuzzy */
145+ /* 15 */ "system-run", // sub. GTK_STOCK_EXECUTE
146+ /* 16 */ "edit-find-replace", // sub. GTK_STOCK_FIND_AND_REPLACE
147+ /* 17 */ "window-close", // sub. GTK_STOCK_CLOSE, FIXME: fuzzy
148148 # if GTK_CHECK_VERSION(3,14,0)
149149 /* 18 */ "stock_vim_window_maximize",
150150 /* 19 */ "stock_vim_window_minimize",
@@ -156,15 +156,15 @@
156156 /* 20 */ "vim-window-split",
157157 /* 21 */ "vim-shell",
158158 # endif
159- /* 22 */ "go-previous", /* sub. GTK_STOCK_GO_BACK */
160- /* 23 */ "go-next", /* sub. GTK_STOCK_GO_FORWARD */
159+ /* 22 */ "go-previous", // sub. GTK_STOCK_GO_BACK
160+ /* 23 */ "go-next", // sub. GTK_STOCK_GO_FORWARD
161161 # if GTK_CHECK_VERSION(3,14,0)
162162 /* 24 */ "stock_vim_find_help",
163163 # else
164164 /* 24 */ "vim-find-help",
165165 # endif
166- /* 25 */ "gtk-convert", /* sub. GTK_STOCK_CONVERT */
167- /* 26 */ "go-jump", /* sub. GTK_STOCK_JUMP_TO */
166+ /* 25 */ "gtk-convert", // sub. GTK_STOCK_CONVERT
167+ /* 26 */ "go-jump", // sub. GTK_STOCK_JUMP_TO
168168 # if GTK_CHECK_VERSION(3,14,0)
169169 /* 27 */ "stock_vim_build_tags",
170170 /* 28 */ "stock_vim_window_split_vertical",
@@ -176,9 +176,9 @@
176176 /* 29 */ "vim-window-maximize-width",
177177 /* 30 */ "vim-window-minimize-width",
178178 # endif
179- /* 31 */ "application-exit", /* GTK_STOCK_QUIT */
179+ /* 31 */ "application-exit", // GTK_STOCK_QUIT
180180 };
181-# else /* !GTK_CHECK_VERSION(3,10,0) */
181+# else // !GTK_CHECK_VERSION(3,10,0)
182182 static const char * const menu_stock_ids[] =
183183 {
184184 /* 00 */ GTK_STOCK_NEW,
@@ -198,7 +198,7 @@
198198 /* 14 */ "vim-session-load",
199199 /* 15 */ GTK_STOCK_EXECUTE,
200200 /* 16 */ GTK_STOCK_FIND_AND_REPLACE,
201- /* 17 */ GTK_STOCK_CLOSE, /* FIXME: fuzzy */
201+ /* 17 */ GTK_STOCK_CLOSE, // FIXME: fuzzy
202202 /* 18 */ "vim-window-maximize",
203203 /* 19 */ "vim-window-minimize",
204204 /* 20 */ "vim-window-split",
@@ -214,7 +214,7 @@
214214 /* 30 */ "vim-window-minimize-width",
215215 /* 31 */ GTK_STOCK_QUIT
216216 };
217-# endif /* !GTK_CHECK_VERSION(3,10,0) */
217+# endif // !GTK_CHECK_VERSION(3,10,0)
218218
219219 # ifdef USE_GRESOURCE
220220 # if !GTK_CHECK_VERSION(3,10,0)
@@ -240,7 +240,7 @@
240240 { NULL, NULL }
241241 };
242242 # endif
243-# endif /* USE_G_RESOURCE */
243+# endif // USE_G_RESOURCE
244244
245245 # ifndef USE_GRESOURCE
246246 static void
@@ -316,7 +316,7 @@
316316 pixel_size = 48;
317317 break;
318318 case GTK_ICON_SIZE_INVALID:
319- /* FALLTHROUGH */
319+ // FALLTHROUGH
320320 default:
321321 pixel_size = 0;
322322 break;
@@ -337,7 +337,7 @@
337337 image = gtk_image_new_from_icon_name("image-missing", icon_size);
338338
339339 return image;
340-# else /* !GTK_CHECK_VERSION(3,10,0) */
340+# else // !GTK_CHECK_VERSION(3,10,0)
341341 GtkIconSet *icon_set;
342342 GtkIconSource *icon_source;
343343
@@ -358,7 +358,7 @@
358358 gtk_icon_set_unref(icon_set);
359359
360360 return image;
361-# endif /* !GTK_CHECK_VERSION(3,10,0) */
361+# endif // !GTK_CHECK_VERSION(3,10,0)
362362 }
363363
364364 static GtkWidget *
@@ -367,16 +367,16 @@
367367 GtkWidget *image = NULL;
368368 char_u buf[MAXPATHL];
369369
370- /* First use a specified "icon=" argument. */
370+ // First use a specified "icon=" argument.
371371 if (menu->iconfile != NULL && lookup_menu_iconfile(menu->iconfile, buf))
372372 image = load_menu_iconfile(buf, icon_size);
373373
374- /* If not found and not builtin specified try using the menu name. */
374+ // If not found and not builtin specified try using the menu name.
375375 if (image == NULL && !menu->icon_builtin
376376 && lookup_menu_iconfile(menu->name, buf))
377377 image = load_menu_iconfile(buf, icon_size);
378378
379- /* Still not found? Then use a builtin icon, a blank one as fallback. */
379+ // Still not found? Then use a builtin icon, a blank one as fallback.
380380 if (image == NULL)
381381 {
382382 # if GTK_CHECK_VERSION(3,10,0)
@@ -410,15 +410,15 @@
410410 GdkEventFocus *event UNUSED,
411411 gpointer data UNUSED)
412412 {
413- /* When we're in a GtkPlug, we don't have window focus events, only widget
414- * focus. To emulate stand-alone gvim, if a button gets focus (e.g.,
415- * <Tab> into GtkPlug) immediately pass it to mainwin. */
413+ // When we're in a GtkPlug, we don't have window focus events, only widget
414+ // focus. To emulate stand-alone gvim, if a button gets focus (e.g.,
415+ // <Tab> into GtkPlug) immediately pass it to mainwin.
416416 if (gtk_socket_id != 0)
417417 gtk_widget_grab_focus(gui.drawarea);
418418
419419 return TRUE;
420420 }
421-#endif /* FEAT_TOOLBAR */
421+#endif // FEAT_TOOLBAR
422422
423423 #if defined(FEAT_TOOLBAR) || defined(PROTO)
424424
@@ -450,7 +450,7 @@
450450
451451 gtk_icon_factory_add_default(factory);
452452 g_object_unref(factory);
453-# else /* defined(USE_GRESOURCE) */
453+# else // defined(USE_GRESOURCE)
454454 const char * const path_prefix = "/org/vim/gui/icon";
455455 # if GTK_CHECK_VERSION(3,14,0)
456456 GdkScreen *screen = NULL;
@@ -478,18 +478,18 @@
478478 gdk_pixbuf_get_height(pixbuf));
479479 if (size > 16)
480480 {
481- /* An icon theme is supposed to provide fixed-size
482- * image files for each size, e.g., 16, 22, 24, ...
483- * Naturally, in contrast to GtkIconSet, GtkIconTheme
484- * won't prepare size variants for us out of a single
485- * fixed-size image.
486- *
487- * Currently, Vim provides 24x24 images only while the
488- * icon size on the menu and the toolbar is set to 16x16
489- * by default.
490- *
491- * Resize them by ourselves until we have our own fully
492- * fledged icon theme. */
481+ // An icon theme is supposed to provide fixed-size
482+ // image files for each size, e.g., 16, 22, 24, ...
483+ // Naturally, in contrast to GtkIconSet, GtkIconTheme
484+ // won't prepare size variants for us out of a single
485+ // fixed-size image.
486+ //
487+ // Currently, Vim provides 24x24 images only while the
488+ // icon size on the menu and the toolbar is set to 16x16
489+ // by default.
490+ //
491+ // Resize them by ourselves until we have our own fully
492+ // fledged icon theme.
493493 GdkPixbuf *src = pixbuf;
494494 pixbuf = gdk_pixbuf_scale_simple(src,
495495 16, 16,
@@ -503,7 +503,7 @@
503503 g_object_unref(pixbuf);
504504 }
505505 }
506-# else /* !GTK_CHECK_VERSION(3,0.0) */
506+# else // !GTK_CHECK_VERSION(3,0.0)
507507 GtkIconFactory * const factory = gtk_icon_factory_new();
508508 IconNames *names;
509509
@@ -525,11 +525,11 @@
525525
526526 gtk_icon_factory_add_default(factory);
527527 g_object_unref(factory);
528-# endif /* !GTK_CHECK_VERSION(3,0,0) */
529-# endif /* defined(USE_GRESOURCE) */
528+# endif // !GTK_CHECK_VERSION(3,0,0)
529+# endif // defined(USE_GRESOURCE)
530530 }
531531
532-#endif /* FEAT_TOOLBAR */
532+#endif // FEAT_TOOLBAR
533533
534534 #if defined(FEAT_MENU) || defined(PROTO)
535535
@@ -597,9 +597,9 @@
597597 char_u *text;
598598 int use_mnemonic;
599599
600- /* It would be neat to have image menu items, but that would require major
601- * changes to Vim's menu system. Not to mention that all the translations
602- * had to be updated. */
600+ // It would be neat to have image menu items, but that would require major
601+ // changes to Vim's menu system. Not to mention that all the translations
602+ // had to be updated.
603603 menu->id = gtk_menu_item_new();
604604 # if GTK_CHECK_VERSION(3,2,0)
605605 box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 20);
@@ -653,7 +653,7 @@
653653 menu_item_new(menu, parent_widget);
654654
655655 # if !GTK_CHECK_VERSION(3,4,0)
656- /* since the tearoff should always appear first, increment idx */
656+ // since the tearoff should always appear first, increment idx
657657 if (parent != NULL && !menu_is_popup(parent->name))
658658 ++idx;
659659 # endif
@@ -722,8 +722,8 @@
722722 text = CONVERT_TO_UTF8(menu->dname);
723723 tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]);
724724 if (tooltip != NULL && !utf_valid_string(tooltip, NULL))
725- /* Invalid text, can happen when 'encoding' is changed. Avoid
726- * a nasty GTK error message, skip the tooltip. */
725+ // Invalid text, can happen when 'encoding' is changed. Avoid
726+ // a nasty GTK error message, skip the tooltip.
727727 CONVERT_TO_UTF8_FREE(tooltip);
728728
729729 # if GTK_CHECK_VERSION(3,0,0)
@@ -764,22 +764,22 @@
764764 }
765765 }
766766 else
767-# endif /* FEAT_TOOLBAR */
767+# endif // FEAT_TOOLBAR
768768 {
769- /* No parent, must be a non-menubar menu */
769+ // No parent, must be a non-menubar menu
770770 if (parent == NULL || parent->submenu_id == NULL)
771771 return;
772772
773773 # if !GTK_CHECK_VERSION(3,4,0)
774- /* Make place for the possible tearoff handle item. Not in the popup
775- * menu, it doesn't have a tearoff item. */
774+ // Make place for the possible tearoff handle item. Not in the popup
775+ // menu, it doesn't have a tearoff item.
776776 if (!menu_is_popup(parent->name))
777777 ++idx;
778778 # endif
779779
780780 if (menu_is_separator(menu->name))
781781 {
782- /* Separator: Just add it */
782+ // Separator: Just add it
783783 # if GTK_CHECK_VERSION(3,0,0)
784784 menu->id = gtk_separator_menu_item_new();
785785 # else
@@ -793,7 +793,7 @@
793793 return;
794794 }
795795
796- /* Add textual menu item. */
796+ // Add textual menu item.
797797 menu_item_new(menu, parent->submenu_id);
798798 gtk_widget_show(menu->id);
799799 gtk_menu_shell_insert(GTK_MENU_SHELL(parent->submenu_id),
@@ -804,7 +804,7 @@
804804 G_CALLBACK(menu_item_activate), menu);
805805 }
806806 }
807-#endif /* FEAT_MENU */
807+#endif // FEAT_MENU
808808
809809
810810 void
@@ -859,7 +859,7 @@
859859 void
860860 gui_mch_toggle_tearoffs(int enable UNUSED)
861861 {
862- /* Do nothing */
862+ // Do nothing
863863 }
864864 # else
865865 void
@@ -868,7 +868,7 @@
868868 recurse_tearoffs(root_menu, enable);
869869 }
870870 # endif
871-#endif /* FEAT_MENU */
871+#endif // FEAT_MENU
872872
873873 #if defined(FEAT_TOOLBAR)
874874 static int
@@ -885,7 +885,7 @@
885885
886886 return idx;
887887 }
888-#endif /* FEAT_TOOLBAR */
888+#endif // FEAT_TOOLBAR
889889
890890
891891 #if defined(FEAT_TOOLBAR) || defined(PROTO)
@@ -900,17 +900,17 @@
900900 tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]);
901901 if (tooltip != NULL && utf_valid_string(tooltip, NULL))
902902 # if GTK_CHECK_VERSION(3,0,0)
903- /* Only set the tooltip when it's valid utf-8. */
903+ // Only set the tooltip when it's valid utf-8.
904904 gtk_widget_set_tooltip_text(menu->id, (const gchar *)tooltip);
905905 # else
906- /* Only set the tooltip when it's valid utf-8. */
906+ // Only set the tooltip when it's valid utf-8.
907907 gtk_tooltips_set_tip(GTK_TOOLBAR(gui.toolbar)->tooltips,
908908 menu->id, (const char *)tooltip, NULL);
909909 # endif
910910 CONVERT_TO_UTF8_FREE(tooltip);
911911 }
912912 }
913-#endif /* FEAT_TOOLBAR */
913+#endif // FEAT_TOOLBAR
914914
915915
916916 #if defined(FEAT_MENU) || defined(PROTO)
@@ -920,13 +920,13 @@
920920 void
921921 gui_mch_destroy_menu(vimmenu_T *menu)
922922 {
923- /* Don't let gtk_container_remove automatically destroy menu->id. */
923+ // Don't let gtk_container_remove automatically destroy menu->id.
924924 if (menu->id != NULL)
925925 g_object_ref(menu->id);
926926
927- /* Workaround for a spurious gtk warning in Ubuntu: "Trying to remove
928- * a child that doesn't believe we're its parent."
929- * Remove widget from gui.menubar before destroying it. */
927+ // Workaround for a spurious gtk warning in Ubuntu: "Trying to remove
928+ // a child that doesn't believe we're its parent."
929+ // Remove widget from gui.menubar before destroying it.
930930 if (menu->id != NULL && gui.menubar != NULL
931931 && gtk_widget_get_parent(menu->id) == gui.menubar)
932932 gtk_container_remove(GTK_CONTAINER(gui.menubar), menu->id);
@@ -953,7 +953,7 @@
953953 gtk_widget_destroy(menu->id);
954954 }
955955 else
956-# endif /* FEAT_TOOLBAR */
956+# endif // FEAT_TOOLBAR
957957 {
958958 if (menu->submenu_id != NULL)
959959 gtk_widget_destroy(menu->submenu_id);
@@ -967,7 +967,7 @@
967967 menu->submenu_id = NULL;
968968 menu->id = NULL;
969969 }
970-#endif /* FEAT_MENU */
970+#endif // FEAT_MENU
971971
972972
973973 /*
@@ -1019,7 +1019,7 @@
10191019 int dragging = FALSE;
10201020
10211021 #ifdef FEAT_XIM
1022- /* cancel any preediting */
1022+ // cancel any preediting
10231023 if (im_is_preediting())
10241024 xim_reset();
10251025 #endif
@@ -1048,32 +1048,32 @@
10481048 int width;
10491049 int height;
10501050
1051- /* vertical scrollbar: need to set "dragging" properly in case
1052- * there are closed folds. */
1051+ // vertical scrollbar: need to set "dragging" properly in case
1052+ // there are closed folds.
10531053 gdk_window_get_pointer(sb->id->window, &x, &y, &state);
10541054 gdk_window_get_size(sb->id->window, &width, &height);
10551055 if (x >= 0 && x < width && y >= 0 && y < height)
10561056 {
10571057 if (y < width)
10581058 {
1059- /* up arrow: move one (closed fold) line up */
1059+ // up arrow: move one (closed fold) line up
10601060 dragging = FALSE;
10611061 value = sb->wp->w_topline - 2;
10621062 }
10631063 else if (y > height - width)
10641064 {
1065- /* down arrow: move one (closed fold) line down */
1065+ // down arrow: move one (closed fold) line down
10661066 dragging = FALSE;
10671067 value = sb->wp->w_topline;
10681068 }
10691069 }
10701070 }
10711071 }
1072-#endif /* !GTK_CHECK_VERSION(3,0,0) */
1072+#endif // !GTK_CHECK_VERSION(3,0,0)
10731073 gui_drag_scrollbar(sb, value, dragging);
10741074 }
10751075
1076-/* SBAR_VERT or SBAR_HORIZ */
1076+// SBAR_VERT or SBAR_HORIZ
10771077 void
10781078 gui_mch_create_scrollbar(scrollbar_T *sb, int orient)
10791079 {
@@ -1191,25 +1191,25 @@
11911191
11921192 title = CONVERT_TO_UTF8(title);
11931193
1194- /* GTK has a bug, it only works with an absolute path. */
1194+ // GTK has a bug, it only works with an absolute path.
11951195 if (initdir == NULL || *initdir == NUL)
11961196 mch_dirname(dirbuf, MAXPATHL);
11971197 else if (vim_FullName(initdir, dirbuf, MAXPATHL - 2, FALSE) == FAIL)
11981198 dirbuf[0] = NUL;
1199- /* Always need a trailing slash for a directory. */
1199+ // Always need a trailing slash for a directory.
12001200 add_pathsep(dirbuf);
12011201
1202- /* If our pointer is currently hidden, then we should show it. */
1202+ // If our pointer is currently hidden, then we should show it.
12031203 gui_mch_mousehide(FALSE);
12041204
1205- /* Hack: The GTK file dialog warns when it can't access a new file, this
1206- * makes it shut up. http://bugzilla.gnome.org/show_bug.cgi?id=664587 */
1205+ // Hack: The GTK file dialog warns when it can't access a new file, this
1206+ // makes it shut up. http://bugzilla.gnome.org/show_bug.cgi?id=664587
12071207 log_handler = g_log_set_handler(domain, G_LOG_LEVEL_WARNING,
12081208 recent_func_log_func, NULL);
12091209
12101210 #ifdef USE_FILE_CHOOSER
1211- /* We create the dialog each time, so that the button text can be "Open"
1212- * or "Save" according to the action. */
1211+ // We create the dialog each time, so that the button text can be "Open"
1212+ // or "Save" according to the action.
12131213 fc = gtk_file_chooser_dialog_new((const gchar *)title,
12141214 GTK_WINDOW(gui.mainwin),
12151215 saving ? GTK_FILE_CHOOSER_ACTION_SAVE
@@ -1278,11 +1278,11 @@
12781278 }
12791279 gtk_widget_destroy(GTK_WIDGET(fc));
12801280
1281-#else /* !USE_FILE_CHOOSER */
1281+#else // !USE_FILE_CHOOSER
12821282
12831283 if (gui.filedlg == NULL)
12841284 {
1285- GtkFileSelection *fs; /* shortcut */
1285+ GtkFileSelection *fs; // shortcut
12861286
12871287 gui.filedlg = gtk_file_selection_new((const gchar *)title);
12881288 gtk_window_set_modal(GTK_WINDOW(gui.filedlg), TRUE);
@@ -1296,7 +1296,7 @@
12961296 "clicked", GTK_SIGNAL_FUNC(browse_ok_cb), &gui);
12971297 gtk_signal_connect(GTK_OBJECT(fs->cancel_button),
12981298 "clicked", GTK_SIGNAL_FUNC(browse_cancel_cb), &gui);
1299- /* gtk_signal_connect() doesn't work for destroy, it causes a hang */
1299+ // gtk_signal_connect() doesn't work for destroy, it causes a hang
13001300 gtk_signal_connect_object(GTK_OBJECT(gui.filedlg),
13011301 "destroy", GTK_SIGNAL_FUNC(browse_destroy_cb),
13021302 GTK_OBJECT(gui.filedlg));
@@ -1304,7 +1304,7 @@
13041304 else
13051305 gtk_window_set_title(GTK_WINDOW(gui.filedlg), (const gchar *)title);
13061306
1307- /* Concatenate "initdir" and "dflt". */
1307+ // Concatenate "initdir" and "dflt".
13081308 if (dflt != NULL && *dflt != NUL
13091309 && STRLEN(dirbuf) + 2 + STRLEN(dflt) < MAXPATHL)
13101310 STRCAT(dirbuf, dflt);
@@ -1314,14 +1314,14 @@
13141314
13151315 gtk_widget_show(gui.filedlg);
13161316 gtk_main();
1317-#endif /* !USE_FILE_CHOOSER */
1317+#endif // !USE_FILE_CHOOSER
13181318 g_log_remove_handler(domain, log_handler);
13191319
13201320 CONVERT_TO_UTF8_FREE(title);
13211321 if (gui.browse_fname == NULL)
13221322 return NULL;
13231323
1324- /* shorten the file name if possible */
1324+ // shorten the file name if possible
13251325 return vim_strsave(shorten_fname1(gui.browse_fname));
13261326 }
13271327
@@ -1337,10 +1337,10 @@
13371337 char_u *title,
13381338 char_u *initdir)
13391339 {
1340-# if defined(GTK_FILE_CHOOSER) /* Only in GTK 2.4 and later. */
1340+# if defined(GTK_FILE_CHOOSER) // Only in GTK 2.4 and later.
13411341 char_u dirbuf[MAXPATHL];
13421342 char_u *p;
1343- GtkWidget *dirdlg; /* file selection dialog */
1343+ GtkWidget *dirdlg; // file selection dialog
13441344 char_u *dirname = NULL;
13451345
13461346 title = CONVERT_TO_UTF8(title);
@@ -1360,22 +1360,22 @@
13601360
13611361 CONVERT_TO_UTF8_FREE(title);
13621362
1363- /* if our pointer is currently hidden, then we should show it. */
1363+ // if our pointer is currently hidden, then we should show it.
13641364 gui_mch_mousehide(FALSE);
13651365
1366- /* GTK appears to insist on an absolute path. */
1366+ // GTK appears to insist on an absolute path.
13671367 if (initdir == NULL || *initdir == NUL
13681368 || vim_FullName(initdir, dirbuf, MAXPATHL - 10, FALSE) == FAIL)
13691369 mch_dirname(dirbuf, MAXPATHL - 10);
13701370
1371- /* Always need a trailing slash for a directory.
1372- * Also add a dummy file name, so that we get to the directory. */
1371+ // Always need a trailing slash for a directory.
1372+ // Also add a dummy file name, so that we get to the directory.
13731373 add_pathsep(dirbuf);
13741374 STRCAT(dirbuf, "@zd(*&1|");
13751375 gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dirdlg),
13761376 (const gchar *)dirbuf);
13771377
1378- /* Run the dialog. */
1378+ // Run the dialog.
13791379 if (gtk_dialog_run(GTK_DIALOG(dirdlg)) == GTK_RESPONSE_ACCEPT)
13801380 dirname = (char_u *)gtk_file_chooser_get_filename(
13811381 GTK_FILE_CHOOSER(dirdlg));
@@ -1383,19 +1383,19 @@
13831383 if (dirname == NULL)
13841384 return NULL;
13851385
1386- /* shorten the file name if possible */
1386+ // shorten the file name if possible
13871387 p = vim_strsave(shorten_fname1(dirname));
13881388 g_free(dirname);
13891389 return p;
13901390
1391-# else /* !defined(GTK_FILE_CHOOSER) */
1392- /* For GTK 2.2 and earlier: fall back to ordinary file selector. */
1391+# else // !defined(GTK_FILE_CHOOSER)
1392+ // For GTK 2.2 and earlier: fall back to ordinary file selector.
13931393 return gui_mch_browse(0, title, NULL, NULL, initdir, NULL);
1394-# endif /* !defined(GTK_FILE_CHOOSER) */
1394+# endif // !defined(GTK_FILE_CHOOSER)
13951395 }
13961396
13971397
1398-#endif /* FEAT_BROWSE */
1398+#endif // FEAT_BROWSE
13991399
14001400 #if defined(FEAT_GUI_DIALOG) || defined(PROTO)
14011401
@@ -1470,7 +1470,7 @@
14701470 else
14711471 MB_PTR_ADV(p);
14721472 }
1473- array[count] = NULL; /* currently not relied upon, but doesn't hurt */
1473+ array[count] = NULL; // currently not relied upon, but doesn't hurt
14741474 }
14751475
14761476 *n_buttons = count;
@@ -1546,22 +1546,22 @@
15461546 dialog_add_buttons(GtkDialog *dialog, char_u *button_string)
15471547 {
15481548 char **ok;
1549- char **ync; /* "yes no cancel" */
1549+ char **ync; // "yes no cancel"
15501550 char **buttons;
15511551 int n_buttons = 0;
15521552 int idx;
15531553
1554- button_string = vim_strsave(button_string); /* must be writable */
1554+ button_string = vim_strsave(button_string); // must be writable
15551555 if (button_string == NULL)
15561556 return;
15571557
1558- /* Check 'v' flag in 'guioptions': vertical button placement. */
1558+ // Check 'v' flag in 'guioptions': vertical button placement.
15591559 if (vim_strchr(p_go, GO_VERTICAL) != NULL)
15601560 {
15611561 # if GTK_CHECK_VERSION(3,0,0)
1562- /* Add GTK+ 3 code if necessary. */
1563- /* N.B. GTK+ 3 doesn't allow you to access vbox and action_area via
1564- * the C API. */
1562+ // Add GTK+ 3 code if necessary.
1563+ // N.B. GTK+ 3 doesn't allow you to access vbox and action_area via
1564+ // the C API.
15651565 # else
15661566 GtkWidget *vbutton_box;
15671567
@@ -1569,7 +1569,7 @@
15691569 gtk_widget_show(vbutton_box);
15701570 gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->vbox),
15711571 vbutton_box, TRUE, FALSE, 0);
1572- /* Overrule the "action_area" value, hopefully this works... */
1572+ // Overrule the "action_area" value, hopefully this works...
15731573 GTK_DIALOG(dialog)->action_area = vbutton_box;
15741574 # endif
15751575 }
@@ -1604,7 +1604,7 @@
16041604 * since anyone can create their own dialogs using Vim functions.
16051605 * Thus we have to check for those too.
16061606 */
1607- if (ok != NULL && ync != NULL) /* almost impossible to fail */
1607+ if (ok != NULL && ync != NULL) // almost impossible to fail
16081608 {
16091609 # if GTK_CHECK_VERSION(3,10,0)
16101610 if (button_equal(label, ok[0])) label = _("OK");
@@ -1649,9 +1649,9 @@
16491649 */
16501650 typedef struct _DialogInfo
16511651 {
1652- int ignore_enter; /* no default button, ignore "Enter" */
1653- int noalt; /* accept accelerators without Alt */
1654- GtkDialog *dialog; /* Widget of the dialog */
1652+ int ignore_enter; // no default button, ignore "Enter"
1653+ int noalt; // accept accelerators without Alt
1654+ GtkDialog *dialog; // Widget of the dialog
16551655 } DialogInfo;
16561656
16571657 static gboolean
@@ -1659,14 +1659,14 @@
16591659 {
16601660 DialogInfo *di = (DialogInfo *)data;
16611661
1662- /* Ignore hitting Enter (or Space) when there is no default button. */
1662+ // Ignore hitting Enter (or Space) when there is no default button.
16631663 if (di->ignore_enter && (event->keyval == GDK_Return
16641664 || event->keyval == ' '))
16651665 return TRUE;
1666- else /* A different key was pressed, return to normal behavior */
1666+ else // A different key was pressed, return to normal behavior
16671667 di->ignore_enter = FALSE;
16681668
1669- /* Close the dialog when hitting "Esc". */
1669+ // Close the dialog when hitting "Esc".
16701670 if (event->keyval == GDK_Escape)
16711671 {
16721672 gtk_dialog_response(di->dialog, GTK_RESPONSE_REJECT);
@@ -1681,16 +1681,16 @@
16811681 gtk_window_get_mnemonic_modifier(GTK_WINDOW(widget)));
16821682 }
16831683
1684- return FALSE; /* continue emission */
1684+ return FALSE; // continue emission
16851685 }
16861686
16871687 int
1688-gui_mch_dialog(int type, /* type of dialog */
1689- char_u *title, /* title of dialog */
1690- char_u *message, /* message text */
1691- char_u *buttons, /* names of buttons */
1692- int def_but, /* default button */
1693- char_u *textfield, /* text for textfield or NULL */
1688+gui_mch_dialog(int type, // type of dialog
1689+ char_u *title, // title of dialog
1690+ char_u *message, // message text
1691+ char_u *buttons, // names of buttons
1692+ int def_but, // default button
1693+ char_u *textfield, // text for textfield or NULL
16941694 int ex_cmd UNUSED)
16951695 {
16961696 GtkWidget *dialog;
@@ -1710,7 +1710,7 @@
17101710 entry = gtk_entry_new();
17111711 gtk_widget_show(entry);
17121712
1713- /* Make Enter work like pressing OK. */
1713+ // Make Enter work like pressing OK.
17141714 gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE);
17151715
17161716 text = CONVERT_TO_UTF8(textfield);
@@ -1748,8 +1748,8 @@
17481748 else
17491749 dialoginfo.noalt = TRUE;
17501750
1751- /* Allow activation of mnemonic accelerators without pressing <Alt> when
1752- * there is no textfield. Handle pressing Esc. */
1751+ // Allow activation of mnemonic accelerators without pressing <Alt> when
1752+ // there is no textfield. Handle pressing Esc.
17531753 g_signal_connect(G_OBJECT(dialog), "key-press-event",
17541754 G_CALLBACK(&dialog_key_press_event_cb), &dialoginfo);
17551755
@@ -1759,18 +1759,18 @@
17591759 dialoginfo.ignore_enter = FALSE;
17601760 }
17611761 else
1762- /* No default button, ignore pressing Enter. */
1762+ // No default button, ignore pressing Enter.
17631763 dialoginfo.ignore_enter = TRUE;
17641764
1765- /* Show the mouse pointer if it's currently hidden. */
1765+ // Show the mouse pointer if it's currently hidden.
17661766 gui_mch_mousehide(FALSE);
17671767
17681768 response = gtk_dialog_run(GTK_DIALOG(dialog));
17691769
1770- /* GTK_RESPONSE_NONE means the dialog was programmatically destroyed. */
1770+ // GTK_RESPONSE_NONE means the dialog was programmatically destroyed.
17711771 if (response != GTK_RESPONSE_NONE)
17721772 {
1773- if (response == GTK_RESPONSE_ACCEPT) /* Enter pressed */
1773+ if (response == GTK_RESPONSE_ACCEPT) // Enter pressed
17741774 response = def_but;
17751775 if (textfield != NULL)
17761776 {
@@ -1787,7 +1787,7 @@
17871787 return response > 0 ? response : 0;
17881788 }
17891789
1790-#endif /* FEAT_GUI_DIALOG */
1790+#endif // FEAT_GUI_DIALOG
17911791
17921792
17931793 #if defined(FEAT_MENU) || defined(PROTO)
@@ -1828,16 +1828,16 @@
18281828 "vim-has-im-menu", GINT_TO_POINTER(TRUE));
18291829 }
18301830 # endif
1831-# endif /* FEAT_XIM */
1831+# endif // FEAT_XIM
18321832
18331833 # if GTK_CHECK_VERSION(3,22,2)
18341834 {
18351835 GdkEventButton trigger;
18361836
1837- /* A pseudo event to have gtk_menu_popup_at_pointer() work. Since the
1838- * function calculates the popup menu position on the basis of the
1839- * actual pointer position when it is invoked, the fields x, y, x_root
1840- * and y_root are set to zero for convenience. */
1837+ // A pseudo event to have gtk_menu_popup_at_pointer() work. Since the
1838+ // function calculates the popup menu position on the basis of the
1839+ // actual pointer position when it is invoked, the fields x, y, x_root
1840+ // and y_root are set to zero for convenience.
18411841 trigger.type = GDK_BUTTON_PRESS;
18421842 trigger.window = gtk_widget_get_window(gui.drawarea);
18431843 trigger.send_event = FALSE;
@@ -1862,8 +1862,8 @@
18621862 #endif
18631863 }
18641864
1865-/* Ugly global variable to pass "mouse_pos" flag from gui_make_popup() to
1866- * popup_menu_position_func(). */
1865+// Ugly global variable to pass "mouse_pos" flag from gui_make_popup() to
1866+// popup_menu_position_func().
18671867 static int popup_mouse_pos;
18681868
18691869 /*
@@ -1892,7 +1892,7 @@
18921892 else if (curwin != NULL && gui.drawarea != NULL &&
18931893 gtk_widget_get_window(gui.drawarea) != NULL)
18941894 {
1895- /* Find the cursor position in the current window */
1895+ // Find the cursor position in the current window
18961896 *x += FILL_X(curwin->w_wincol + curwin->w_wcol + 1) + 1;
18971897 *y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1;
18981898 }
@@ -1913,11 +1913,11 @@
19131913 GdkWindow * const win = gtk_widget_get_window(gui.drawarea);
19141914 GdkEventButton trigger;
19151915
1916- /* A pseudo event to have gtk_menu_popup_at_*() functions work. Since
1917- * the position where the menu pops up is automatically adjusted by
1918- * the functions, none of the fields x, y, x_root and y_root has to be
1919- * set to a specific value here; therefore, they are set to zero for
1920- * convenience.*/
1916+ // A pseudo event to have gtk_menu_popup_at_*() functions work. Since
1917+ // the position where the menu pops up is automatically adjusted by
1918+ // the functions, none of the fields x, y, x_root and y_root has to be
1919+ // set to a specific value here; therefore, they are set to zero for
1920+ // convenience.
19211921 trigger.type = GDK_BUTTON_PRESS;
19221922 trigger.window = win;
19231923 trigger.send_event = FALSE;
@@ -1961,7 +1961,7 @@
19611961 }
19621962 }
19631963
1964-#endif /* FEAT_MENU */
1964+#endif // FEAT_MENU
19651965
19661966
19671967 /*
@@ -1970,16 +1970,16 @@
19701970
19711971 typedef struct _SharedFindReplace
19721972 {
1973- GtkWidget *dialog; /* the main dialog widget */
1974- GtkWidget *wword; /* 'Whole word only' check button */
1975- GtkWidget *mcase; /* 'Match case' check button */
1976- GtkWidget *up; /* search direction 'Up' radio button */
1977- GtkWidget *down; /* search direction 'Down' radio button */
1978- GtkWidget *what; /* 'Find what' entry text widget */
1979- GtkWidget *with; /* 'Replace with' entry text widget */
1980- GtkWidget *find; /* 'Find Next' action button */
1981- GtkWidget *replace; /* 'Replace With' action button */
1982- GtkWidget *all; /* 'Replace All' action button */
1973+ GtkWidget *dialog; // the main dialog widget
1974+ GtkWidget *wword; // 'Whole word only' check button
1975+ GtkWidget *mcase; // 'Match case' check button
1976+ GtkWidget *up; // search direction 'Up' radio button
1977+ GtkWidget *down; // search direction 'Down' radio button
1978+ GtkWidget *what; // 'Find what' entry text widget
1979+ GtkWidget *with; // 'Replace with' entry text widget
1980+ GtkWidget *find; // 'Find Next' action button
1981+ GtkWidget *replace; // 'Replace With' action button
1982+ GtkWidget *all; // 'Replace All' action button
19831983 } SharedFindReplace;
19841984
19851985 static SharedFindReplace find_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL};
@@ -1991,13 +1991,12 @@
19911991 GdkEventKey *event,
19921992 SharedFindReplace *frdp)
19931993 {
1994- /* If the user is holding one of the key modifiers we will just bail out,
1995- * thus preserving the possibility of normal focus traversal.
1996- */
1994+ // If the user is holding one of the key modifiers we will just bail out,
1995+ // thus preserving the possibility of normal focus traversal.
19971996 if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK))
19981997 return FALSE;
19991998
2000- /* the Escape key synthesizes a cancellation action */
1999+ // the Escape key synthesizes a cancellation action
20012000 if (event->keyval == GDK_Escape)
20022001 {
20032002 gtk_widget_hide(frdp->dialog);
@@ -2005,9 +2004,8 @@
20052004 return TRUE;
20062005 }
20072006
2008- /* It would be delightful if it where possible to do search history
2009- * operations on the K_UP and K_DOWN keys here.
2010- */
2007+ // It would be delightful if it where possible to do search history
2008+ // operations on the K_UP and K_DOWN keys here.
20112009
20122010 return FALSE;
20132011 }
@@ -2093,23 +2091,21 @@
20932091 g_return_val_if_fail(GTK_IS_ENTRY(entry) == TRUE, 0);
20942092
20952093 #if GTK_CHECK_VERSION(2,18,0)
2096- /* 2.18 introduced a new object GtkEntryBuffer to handle text data for
2097- * GtkEntry instead of letting each instance of the latter have its own
2098- * storage for that. The code below is almost identical to the
2099- * implementation of gtk_entry_get_text_length() for the versions >= 2.18.
2100- */
2094+ // 2.18 introduced a new object GtkEntryBuffer to handle text data for
2095+ // GtkEntry instead of letting each instance of the latter have its own
2096+ // storage for that. The code below is almost identical to the
2097+ // implementation of gtk_entry_get_text_length() for the versions >= 2.18.
21012098 return gtk_entry_buffer_get_length(gtk_entry_get_buffer(entry));
21022099 #elif GTK_CHECK_VERSION(2,14,0)
2103- /* 2.14 introduced a new function to avoid memory management bugs which can
2104- * happen when gtk_entry_get_text() is used without due care and attention.
2105- */
2100+ // 2.14 introduced a new function to avoid memory management bugs which can
2101+ // happen when gtk_entry_get_text() is used without due care and attention.
21062102 return gtk_entry_get_text_length(entry);
21072103 #else
2108- /* gtk_entry_get_text() returns the pointer to the storage allocated
2109- * internally by the widget. Accordingly, use the one with great care:
2110- * Don't free it nor modify the contents it points to; call the function
2111- * every time you need the pointer since its value may have been changed
2112- * by the widget. */
2104+ // gtk_entry_get_text() returns the pointer to the storage allocated
2105+ // internally by the widget. Accordingly, use the one with great care:
2106+ // Don't free it nor modify the contents it points to; call the function
2107+ // every time you need the pointer since its value may have been changed
2108+ // by the widget.
21132109 return g_utf8_strlen(gtk_entry_get_text(entry), -1);
21142110 #endif
21152111 }
@@ -2117,7 +2113,7 @@
21172113 static void
21182114 find_replace_dialog_create(char_u *arg, int do_replace)
21192115 {
2120- GtkWidget *hbox; /* main top down box */
2116+ GtkWidget *hbox; // main top down box
21212117 GtkWidget *actionarea;
21222118 GtkWidget *table;
21232119 GtkWidget *tmp;
@@ -2132,7 +2128,7 @@
21322128
21332129 frdp = (do_replace) ? (&repl_widgets) : (&find_widgets);
21342130
2135- /* Get the search string to use. */
2131+ // Get the search string to use.
21362132 entry_text = get_find_dialog_text(arg, &wword, &mcase);
21372133
21382134 if (entry_text != NULL && output_conv.vc_type != CONV_NONE)
@@ -2157,9 +2153,9 @@
21572153 }
21582154 gtk_window_present(GTK_WINDOW(frdp->dialog));
21592155
2160- /* For :promptfind dialog, always give keyboard focus to 'what' entry.
2161- * For :promptrepl dialog, give it to 'with' entry if 'what' has an
2162- * non-empty entry; otherwise, to 'what' entry. */
2156+ // For :promptfind dialog, always give keyboard focus to 'what' entry.
2157+ // For :promptrepl dialog, give it to 'with' entry if 'what' has an
2158+ // non-empty entry; otherwise, to 'what' entry.
21632159 gtk_widget_grab_focus(frdp->what);
21642160 if (do_replace && entry_get_text_length(GTK_ENTRY(frdp->what)) > 0)
21652161 gtk_widget_grab_focus(frdp->with);
@@ -2170,7 +2166,7 @@
21702166
21712167 frdp->dialog = gtk_dialog_new();
21722168 #if GTK_CHECK_VERSION(3,0,0)
2173- /* Nothing equivalent to gtk_dialog_set_has_separator() in GTK+ 3. */
2169+ // Nothing equivalent to gtk_dialog_set_has_separator() in GTK+ 3.
21742170 #else
21752171 gtk_dialog_set_has_separator(GTK_DIALOG(frdp->dialog), FALSE);
21762172 #endif
@@ -2323,7 +2319,7 @@
23232319 GINT_TO_POINTER(FRD_FINDNEXT));
23242320 }
23252321
2326- /* whole word only button */
2322+ // whole word only button
23272323 frdp->wword = gtk_check_button_new_with_label(CONV(_("Match whole word only")));
23282324 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->wword),
23292325 (gboolean)wword);
@@ -2342,7 +2338,7 @@
23422338 GTK_FILL, GTK_EXPAND, 2, 2);
23432339 #endif
23442340
2345- /* match case button */
2341+ // match case button
23462342 frdp->mcase = gtk_check_button_new_with_label(CONV(_("Match case")));
23472343 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->mcase),
23482344 (gboolean)mcase);
@@ -2385,7 +2381,7 @@
23852381 gtk_container_set_border_width(GTK_CONTAINER(vbox), 0);
23862382 gtk_container_add(GTK_CONTAINER(tmp), vbox);
23872383
2388- /* 'Up' and 'Down' buttons */
2384+ // 'Up' and 'Down' buttons
23892385 frdp->up = gtk_radio_button_new_with_label(NULL, CONV(_("Up")));
23902386 gtk_box_pack_start(GTK_BOX(vbox), frdp->up, TRUE, TRUE, 0);
23912387 frdp->down = gtk_radio_button_new_with_label(
@@ -2395,7 +2391,7 @@
23952391 gtk_container_set_border_width(GTK_CONTAINER(vbox), 2);
23962392 gtk_box_pack_start(GTK_BOX(vbox), frdp->down, TRUE, TRUE, 0);
23972393
2398- /* vbox to hold the action buttons */
2394+ // vbox to hold the action buttons
23992395 #if GTK_CHECK_VERSION(3,2,0)
24002396 actionarea = gtk_button_box_new(GTK_ORIENTATION_VERTICAL);
24012397 #else
@@ -2404,7 +2400,7 @@
24042400 gtk_container_set_border_width(GTK_CONTAINER(actionarea), 2);
24052401 gtk_box_pack_end(GTK_BOX(hbox), actionarea, FALSE, FALSE, 0);
24062402
2407- /* 'Find Next' button */
2403+ // 'Find Next' button
24082404 #if GTK_CHECK_VERSION(3,10,0)
24092405 frdp->find = create_image_button(NULL, _("Find Next"));
24102406 #else
@@ -2423,7 +2419,7 @@
24232419
24242420 if (do_replace)
24252421 {
2426- /* 'Replace' button */
2422+ // 'Replace' button
24272423 #if GTK_CHECK_VERSION(3,10,0)
24282424 frdp->replace = create_image_button(NULL, _("Replace"));
24292425 #else
@@ -2436,7 +2432,7 @@
24362432 G_CALLBACK(find_replace_cb),
24372433 GINT_TO_POINTER(FRD_REPLACE));
24382434
2439- /* 'Replace All' button */
2435+ // 'Replace All' button
24402436 #if GTK_CHECK_VERSION(3,10,0)
24412437 frdp->all = create_image_button(NULL, _("Replace All"));
24422438 #else
@@ -2450,7 +2446,7 @@
24502446 GINT_TO_POINTER(FRD_REPLACEALL));
24512447 }
24522448
2453- /* 'Cancel' button */
2449+ // 'Cancel' button
24542450 #if GTK_CHECK_VERSION(3,10,0)
24552451 tmp = gtk_button_new_with_mnemonic(_("_Close"));
24562452 #else
@@ -2472,7 +2468,7 @@
24722468 #endif
24732469 gtk_box_pack_end(GTK_BOX(hbox), tmp, FALSE, FALSE, 10);
24742470
2475- /* Suppress automatic show of the unused action area */
2471+ // Suppress automatic show of the unused action area
24762472 #if GTK_CHECK_VERSION(3,0,0)
24772473 # if !GTK_CHECK_VERSION(3,12,0)
24782474 gtk_widget_hide(gtk_dialog_get_action_area(GTK_DIALOG(frdp->dialog)));
@@ -2514,9 +2510,9 @@
25142510 gboolean direction_down;
25152511 SharedFindReplace *sfr;
25162512
2517- flags = (int)(long)data; /* avoid a lint warning here */
2513+ flags = (int)(long)data; // avoid a lint warning here
25182514
2519- /* Get the search/replace strings from the dialog */
2515+ // Get the search/replace strings from the dialog
25202516 if (flags == FRD_FINDNEXT)
25212517 {
25222518 repl_text = NULL;
@@ -2543,7 +2539,9 @@
25432539 CONVERT_FROM_UTF8_FREE(find_text);
25442540 }
25452541
2546-/* our usual callback function */
2542+/*
2543+ * our usual callback function
2544+ */
25472545 static void
25482546 entry_activate_cb(GtkWidget *widget UNUSED, gpointer data)
25492547 {
@@ -2568,7 +2566,7 @@
25682566 entry_text = gtk_entry_get_text(GTK_ENTRY(entry));
25692567
25702568 if (!entry_text)
2571- return; /* shouldn't happen */
2569+ return; // shouldn't happen
25722570
25732571 nonempty = (entry_text[0] != '\0');
25742572
@@ -2589,8 +2587,8 @@
25892587 void
25902588 ex_helpfind(exarg_T *eap UNUSED)
25912589 {
2592- /* This will fail when menus are not loaded. Well, it's only for
2593- * backwards compatibility anyway. */
2590+ // This will fail when menus are not loaded. Well, it's only for
2591+ // backwards compatibility anyway.
25942592 do_cmdline_cmd((char_u *)"emenu ToolBar.FindHelp");
25952593 }
25962594
@@ -2601,7 +2599,7 @@
26012599 const gchar *message UNUSED,
26022600 gpointer user_data UNUSED)
26032601 {
2604- /* We just want to suppress the warnings. */
2605- /* http://bugzilla.gnome.org/show_bug.cgi?id=664587 */
2602+ // We just want to suppress the warnings.
2603+ // http://bugzilla.gnome.org/show_bug.cgi?id=664587
26062604 }
26072605 #endif
diff -r 04ce3b8a50ed -r 79e10adc821d src/gui_gtk_f.c
--- a/src/gui_gtk_f.c Sun Dec 01 21:45:05 2019 +0100
+++ b/src/gui_gtk_f.c Sun Dec 01 22:15:03 2019 +0100
@@ -26,8 +26,8 @@
2626 */
2727
2828 #include "vim.h"
29-#include <gtk/gtk.h> /* without this it compiles, but gives errors at
30- runtime! */
29+#include <gtk/gtk.h> // without this it compiles, but gives errors at
30+ // runtime!
3131 #include "gui_gtk_f.h"
3232 #if !GTK_CHECK_VERSION(3,0,0)
3333 # include <gtk/gtksignal.h>
@@ -44,8 +44,8 @@
4444 {
4545 GtkWidget *widget;
4646 GdkWindow *window;
47- gint x; /* relative subwidget x position */
48- gint y; /* relative subwidget y position */
47+ gint x; // relative subwidget x position
48+ gint y; // relative subwidget y position
4949 gint mapped;
5050 };
5151
@@ -101,8 +101,7 @@
101101 static GtkWidgetClass *parent_class = NULL;
102102 #endif
103103
104-/* Public interface
105- */
104+// Public interface
106105
107106 GtkWidget *
108107 gtk_form_new(void)
@@ -128,7 +127,7 @@
128127
129128 g_return_if_fail(GTK_IS_FORM(form));
130129
131- /* LINTED: avoid warning: conversion to 'unsigned long' */
130+ // LINTED: avoid warning: conversion to 'unsigned long'
132131 child = g_new(GtkFormChild, 1);
133132 if (child == NULL)
134133 return;
@@ -147,11 +146,10 @@
147146
148147 form->children = g_list_append(form->children, child);
149148
150- /* child->window must be created and attached to the widget _before_
151- * it has been realized, or else things will break with GTK2. Note
152- * that gtk_widget_set_parent() realizes the widget if it's visible
153- * and its parent is mapped.
154- */
149+ // child->window must be created and attached to the widget _before_
150+ // it has been realized, or else things will break with GTK2. Note
151+ // that gtk_widget_set_parent() realizes the widget if it's visible
152+ // and its parent is mapped.
155153 if (gtk_widget_get_realized(GTK_WIDGET(form)))
156154 gtk_form_attach_child_window(form, child);
157155
@@ -212,8 +210,7 @@
212210 }
213211 }
214212
215-/* Basic Object handling procedures
216- */
213+// Basic Object handling procedures
217214 #if GTK_CHECK_VERSION(3,0,0)
218215 G_DEFINE_TYPE(GtkForm, gtk_form, GTK_TYPE_CONTAINER)
219216 #else
@@ -237,7 +234,7 @@
237234 }
238235 return form_type;
239236 }
240-#endif /* !GTK_CHECK_VERSION(3,0,0) */
237+#endif // !GTK_CHECK_VERSION(3,0,0)
241238
242239 static void
243240 gtk_form_class_init(GtkFormClass *klass)
@@ -364,14 +361,13 @@
364361 }
365362
366363
367-/* After reading the documentation at
368- * http://developer.gnome.org/doc/API/2.0/gtk/gtk-changes-2-0.html
369- * I think it should be possible to remove this function when compiling
370- * against gtk-2.0. It doesn't seem to cause problems, though.
371- *
372- * Well, I reckon at least the gdk_window_show(form->bin_window)
373- * is necessary. GtkForm is anything but a usual container widget.
374- */
364+// After reading the documentation at
365+// http://developer.gnome.org/doc/API/2.0/gtk/gtk-changes-2-0.html
366+// I think it should be possible to remove this function when compiling
367+// against gtk-2.0. It doesn't seem to cause problems, though.
368+//
369+// Well, I reckon at least the gdk_window_show(form->bin_window)
370+// is necessary. GtkForm is anything but a usual container widget.
375371 static void
376372 gtk_form_map(GtkWidget *widget)
377373 {
@@ -480,7 +476,7 @@
480476 *minimal_height = requisition.height;
481477 *natural_height = requisition.height;
482478 }
483-#endif /* GTK_CHECK_VERSION(3,0,0) */
479+#endif // GTK_CHECK_VERSION(3,0,0)
484480
485481 static void
486482 gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation)
@@ -559,16 +555,16 @@
559555 if (!gtk_widget_get_has_window(formchild->widget) &&
560556 gtk_cairo_should_draw_window(cr, formchild->window))
561557 {
562- /* To get gtk_widget_draw() to work, it is required to call
563- * gtk_widget_size_allocate() in advance with a well-posed
564- * allocation for a given child widget in order to set a
565- * certain private GtkWidget variable, called
566- * widget->priv->alloc_need, to the proper value; otherwise,
567- * gtk_widget_draw() fails and the relevant scrollbar won't
568- * appear on the screen.
569- *
570- * Calling gtk_form_position_child() like this is one of ways
571- * to make sure of that. */
558+ // To get gtk_widget_draw() to work, it is required to call
559+ // gtk_widget_size_allocate() in advance with a well-posed
560+ // allocation for a given child widget in order to set a
561+ // certain private GtkWidget variable, called
562+ // widget->priv->alloc_need, to the proper value; otherwise,
563+ // gtk_widget_draw() fails and the relevant scrollbar won't
564+ // appear on the screen.
565+ //
566+ // Calling gtk_form_position_child() like this is one of ways
567+ // to make sure of that.
572568 gtk_form_position_child(form, formchild, TRUE);
573569
574570 gtk_form_render_background(formchild->widget, cr);
@@ -577,7 +573,7 @@
577573
578574 return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr);
579575 }
580-#else /* !GTK_CHECK_VERSION(3,0,0) */
576+#else // !GTK_CHECK_VERSION(3,0,0)
581577 static gint
582578 gtk_form_expose(GtkWidget *widget, GdkEventExpose *event)
583579 {
@@ -598,16 +594,15 @@
598594
599595 return FALSE;
600596 }
601-#endif /* !GTK_CHECK_VERSION(3,0,0) */
597+#endif // !GTK_CHECK_VERSION(3,0,0)
602598
603-/* Container method
604- */
599+// Container method
605600 static void
606601 gtk_form_remove(GtkContainer *container, GtkWidget *widget)
607602 {
608603 GList *tmp_list;
609604 GtkForm *form;
610- GtkFormChild *child = NULL; /* init for gcc */
605+ GtkFormChild *child = NULL; // init for gcc
611606
612607 g_return_if_fail(GTK_IS_FORM(container));
613608
@@ -634,9 +629,8 @@
634629 g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget),
635630 FUNC2GENERIC(&gtk_form_child_unmap), child);
636631
637- /* FIXME: This will cause problems for reparenting NO_WINDOW
638- * widgets out of a GtkForm
639- */
632+ // FIXME: This will cause problems for reparenting NO_WINDOW
633+ // widgets out of a GtkForm
640634 gdk_window_set_user_data(child->window, NULL);
641635 gdk_window_destroy(child->window);
642636 }
@@ -676,14 +670,13 @@
676670 }
677671 }
678672
679-/* Operations on children
680- */
673+// Operations on children
681674
682675 static void
683676 gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child)
684677 {
685678 if (child->window != NULL)
686- return; /* been there, done that */
679+ return; // been there, done that
687680
688681 if (!gtk_widget_get_has_window(child->widget))
689682 {
diff -r 04ce3b8a50ed -r 79e10adc821d src/gui_gtk_x11.c
--- a/src/gui_gtk_x11.c Sun Dec 01 21:45:05 2019 +0100
+++ b/src/gui_gtk_x11.c Sun Dec 01 22:15:03 2019 +0100
@@ -31,7 +31,7 @@
3131 #endif
3232
3333 #ifdef FEAT_GUI_GNOME
34-/* Gnome redefines _() and N_(). Grrr... */
34+// Gnome redefines _() and N_(). Grrr...
3535 # ifdef _
3636 # undef _
3737 # endif
@@ -48,16 +48,16 @@
4848 # undef bind_textdomain_codeset
4949 # endif
5050 # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS)
51-# define ENABLE_NLS /* so the texts in the dialog boxes are translated */
51+# define ENABLE_NLS // so the texts in the dialog boxes are translated
5252 # endif
5353 # include <gnome.h>
5454 # include "version.h"
55-/* missing prototype in bonobo-dock-item.h */
55+// missing prototype in bonobo-dock-item.h
5656 extern void bonobo_dock_item_set_behavior(BonoboDockItem *dock_item, BonoboDockItemBehavior beh);
5757 #endif
5858
5959 #if !defined(FEAT_GUI_GTK) && defined(PROTO)
60-/* When generating prototypes we don't want syntax errors. */
60+// When generating prototypes we don't want syntax errors.
6161 # define GdkAtom int
6262 # define GdkEventExpose int
6363 # define GdkEventFocus int
@@ -105,7 +105,7 @@
105105 #define GET_X_ATOM(atom) gdk_x11_atom_to_xatom_for_display( \
106106 gtk_widget_get_display(gui.mainwin), atom)
107107
108-/* Selection type distinguishers */
108+// Selection type distinguishers
109109 enum
110110 {
111111 TARGET_TYPE_NONE,
@@ -177,8 +177,8 @@
177177 */
178178 static GdkAtom html_atom = GDK_NONE;
179179 static GdkAtom utf8_string_atom = GDK_NONE;
180-static GdkAtom vim_atom = GDK_NONE; /* Vim's own special selection format */
181-static GdkAtom vimenc_atom = GDK_NONE; /* Vim's extended selection format */
180+static GdkAtom vim_atom = GDK_NONE; // Vim's own special selection format
181+static GdkAtom vimenc_atom = GDK_NONE; // Vim's extended selection format
182182
183183 /*
184184 * Keycodes recognized by vim.
@@ -218,7 +218,7 @@
218218 {GDK_F19, 'F', '9'},
219219 {GDK_F20, 'F', 'A'},
220220 {GDK_F21, 'F', 'B'},
221- {GDK_Pause, 'F', 'B'}, /* Pause == F21 according to netbeans.txt */
221+ {GDK_Pause, 'F', 'B'}, // Pause == F21 according to netbeans.txt
222222 {GDK_F22, 'F', 'C'},
223223 {GDK_F23, 'F', 'D'},
224224 {GDK_F24, 'F', 'E'},
@@ -249,7 +249,7 @@
249249 {GDK_Prior, 'k', 'P'},
250250 {GDK_Next, 'k', 'N'},
251251 {GDK_Print, '%', '9'},
252- /* Keypad keys: */
252+ // Keypad keys:
253253 {GDK_KP_Left, 'k', 'l'},
254254 {GDK_KP_Right, 'k', 'r'},
255255 {GDK_KP_Up, 'k', 'u'},
@@ -258,8 +258,8 @@
258258 {GDK_KP_Delete, KS_EXTRA, (char_u)KE_KDEL},
259259 {GDK_KP_Home, 'K', '1'},
260260 {GDK_KP_End, 'K', '4'},
261- {GDK_KP_Prior, 'K', '3'}, /* page up */
262- {GDK_KP_Next, 'K', '5'}, /* page down */
261+ {GDK_KP_Prior, 'K', '3'}, // page up
262+ {GDK_KP_Next, 'K', '5'}, // page down
263263
264264 {GDK_KP_Add, 'K', '6'},
265265 {GDK_KP_Subtract, 'K', '7'},
@@ -279,7 +279,7 @@
279279 {GDK_KP_8, 'K', 'K'},
280280 {GDK_KP_9, 'K', 'L'},
281281
282- /* End of list marker: */
282+ // End of list marker:
283283 {0, 0, 0}
284284 };
285285
@@ -295,14 +295,14 @@
295295 #define ARG_ICONIC 7
296296 #define ARG_ROLE 8
297297 #define ARG_NETBEANS 9
298-#define ARG_XRM 10 /* ignored */
299-#define ARG_MENUFONT 11 /* ignored */
298+#define ARG_XRM 10 // ignored
299+#define ARG_MENUFONT 11 // ignored
300300 #define ARG_INDEX_MASK 0x00ff
301-#define ARG_HAS_VALUE 0x0100 /* a value is expected after the argument */
302-#define ARG_NEEDS_GUI 0x0200 /* need to initialize the GUI for this */
303-#define ARG_FOR_GTK 0x0400 /* argument is handled by GTK+ or GNOME */
304-#define ARG_COMPAT_LONG 0x0800 /* accept -foo but substitute with --foo */
305-#define ARG_KEEP 0x1000 /* don't remove argument from argv[] */
301+#define ARG_HAS_VALUE 0x0100 // a value is expected after the argument
302+#define ARG_NEEDS_GUI 0x0200 // need to initialize the GUI for this
303+#define ARG_FOR_GTK 0x0400 // argument is handled by GTK+ or GNOME
304+#define ARG_COMPAT_LONG 0x0800 // accept -foo but substitute with --foo
305+#define ARG_KEEP 0x1000 // don't remove argument from argv[]
306306
307307 /*
308308 * This table holds all the X GUI command line options allowed. This includes
@@ -320,7 +320,7 @@
320320
321321 static const cmdline_option_T cmdline_options[] =
322322 {
323- /* We handle these options ourselves */
323+ // We handle these options ourselves
324324 {"-fn", ARG_FONT|ARG_HAS_VALUE},
325325 {"-font", ARG_FONT|ARG_HAS_VALUE},
326326 {"-geom", ARG_GEOMETRY|ARG_HAS_VALUE},
@@ -336,12 +336,12 @@
336336 {"-iconic", ARG_ICONIC},
337337 {"--role", ARG_ROLE|ARG_HAS_VALUE},
338338 #ifdef FEAT_NETBEANS_INTG
339- {"-nb", ARG_NETBEANS}, /* non-standard value format */
340- {"-xrm", ARG_XRM|ARG_HAS_VALUE}, /* not implemented */
341- {"-mf", ARG_MENUFONT|ARG_HAS_VALUE}, /* not implemented */
342- {"-menufont", ARG_MENUFONT|ARG_HAS_VALUE}, /* not implemented */
339+ {"-nb", ARG_NETBEANS}, // non-standard value format
340+ {"-xrm", ARG_XRM|ARG_HAS_VALUE}, // not implemented
341+ {"-mf", ARG_MENUFONT|ARG_HAS_VALUE}, // not implemented
342+ {"-menufont", ARG_MENUFONT|ARG_HAS_VALUE}, // not implemented
343343 #endif
344- /* Arguments handled by GTK (and GNOME) internally. */
344+ // Arguments handled by GTK (and GNOME) internally.
345345 {"--g-fatal-warnings", ARG_FOR_GTK},
346346 {"--gdk-debug", ARG_FOR_GTK|ARG_HAS_VALUE},
347347 {"--gdk-no-debug", ARG_FOR_GTK|ARG_HAS_VALUE},
@@ -369,7 +369,7 @@
369369 {"-?", ARG_FOR_GTK|ARG_NEEDS_GUI},
370370 {"--help", ARG_FOR_GTK|ARG_NEEDS_GUI|ARG_KEEP},
371371 {"--usage", ARG_FOR_GTK|ARG_NEEDS_GUI},
372-# if 0 /* conflicts with Vim's own --version argument */
372+# if 0 // conflicts with Vim's own --version argument
373373 {"--version", ARG_FOR_GTK|ARG_NEEDS_GUI},
374374 # endif
375375 {"--disable-crash-dialog", ARG_FOR_GTK},
@@ -441,14 +441,14 @@
441441
442442 while (i < *argc)
443443 {
444- /* Don't waste CPU cycles on non-option arguments. */
444+ // Don't waste CPU cycles on non-option arguments.
445445 if (argv[i][0] != '-' && argv[i][0] != '+')
446446 {
447447 ++i;
448448 continue;
449449 }
450450
451- /* Look for argv[i] in cmdline_options[] table. */
451+ // Look for argv[i] in cmdline_options[] table.
452452 for (option = &cmdline_options[0]; option->name != NULL; ++option)
453453 {
454454 len = strlen(option->name);
@@ -457,11 +457,11 @@
457457 {
458458 if (argv[i][len] == '\0')
459459 break;
460- /* allow --foo=bar style */
460+ // allow --foo=bar style
461461 if (argv[i][len] == '=' && (option->flags & ARG_HAS_VALUE))
462462 break;
463463 #ifdef FEAT_NETBEANS_INTG
464- /* darn, -nb has non-standard syntax */
464+ // darn, -nb has non-standard syntax
465465 if (vim_strchr((char_u *)":=", argv[i][len]) != NULL
466466 && (option->flags & ARG_INDEX_MASK) == ARG_NETBEANS)
467467 break;
@@ -470,13 +470,13 @@
470470 else if ((option->flags & ARG_COMPAT_LONG)
471471 && strcmp(argv[i], option->name + 1) == 0)
472472 {
473- /* Replace the standard X arguments "-name" and "-display"
474- * with their GNU-style long option counterparts. */
473+ // Replace the standard X arguments "-name" and "-display"
474+ // with their GNU-style long option counterparts.
475475 argv[i] = (char *)option->name;
476476 break;
477477 }
478478 }
479- if (option->name == NULL) /* no match */
479+ if (option->name == NULL) // no match
480480 {
481481 ++i;
482482 continue;
@@ -484,16 +484,16 @@
484484
485485 if (option->flags & ARG_FOR_GTK)
486486 {
487- /* Move the argument into gui_argv, which
488- * will later be passed to gtk_init_check() */
487+ // Move the argument into gui_argv, which
488+ // will later be passed to gtk_init_check()
489489 gui_argv[gui_argc++] = argv[i];
490490 }
491491 else
492492 {
493493 char *value = NULL;
494494
495- /* Extract the option's value if there is one.
496- * Accept both "--foo bar" and "--foo=bar" style. */
495+ // Extract the option's value if there is one.
496+ // Accept both "--foo bar" and "--foo=bar" style.
497497 if (option->flags & ARG_HAS_VALUE)
498498 {
499499 if (argv[i][len] == '=')
@@ -502,7 +502,7 @@
502502 value = argv[i + 1];
503503 }
504504
505- /* Check for options handled by Vim itself */
505+ // Check for options handled by Vim itself
506506 switch (option->flags & ARG_INDEX_MASK)
507507 {
508508 case ARG_REVERSE:
@@ -528,11 +528,11 @@
528528 found_iconic_arg = TRUE;
529529 break;
530530 case ARG_ROLE:
531- role_argument = value; /* used later in gui_mch_open() */
531+ role_argument = value; // used later in gui_mch_open()
532532 break;
533533 #ifdef FEAT_NETBEANS_INTG
534534 case ARG_NETBEANS:
535- gui.dofork = FALSE; /* don't fork() when starting GUI */
535+ gui.dofork = FALSE; // don't fork() when starting GUI
536536 netbeansArg = argv[i];
537537 break;
538538 #endif
@@ -541,9 +541,9 @@
541541 }
542542 }
543543
544- /* These arguments make gnome_program_init() print a message and exit.
545- * Must start the GUI for this, otherwise ":gui" will exit later!
546- * Only when the GUI can start. */
544+ // These arguments make gnome_program_init() print a message and exit.
545+ // Must start the GUI for this, otherwise ":gui" will exit later!
546+ // Only when the GUI can start.
547547 if ((option->flags & ARG_NEEDS_GUI)
548548 && gui_mch_early_init_check(FALSE) == OK)
549549 gui.starting = TRUE;
@@ -552,12 +552,12 @@
552552 ++i;
553553 else
554554 {
555- /* Remove the flag from the argument vector. */
555+ // Remove the flag from the argument vector.
556556 if (--*argc > i)
557557 {
558558 int n_strip = 1;
559559
560- /* Move the argument's value as well, if there is one. */
560+ // Move the argument's value as well, if there is one.
561561 if ((option->flags & ARG_HAS_VALUE)
562562 && argv[i][len] != '='
563563 && strcmp(argv[i + 1], "--") != 0)
@@ -612,7 +612,7 @@
612612 gui.visibility != GDK_VISIBILITY_UNOBSCURED);
613613 return FALSE;
614614 }
615-#endif /* !GTK_CHECK_VERSION(3,0,0) */
615+#endif // !GTK_CHECK_VERSION(3,0,0)
616616
617617 /*
618618 * Redraw the corresponding portions of the screen.
@@ -626,7 +626,7 @@
626626 static void
627627 gui_gtk3_redraw(int x, int y, int width, int height)
628628 {
629- /* Range checks are left to gui_redraw_block() */
629+ // Range checks are left to gui_redraw_block()
630630 gui_redraw_block(Y_2_ROW(y), X_2_COL(x),
631631 Y_2_ROW(y + height - 1), X_2_COL(x + width - 1),
632632 GUI_MON_NOCLEAR);
@@ -663,16 +663,16 @@
663663 cairo_t *cr,
664664 gpointer user_data UNUSED)
665665 {
666- /* Skip this when the GUI isn't set up yet, will redraw later. */
666+ // Skip this when the GUI isn't set up yet, will redraw later.
667667 if (gui.starting)
668668 return FALSE;
669669
670- out_flush(); /* make sure all output has been processed */
671- /* for GTK+ 3, may induce other draw events. */
670+ out_flush(); // make sure all output has been processed
671+ // for GTK+ 3, may induce other draw events.
672672
673673 cairo_set_source_surface(cr, gui.surface, 0, 0);
674674
675- /* Draw the window without the cursor. */
675+ // Draw the window without the cursor.
676676 gui.by_signal = TRUE;
677677 {
678678 cairo_rectangle_list_t *list = NULL;
@@ -682,8 +682,8 @@
682682 {
683683 int i;
684684
685- /* First clear all the blocks and then redraw them. Just in case
686- * some blocks overlap. */
685+ // First clear all the blocks and then redraw them. Just in case
686+ // some blocks overlap.
687687 for (i = 0; i < list->num_rectangles; i++)
688688 {
689689 const cairo_rectangle_t rect = list->rectangles[i];
@@ -720,27 +720,27 @@
720720 }
721721 gui.by_signal = FALSE;
722722
723- /* Add the cursor to the window if necessary.*/
723+ // Add the cursor to the window if necessary.
724724 if (gui_gtk3_should_draw_cursor() && blink_mode)
725725 gui_gtk3_update_cursor(cr);
726726
727727 return FALSE;
728728 }
729-#else /* !GTK_CHECK_VERSION(3,0,0) */
729+#else // !GTK_CHECK_VERSION(3,0,0)
730730 static gint
731731 expose_event(GtkWidget *widget UNUSED,
732732 GdkEventExpose *event,
733733 gpointer data UNUSED)
734734 {
735- /* Skip this when the GUI isn't set up yet, will redraw later. */
735+ // Skip this when the GUI isn't set up yet, will redraw later.
736736 if (gui.starting)
737737 return FALSE;
738738
739- out_flush(); /* make sure all output has been processed */
739+ out_flush(); // make sure all output has been processed
740740 gui_redraw(event->area.x, event->area.y,
741741 event->area.width, event->area.height);
742742
743- /* Clear the border areas if needed */
743+ // Clear the border areas if needed
744744 if (event->area.x < FILL_X(0))
745745 gdk_window_clear_area(gui.drawarea->window, 0, 0, FILL_X(0), 0);
746746 if (event->area.y < FILL_Y(0))
@@ -753,7 +753,7 @@
753753
754754 return FALSE;
755755 }
756-#endif /* !GTK_CHECK_VERSION(3,0,0) */
756+#endif // !GTK_CHECK_VERSION(3,0,0)
757757
758758 #ifdef FEAT_CLIENTSERVER
759759 /*
@@ -771,7 +771,7 @@
771771 {
772772 XEvent xev;
773773
774- /* Translate to XLib */
774+ // Translate to XLib
775775 xev.xproperty.type = PropertyNotify;
776776 xev.xproperty.atom = commProperty;
777777 xev.xproperty.window = commWindow;
@@ -781,7 +781,7 @@
781781 }
782782 return FALSE;
783783 }
784-#endif /* defined(FEAT_CLIENTSERVER) */
784+#endif // defined(FEAT_CLIENTSERVER)
785785
786786 /*
787787 * Handle changes to the "Xft/DPI" setting
@@ -826,9 +826,8 @@
826826 }
827827
828828
829-/****************************************************************************
830- * Focus handlers:
831- */
829+/////////////////////////////////////////////////////////////////////////////
830+// Focus handlers:
832831
833832
834833 /*
@@ -931,7 +930,7 @@
931930 }
932931 gui_mch_flush();
933932
934- return FALSE; /* don't happen again */
933+ return FALSE; // don't happen again
935934 }
936935
937936 /*
@@ -946,7 +945,7 @@
946945 timeout_remove(blink_timer);
947946 blink_timer = 0;
948947 }
949- /* Only switch blinking on if none of the times is zero */
948+ // Only switch blinking on if none of the times is zero
950949 if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus)
951950 {
952951 blink_timer = timeout_add(blink_waittime, blink_cb, NULL);
@@ -964,7 +963,7 @@
964963 if (blink_state == BLINK_NONE)
965964 gui_mch_start_blink();
966965
967- /* make sure keyboard input goes there */
966+ // make sure keyboard input goes there
968967 if (gtk_socket_id == 0 || !gtk_widget_has_focus(gui.drawarea))
969968 gtk_widget_grab_focus(gui.drawarea);
970969
@@ -992,8 +991,8 @@
992991 if (blink_state == BLINK_NONE)
993992 gui_mch_start_blink();
994993
995- /* make sure keyboard input goes to the draw area (if this is focus for a
996- * window) */
994+ // make sure keyboard input goes to the draw area (if this is focus for a
995+ // window)
997996 if (widget != gui.drawarea)
998997 gtk_widget_grab_focus(gui.drawarea);
999998
@@ -1032,13 +1031,13 @@
10321031 uc = gdk_keyval_to_unicode(keyval);
10331032 if (uc != 0)
10341033 {
1035- /* Check for CTRL-foo */
1034+ // Check for CTRL-foo
10361035 if ((state & GDK_CONTROL_MASK) && uc >= 0x20 && uc < 0x80)
10371036 {
1038- /* These mappings look arbitrary at the first glance, but in fact
1039- * resemble quite exactly the behaviour of the GTK+ 1.2 GUI on my
1040- * machine. The only difference is BS vs. DEL for CTRL-8 (makes
1041- * more sense and is consistent with usual terminal behaviour). */
1037+ // These mappings look arbitrary at the first glance, but in fact
1038+ // resemble quite exactly the behaviour of the GTK+ 1.2 GUI on my
1039+ // machine. The only difference is BS vs. DEL for CTRL-8 (makes
1040+ // more sense and is consistent with usual terminal behaviour).
10421041 if (uc >= '@')
10431042 string[0] = uc & 0x1F;
10441043 else if (uc == '2')
@@ -1055,16 +1054,16 @@
10551054 }
10561055 else
10571056 {
1058- /* Translate a normal key to UTF-8. This doesn't work for dead
1059- * keys of course, you _have_ to use an input method for that. */
1057+ // Translate a normal key to UTF-8. This doesn't work for dead
1058+ // keys of course, you _have_ to use an input method for that.
10601059 len = utf_char2bytes((int)uc, string);
10611060 }
10621061 }
10631062 else
10641063 {
1065- /* Translate keys which are represented by ASCII control codes in Vim.
1066- * There are only a few of those; most control keys are translated to
1067- * special terminal-like control sequences. */
1064+ // Translate keys which are represented by ASCII control codes in Vim.
1065+ // There are only a few of those; most control keys are translated to
1066+ // special terminal-like control sequences.
10681067 len = 1;
10691068 switch (keyval)
10701069 {
@@ -1134,8 +1133,8 @@
11341133 GdkEventKey *event,
11351134 gpointer data UNUSED)
11361135 {
1137- /* For GTK+ 2 we know for sure how large the string might get.
1138- * (That is, up to 6 bytes + NUL + CSI escapes + safety measure.) */
1136+ // For GTK+ 2 we know for sure how large the string might get.
1137+ // (That is, up to 6 bytes + NUL + CSI escapes + safety measure.)
11391138 char_u string[32], string2[32];
11401139 guint key_sym;
11411140 int len;
@@ -1172,8 +1171,8 @@
11721171 {
11731172 len = keyval_to_string(key_sym, state, string2);
11741173
1175- /* Careful: convert_input() doesn't handle the NUL character.
1176- * No need to convert pure ASCII anyway, thus the len > 1 check. */
1174+ // Careful: convert_input() doesn't handle the NUL character.
1175+ // No need to convert pure ASCII anyway, thus the len > 1 check.
11771176 if (len > 1 && input_conv.vc_type != CONV_NONE)
11781177 len = convert_input(string2, len, sizeof(string2));
11791178
@@ -1184,7 +1183,7 @@
11841183 *d++ = s[i];
11851184 if (d[-1] == CSI && d + 2 < string + sizeof(string))
11861185 {
1187- /* Turn CSI into K_CSI. */
1186+ // Turn CSI into K_CSI.
11881187 *d++ = KS_EXTRA;
11891188 *d++ = (int)KE_CSI;
11901189 }
@@ -1192,7 +1191,7 @@
11921191 len = d - string;
11931192 }
11941193
1195- /* Shift-Tab results in Left_Tab, but we want <S-Tab> */
1194+ // Shift-Tab results in Left_Tab, but we want <S-Tab>
11961195 if (key_sym == GDK_ISO_Left_Tab)
11971196 {
11981197 key_sym = GDK_Tab;
@@ -1200,24 +1199,24 @@
12001199 }
12011200
12021201 #ifdef FEAT_MENU
1203- /* If there is a menu and 'wak' is "yes", or 'wak' is "menu" and the key
1204- * is a menu shortcut, we ignore everything with the ALT modifier. */
1202+ // If there is a menu and 'wak' is "yes", or 'wak' is "menu" and the key
1203+ // is a menu shortcut, we ignore everything with the ALT modifier.
12051204 if ((state & GDK_MOD1_MASK)
12061205 && gui.menu_is_active
12071206 && (*p_wak == 'y'
12081207 || (*p_wak == 'm'
12091208 && len == 1
12101209 && gui_is_menu_shortcut(string[0]))))
1211- /* For GTK2 we return false to signify that we haven't handled the
1212- * keypress, so that gtk will handle the mnemonic or accelerator. */
1210+ // For GTK2 we return false to signify that we haven't handled the
1211+ // keypress, so that gtk will handle the mnemonic or accelerator.
12131212 return FALSE;
12141213 #endif
12151214
1216- /* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character
1217- * that already has the 8th bit set.
1218- * Don't do this for <S-M-Tab>, that should become K_S_TAB with ALT.
1219- * Don't do this for double-byte encodings, it turns the char into a lead
1220- * byte. */
1215+ // Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character
1216+ // that already has the 8th bit set.
1217+ // Don't do this for <S-M-Tab>, that should become K_S_TAB with ALT.
1218+ // Don't do this for double-byte encodings, it turns the char into a lead
1219+ // byte.
12211220 if (len == 1
12221221 && ((state & GDK_MOD1_MASK)
12231222 #if GTK_CHECK_VERSION(2,10,0)
@@ -1231,8 +1230,8 @@
12311230 )
12321231 {
12331232 string[0] |= 0x80;
1234- state &= ~GDK_MOD1_MASK; /* don't use it again */
1235- if (enc_utf8) /* convert to utf-8 */
1233+ state &= ~GDK_MOD1_MASK; // don't use it again
1234+ if (enc_utf8) // convert to utf-8
12361235 {
12371236 string[1] = string[0] & 0xbf;
12381237 string[0] = ((unsigned)string[0] >> 6) + 0xc0;
@@ -1247,8 +1246,8 @@
12471246 }
12481247 }
12491248
1250- /* Check for special keys. Also do this when len == 1 (key has an ASCII
1251- * value) to detect backspace, delete and keypad keys. */
1249+ // Check for special keys. Also do this when len == 1 (key has an ASCII
1250+ // value) to detect backspace, delete and keypad keys.
12521251 if (len == 0 || len == 1)
12531252 {
12541253 for (i = 0; special_keys[i].key_sym != 0; i++)
@@ -1264,11 +1263,11 @@
12641263 }
12651264 }
12661265
1267- if (len == 0) /* Unrecognized key */
1266+ if (len == 0) // Unrecognized key
12681267 return TRUE;
12691268
1270- /* Special keys (and a few others) may have modifiers. Also when using a
1271- * double-byte encoding (can't set the 8th bit). */
1269+ // Special keys (and a few others) may have modifiers. Also when using a
1270+ // double-byte encoding (can't set the 8th bit).
12721271 if (len == -3 || key_sym == GDK_space || key_sym == GDK_Tab
12731272 || key_sym == GDK_Return || key_sym == GDK_Linefeed
12741273 || key_sym == GDK_Escape || key_sym == GDK_KP_Tab
@@ -1324,7 +1323,7 @@
13241323
13251324 add_to_input_buf(string, len);
13261325
1327- /* blank out the pointer if necessary */
1326+ // blank out the pointer if necessary
13281327 if (p_mh)
13291328 gui_mch_mousehide(TRUE);
13301329
@@ -1356,12 +1355,11 @@
13561355 #endif
13571356
13581357
1359-/****************************************************************************
1360- * Selection handlers:
1361- */
1362-
1363-/* Remember when clip_lose_selection was called from here, we must not call
1364- * gtk_selection_owner_set() then. */
1358+/////////////////////////////////////////////////////////////////////////////
1359+// Selection handlers:
1360+
1361+// Remember when clip_lose_selection was called from here, we must not call
1362+// gtk_selection_owner_set() then.
13651363 static int in_selection_clear_event = FALSE;
13661364
13671365 static gint
@@ -1379,9 +1377,9 @@
13791377 return TRUE;
13801378 }
13811379
1382-#define RS_NONE 0 /* selection_received_cb() not called yet */
1383-#define RS_OK 1 /* selection_received_cb() called and OK */
1384-#define RS_FAIL 2 /* selection_received_cb() called and failed */
1380+#define RS_NONE 0 // selection_received_cb() not called yet
1381+#define RS_OK 1 // selection_received_cb() called and OK
1382+#define RS_FAIL 2 // selection_received_cb() called and failed
13851383 static int received_selection = RS_NONE;
13861384
13871385 static void
@@ -1408,7 +1406,7 @@
14081406 if (text == NULL || len <= 0)
14091407 {
14101408 received_selection = RS_FAIL;
1411- /* clip_free_selection(cbd); ??? */
1409+ // clip_free_selection(cbd); ???
14121410
14131411 return;
14141412 }
@@ -1430,8 +1428,8 @@
14301428 text += STRLEN(text) + 1;
14311429 len -= text - enc;
14321430
1433- /* If the encoding of the text is different from 'encoding', attempt
1434- * converting it. */
1431+ // If the encoding of the text is different from 'encoding', attempt
1432+ // converting it.
14351433 conv.vc_type = CONV_NONE;
14361434 convert_setup(&conv, enc, p_enc);
14371435 if (conv.vc_type != CONV_NONE)
@@ -1443,8 +1441,8 @@
14431441 }
14441442 }
14451443
1446- /* gtk_selection_data_get_text() handles all the nasty details
1447- * and targets and encodings etc. This rocks so hard. */
1444+ // gtk_selection_data_get_text() handles all the nasty details
1445+ // and targets and encodings etc. This rocks so hard.
14481446 else
14491447 {
14501448 tmpbuf_utf8 = gtk_selection_data_get_text(data);
@@ -1464,7 +1462,7 @@
14641462 {
14651463 vimconv_T conv;
14661464
1467- /* UTF-16, we get this for HTML */
1465+ // UTF-16, we get this for HTML
14681466 conv.vc_type = CONV_NONE;
14691467 convert_setup_ext(&conv, (char_u *)"utf-16le", FALSE, p_enc, TRUE);
14701468
@@ -1480,7 +1478,7 @@
14801478 }
14811479 }
14821480
1483- /* Chop off any trailing NUL bytes. OpenOffice sends these. */
1481+ // Chop off any trailing NUL bytes. OpenOffice sends these.
14841482 while (len > 0 && text[len - 1] == NUL)
14851483 --len;
14861484
@@ -1516,7 +1514,7 @@
15161514 cbd = &clip_star;
15171515
15181516 if (!cbd->owned)
1519- return; /* Shouldn't ever happen */
1517+ return; // Shouldn't ever happen
15201518
15211519 if (info != (guint)TARGET_STRING
15221520 && (!clip_html || info != (guint)TARGET_HTML)
@@ -1527,15 +1525,15 @@
15271525 && info != (guint)TARGET_TEXT)
15281526 return;
15291527
1530- /* get the selection from the '*'/'+' register */
1528+ // get the selection from the '*'/'+' register
15311529 clip_get_selection(cbd);
15321530
15331531 motion_type = clip_convert_selection(&string, &tmplen, cbd);
15341532 if (motion_type < 0 || string == NULL)
15351533 return;
1536- /* Due to int arguments we can't handle more than G_MAXINT. Also
1537- * reserve one extra byte for NUL or the motion type; just in case.
1538- * (Not that pasting 2G of text is ever going to work, but... ;-) */
1534+ // Due to int arguments we can't handle more than G_MAXINT. Also
1535+ // reserve one extra byte for NUL or the motion type; just in case.
1536+ // (Not that pasting 2G of text is ever going to work, but... ;-)
15391537 length = MIN(tmplen, (long_u)(G_MAXINT - 1));
15401538
15411539 if (info == (guint)TARGET_VIM)
@@ -1546,7 +1544,7 @@
15461544 tmpbuf[0] = motion_type;
15471545 mch_memmove(tmpbuf + 1, string, (size_t)length);
15481546 }
1549- /* For our own format, the first byte contains the motion type */
1547+ // For our own format, the first byte contains the motion type
15501548 ++length;
15511549 vim_free(string);
15521550 string = tmpbuf;
@@ -1557,7 +1555,7 @@
15571555 {
15581556 vimconv_T conv;
15591557
1560- /* Since we get utf-16, we probably should set it as well. */
1558+ // Since we get utf-16, we probably should set it as well.
15611559 conv.vc_type = CONV_NONE;
15621560 convert_setup_ext(&conv, p_enc, TRUE, (char_u *)"utf-16le", FALSE);
15631561 if (conv.vc_type != CONV_NONE)
@@ -1568,7 +1566,7 @@
15681566 string = tmpbuf;
15691567 }
15701568
1571- /* Prepend the BOM: "fffe" */
1569+ // Prepend the BOM: "fffe"
15721570 if (string != NULL)
15731571 {
15741572 tmpbuf = alloc(length + 2);
@@ -1583,10 +1581,10 @@
15831581 }
15841582
15851583 #if !GTK_CHECK_VERSION(3,0,0)
1586- /* Looks redundant even for GTK2 because these values are
1587- * overwritten by gtk_selection_data_set() that follows. */
1584+ // Looks redundant even for GTK2 because these values are
1585+ // overwritten by gtk_selection_data_set() that follows.
15881586 selection_data->type = selection_data->target;
1589- selection_data->format = 16; /* 16 bits per char */
1587+ selection_data->format = 16; // 16 bits per char
15901588 #endif
15911589 gtk_selection_data_set(selection_data, html_atom, 16,
15921590 string, length);
@@ -1598,7 +1596,7 @@
15981596 {
15991597 int l = STRLEN(p_enc);
16001598
1601- /* contents: motion_type 'encoding' NUL text */
1599+ // contents: motion_type 'encoding' NUL text
16021600 tmpbuf = alloc(length + l + 2);
16031601 if (tmpbuf != NULL)
16041602 {
@@ -1612,8 +1610,8 @@
16121610 type = vimenc_atom;
16131611 }
16141612
1615- /* gtk_selection_data_set_text() handles everything for us. This is
1616- * so easy and simple and cool, it'd be insane not to use it. */
1613+ // gtk_selection_data_set_text() handles everything for us. This is
1614+ // so easy and simple and cool, it'd be insane not to use it.
16171615 else
16181616 {
16191617 if (output_conv.vc_type != CONV_NONE)
@@ -1624,7 +1622,7 @@
16241622 return;
16251623 string = tmpbuf;
16261624 }
1627- /* Validate the string to avoid runtime warnings */
1625+ // Validate the string to avoid runtime warnings
16281626 if (g_utf8_validate((const char *)string, (gssize)length, NULL))
16291627 {
16301628 gtk_selection_data_set_text(selection_data,
@@ -1637,10 +1635,10 @@
16371635 if (string != NULL)
16381636 {
16391637 #if !GTK_CHECK_VERSION(3,0,0)
1640- /* Looks redundant even for GTK2 because these values are
1641- * overwritten by gtk_selection_data_set() that follows. */
1638+ // Looks redundant even for GTK2 because these values are
1639+ // overwritten by gtk_selection_data_set() that follows.
16421640 selection_data->type = selection_data->target;
1643- selection_data->format = 8; /* 8 bits per char */
1641+ selection_data->format = 8; // 8 bits per char
16441642 #endif
16451643 gtk_selection_data_set(selection_data, type, 8, string, length);
16461644 vim_free(string);
@@ -1657,7 +1655,7 @@
16571655 {
16581656 char_u *p;
16591657
1660- /* Guess that when $DISPLAY isn't set the GUI can't start. */
1658+ // Guess that when $DISPLAY isn't set the GUI can't start.
16611659 p = mch_getenv((char_u *)"DISPLAY");
16621660 if (p == NULL || *p == NUL)
16631661 {
@@ -1682,16 +1680,16 @@
16821680
16831681 if (!res_registered)
16841682 {
1685- /* Call this function in the GUI process; otherwise, the resources
1686- * won't be available. Don't call it twice. */
1683+ // Call this function in the GUI process; otherwise, the resources
1684+ // won't be available. Don't call it twice.
16871685 res_registered = TRUE;
16881686 gui_gtk_register_resource();
16891687 }
16901688 #endif
16911689
16921690 #if GTK_CHECK_VERSION(3,10,0)
1693- /* Vim currently assumes that Gtk means X11, so it cannot use native Gtk
1694- * support for other backends such as Wayland. */
1691+ // Vim currently assumes that Gtk means X11, so it cannot use native Gtk
1692+ // support for other backends such as Wayland.
16951693 gdk_set_allowed_backends ("x11");
16961694 #endif
16971695
@@ -1700,12 +1698,12 @@
17001698 using_gnome = 1;
17011699 #endif
17021700
1703- /* This defaults to argv[0], but we want it to match the name of the
1704- * shipped gvim.desktop so that Vim's windows can be associated with this
1705- * file. */
1701+ // This defaults to argv[0], but we want it to match the name of the
1702+ // shipped gvim.desktop so that Vim's windows can be associated with this
1703+ // file.
17061704 g_set_prgname("gvim");
17071705
1708- /* Don't use gtk_init() or gnome_init(), it exits on failure. */
1706+ // Don't use gtk_init() or gnome_init(), it exits on failure.
17091707 if (!gtk_init_check(&gui_argc, &gui_argv))
17101708 {
17111709 gui.dying = TRUE;
@@ -1716,9 +1714,8 @@
17161714 return OK;
17171715 }
17181716
1719-/****************************************************************************
1720- * Mouse handling callbacks
1721- */
1717+/////////////////////////////////////////////////////////////////////////////
1718+// Mouse handling callbacks
17221719
17231720
17241721 static guint mouse_click_timer = 0;
@@ -1730,11 +1727,11 @@
17301727 static timeout_cb_type
17311728 mouse_click_timer_cb(gpointer data)
17321729 {
1733- /* we don't use this information currently */
1730+ // we don't use this information currently
17341731 int *timed_out = (int *) data;
17351732
17361733 *timed_out = TRUE;
1737- return FALSE; /* don't happen again */
1734+ return FALSE; // don't happen again
17381735 }
17391736
17401737 static guint motion_repeat_timer = 0;
@@ -1753,21 +1750,21 @@
17531750 GDK_BUTTON5_MASK))
17541751 ? MOUSE_DRAG : ' ';
17551752
1756- /* If our pointer is currently hidden, then we should show it. */
1753+ // If our pointer is currently hidden, then we should show it.
17571754 gui_mch_mousehide(FALSE);
17581755
1759- /* Just moving the rodent above the drawing area without any button
1760- * being pressed. */
1756+ // Just moving the rodent above the drawing area without any button
1757+ // being pressed.
17611758 if (button != MOUSE_DRAG)
17621759 {
17631760 gui_mouse_moved(x, y);
17641761 return;
17651762 }
17661763
1767- /* translate modifier coding between the main engine and GTK */
1764+ // translate modifier coding between the main engine and GTK
17681765 vim_modifiers = modifiers_gdk2mouse(state);
17691766
1770- /* inform the editor engine about the occurrence of this event */
1767+ // inform the editor engine about the occurrence of this event
17711768 gui_send_mouse_event(button, x, y, FALSE, vim_modifiers);
17721769
17731770 /*
@@ -1785,26 +1782,24 @@
17851782 int offshoot;
17861783 int delay = 10;
17871784
1788- /* Calculate the maximal distance of the cursor from the drawing area.
1789- * (offshoot can't become negative here!).
1790- */
1785+ // Calculate the maximal distance of the cursor from the drawing area.
1786+ // (offshoot can't become negative here!).
17911787 dx = x < 0 ? -x : x - allocation.width;
17921788 dy = y < 0 ? -y : y - allocation.height;
17931789
17941790 offshoot = dx > dy ? dx : dy;
17951791
1796- /* Make a linearly decaying timer delay with a threshold of 5 at a
1797- * distance of 127 pixels from the main window.
1798- *
1799- * One could think endlessly about the most ergonomic variant here.
1800- * For example it could make sense to calculate the distance from the
1801- * drags start instead...
1802- *
1803- * Maybe a parabolic interpolation would suite us better here too...
1804- */
1792+ // Make a linearly decaying timer delay with a threshold of 5 at a
1793+ // distance of 127 pixels from the main window.
1794+ //
1795+ // One could think endlessly about the most ergonomic variant here.
1796+ // For example it could make sense to calculate the distance from the
1797+ // drags start instead...
1798+ //
1799+ // Maybe a parabolic interpolation would suite us better here too...
18051800 if (offshoot > 127)
18061801 {
1807- /* 5 appears to be somehow near to my perceptual limits :-). */
1802+ // 5 appears to be somehow near to my perceptual limits :-).
18081803 delay = 5;
18091804 }
18101805 else
@@ -1812,7 +1807,7 @@
18121807 delay = (130 * (127 - offshoot)) / 127 + 5;
18131808 }
18141809
1815- /* shoot again */
1810+ // shoot again
18161811 if (!motion_repeat_timer)
18171812 motion_repeat_timer = timeout_add(delay, motion_repeat_timer_cb,
18181813 NULL);
@@ -1855,7 +1850,7 @@
18551850 return gdk_device_get_window_at_position(dev, x, y);
18561851 }
18571852 # endif
1858-#else /* !GTK_CHECK_VERSION(3,0,0) */
1853+#else // !GTK_CHECK_VERSION(3,0,0)
18591854 # define gui_gtk_get_pointer(wid, x, y, s) \
18601855 gdk_window_get_pointer((wid)->window, x, y, s)
18611856 # define gui_gtk_window_at_position(wid, x, y) gdk_window_at_pointer(x, y)
@@ -1881,8 +1876,8 @@
18811876 return FALSE;
18821877 }
18831878
1884- /* If there already is a mouse click in the input buffer, wait another
1885- * time (otherwise we would create a backlog of clicks) */
1879+ // If there already is a mouse click in the input buffer, wait another
1880+ // time (otherwise we would create a backlog of clicks)
18861881 if (vim_used_in_input_buf() > 10)
18871882 return TRUE;
18881883
@@ -1900,8 +1895,8 @@
19001895 motion_repeat_offset = !motion_repeat_offset;
19011896 process_motion_notify(x, y, state);
19021897
1903- /* Don't happen again. We will get reinstalled in the synthetic event
1904- * if needed -- thus repeating should still work. */
1898+ // Don't happen again. We will get reinstalled in the synthetic event
1899+ // if needed -- thus repeating should still work.
19051900 return FALSE;
19061901 }
19071902
@@ -1925,7 +1920,7 @@
19251920 (GdkModifierType)event->state);
19261921 }
19271922
1928- return TRUE; /* handled */
1923+ return TRUE; // handled
19291924 }
19301925
19311926
@@ -1946,7 +1941,7 @@
19461941
19471942 gui.event_time = event->time;
19481943
1949- /* Make sure we have focus now we've been selected */
1944+ // Make sure we have focus now we've been selected
19501945 if (gtk_socket_id != 0 && !gtk_widget_has_focus(widget))
19511946 gtk_widget_grab_focus(widget);
19521947
@@ -1960,7 +1955,7 @@
19601955 x = event->x;
19611956 y = event->y;
19621957
1963- /* Handle multiple clicks */
1958+ // Handle multiple clicks
19641959 if (!mouse_timed_out && mouse_click_timer)
19651960 {
19661961 timeout_remove(mouse_click_timer);
@@ -1974,19 +1969,19 @@
19741969
19751970 switch (event->button)
19761971 {
1977- /* Keep in sync with gui_x11.c.
1978- * Buttons 4-7 are handled in scroll_event() */
1972+ // Keep in sync with gui_x11.c.
1973+ // Buttons 4-7 are handled in scroll_event()
19791974 case 1: button = MOUSE_LEFT; break;
19801975 case 2: button = MOUSE_MIDDLE; break;
19811976 case 3: button = MOUSE_RIGHT; break;
19821977 case 8: button = MOUSE_X1; break;
19831978 case 9: button = MOUSE_X2; break;
19841979 default:
1985- return FALSE; /* Unknown button */
1980+ return FALSE; // Unknown button
19861981 }
19871982
19881983 #ifdef FEAT_XIM
1989- /* cancel any preediting */
1984+ // cancel any preediting
19901985 if (im_is_preediting())
19911986 xim_reset();
19921987 #endif
@@ -2026,12 +2021,12 @@
20262021 case GDK_SCROLL_RIGHT:
20272022 button = MOUSE_6;
20282023 break;
2029- default: /* This shouldn't happen */
2024+ default: // This shouldn't happen
20302025 return FALSE;
20312026 }
20322027
20332028 # ifdef FEAT_XIM
2034- /* cancel any preediting */
2029+ // cancel any preediting
20352030 if (im_is_preediting())
20362031 xim_reset();
20372032 # endif
@@ -2055,9 +2050,9 @@
20552050
20562051 gui.event_time = event->time;
20572052
2058- /* Remove any motion "machine gun" timers used for automatic further
2059- extension of allocation areas if outside of the applications window
2060- area .*/
2053+ // Remove any motion "machine gun" timers used for automatic further
2054+ // extension of allocation areas if outside of the applications window
2055+ // area .
20612056 if (motion_repeat_timer)
20622057 {
20632058 timeout_remove(motion_repeat_timer);
@@ -2076,9 +2071,8 @@
20762071
20772072
20782073 #ifdef FEAT_DND
2079-/****************************************************************************
2080- * Drag aNd Drop support handlers.
2081- */
2074+/////////////////////////////////////////////////////////////////////////////
2075+// Drag aNd Drop support handlers.
20822076
20832077 /*
20842078 * Count how many items there may be and separate them with a NUL.
@@ -2113,7 +2107,7 @@
21132107 }
21142108 if (p > out && p[-1] != NUL)
21152109 {
2116- *p = NUL; /* last item didn't have \r or \n */
2110+ *p = NUL; // last item didn't have \r or \n
21172111 ++count;
21182112 }
21192113 return count;
@@ -2183,7 +2177,7 @@
21832177 {
21842178 int_u modifiers;
21852179
2186- gtk_drag_finish(context, TRUE, FALSE, time_); /* accept */
2180+ gtk_drag_finish(context, TRUE, FALSE, time_); // accept
21872181
21882182 modifiers = modifiers_gdk2mouse(state);
21892183
@@ -2216,7 +2210,7 @@
22162210 }
22172211
22182212 dnd_yank_drag_data(text, (long)len);
2219- gtk_drag_finish(context, TRUE, FALSE, time_); /* accept */
2213+ gtk_drag_finish(context, TRUE, FALSE, time_); // accept
22202214 vim_free(tmpbuf);
22212215
22222216 dropkey[2] = modifiers_gdk2vim(state);
@@ -2242,7 +2236,7 @@
22422236 {
22432237 GdkModifierType state;
22442238
2245- /* Guard against trash */
2239+ // Guard against trash
22462240 const guchar * const data_data = gtk_selection_data_get_data(data);
22472241 const gint data_length = gtk_selection_data_get_length(data);
22482242 const gint data_format = gtk_selection_data_get_format(data);
@@ -2256,18 +2250,18 @@
22562250 return;
22572251 }
22582252
2259- /* Get the current modifier state for proper distinguishment between
2260- * different operations later. */
2253+ // Get the current modifier state for proper distinguishment between
2254+ // different operations later.
22612255 gui_gtk_get_pointer(widget, NULL, NULL, &state);
22622256
2263- /* Not sure about the role of "text/plain" here... */
2257+ // Not sure about the role of "text/plain" here...
22642258 if (info == (guint)TARGET_TEXT_URI_LIST)
22652259 drag_handle_uri_list(context, data, time_, state, x, y);
22662260 else
22672261 drag_handle_text(context, data, time_, state);
22682262
22692263 }
2270-#endif /* FEAT_DND */
2264+#endif // FEAT_DND
22712265
22722266
22732267 #if defined(USE_GNOME_SESSION)
@@ -2301,7 +2295,7 @@
23012295
23022296 exiting = FALSE;
23032297 cmdmod = save_cmdmod;
2304- setcursor(); /* position the cursor */
2298+ setcursor(); // position the cursor
23052299 out_flush();
23062300 /*
23072301 * If the user hit the [Cancel] button the whole shutdown
@@ -2329,26 +2323,26 @@
23292323 unsigned int len;
23302324 gboolean success;
23312325
2332- /* Always request an interaction if possible. check_changed_any()
2333- * won't actually show a dialog unless any buffers have been modified.
2334- * There doesn't seem to be an obvious way to check that without
2335- * automatically firing the dialog. Anyway, it works just fine. */
2326+ // Always request an interaction if possible. check_changed_any()
2327+ // won't actually show a dialog unless any buffers have been modified.
2328+ // There doesn't seem to be an obvious way to check that without
2329+ // automatically firing the dialog. Anyway, it works just fine.
23362330 if (interact_style == GNOME_INTERACT_ANY)
23372331 gnome_client_request_interaction(client, GNOME_DIALOG_NORMAL,
23382332 &sm_client_check_changed_any,
23392333 NULL);
23402334 out_flush();
2341- ml_sync_all(FALSE, FALSE); /* preserve all swap files */
2342-
2343- /* The path is unique for each session save. We do neither know nor care
2344- * which session script will actually be used later. This decision is in
2345- * the domain of the session manager. */
2335+ ml_sync_all(FALSE, FALSE); // preserve all swap files
2336+
2337+ // The path is unique for each session save. We do neither know nor care
2338+ // which session script will actually be used later. This decision is in
2339+ // the domain of the session manager.
23462340 session_file = gnome_config_get_real_path(
23472341 gnome_client_get_config_prefix(client));
23482342 len = strlen(session_file);
23492343
23502344 if (len > 0 && session_file[len-1] == G_DIR_SEPARATOR)
2351- --len; /* get rid of the superfluous trailing '/' */
2345+ --len; // get rid of the superfluous trailing '/'
23522346
23532347 session_file = g_renew(char, session_file, len + sizeof(suffix));
23542348 memcpy(session_file + len, suffix, sizeof(suffix));
@@ -2360,10 +2354,10 @@
23602354 const char *argv[8];
23612355 int i;
23622356
2363- /* Tell the session manager how to wipe out the stored session data.
2364- * This isn't as dangerous as it looks, don't worry :) session_file
2365- * is a unique absolute filename. Usually it'll be something like
2366- * `/home/user/.gnome2/vim-XXXXXX-session.vim'. */
2357+ // Tell the session manager how to wipe out the stored session data.
2358+ // This isn't as dangerous as it looks, don't worry :) session_file
2359+ // is a unique absolute filename. Usually it'll be something like
2360+ // `/home/user/.gnome2/vim-XXXXXX-session.vim'.
23672361 i = 0;
23682362 argv[i++] = "rm";
23692363 argv[i++] = session_file;
@@ -2371,11 +2365,11 @@
23712365
23722366 gnome_client_set_discard_command(client, i, (char **)argv);
23732367
2374- /* Tell the session manager how to restore the just saved session.
2375- * This is easily done thanks to Vim's -S option. Pass the -f flag
2376- * since there's no need to fork -- it might even cause confusion.
2377- * Also pass the window role to give the WM something to match on.
2378- * The role is set in gui_mch_open(), thus should _never_ be NULL. */
2368+ // Tell the session manager how to restore the just saved session.
2369+ // This is easily done thanks to Vim's -S option. Pass the -f flag
2370+ // since there's no need to fork -- it might even cause confusion.
2371+ // Also pass the window role to give the WM something to match on.
2372+ // The role is set in gui_mch_open(), thus should _never_ be NULL.
23792373 i = 0;
23802374 argv[i++] = restart_command;
23812375 argv[i++] = "-f";
@@ -2403,7 +2397,7 @@
24032397 static void
24042398 sm_client_die(GnomeClient *client UNUSED, gpointer data UNUSED)
24052399 {
2406- /* Don't write messages to the GUI anymore */
2400+ // Don't write messages to the GUI anymore
24072401 full_screen = FALSE;
24082402
24092403 vim_strncpy(IObuff, (char_u *)
@@ -2424,8 +2418,8 @@
24242418
24252419 if (client != NULL)
24262420 {
2427- /* Must use the deprecated gtk_signal_connect() for compatibility
2428- * with GNOME 1. Arrgh, zombies! */
2421+ // Must use the deprecated gtk_signal_connect() for compatibility
2422+ // with GNOME 1. Arrgh, zombies!
24292423 gtk_signal_connect(GTK_OBJECT(client), "save_yourself",
24302424 GTK_SIGNAL_FUNC(&sm_client_save_yourself), NULL);
24312425 gtk_signal_connect(GTK_OBJECT(client), "die",
@@ -2447,17 +2441,17 @@
24472441 {
24482442 if (condition == G_IO_IN)
24492443 {
2450- /* Do stuff; maybe close connection */
2444+ // Do stuff; maybe close connection
24512445 if (xsmp_handle_requests() == FAIL)
24522446 g_io_channel_unref((GIOChannel *)data);
24532447 return TRUE;
24542448 }
2455- /* Error */
2449+ // Error
24562450 g_io_channel_unref((GIOChannel *)data);
24572451 xsmp_close();
24582452 return TRUE;
24592453 }
2460-# endif /* USE_XSMP */
2454+# endif // USE_XSMP
24612455
24622456 /*
24632457 * Setup the WM_PROTOCOLS to indicate we want the WM_SAVE_YOURSELF event.
@@ -2485,9 +2479,9 @@
24852479 else
24862480 # endif
24872481 {
2488- /* Fall back to old method */
2489-
2490- /* first get the existing value */
2482+ // Fall back to old method
2483+
2484+ // first get the existing value
24912485 GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin);
24922486
24932487 if (XGetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win),
@@ -2500,14 +2494,14 @@
25002494
25012495 save_yourself_xatom = GET_X_ATOM(save_yourself_atom);
25022496
2503- /* check if WM_SAVE_YOURSELF isn't there yet */
2497+ // check if WM_SAVE_YOURSELF isn't there yet
25042498 for (i = 0; i < count; ++i)
25052499 if (existing_atoms[i] == save_yourself_xatom)
25062500 break;
25072501
25082502 if (i == count)
25092503 {
2510- /* allocate an Atoms array which is one item longer */
2504+ // allocate an Atoms array which is one item longer
25112505 new_atoms = ALLOC_MULT(Atom, count + 1);
25122506 if (new_atoms != NULL)
25132507 {
@@ -2553,7 +2547,7 @@
25532547 == GET_X_ATOM(save_yourself_atom))
25542548 {
25552549 out_flush();
2556- ml_sync_all(FALSE, FALSE); /* preserve all swap files */
2550+ ml_sync_all(FALSE, FALSE); // preserve all swap files
25572551 /*
25582552 * Set the window's WM_COMMAND property, to let the window manager
25592553 * know we are done saving ourselves. We don't want to be
@@ -2576,12 +2570,12 @@
25762570 static void
25772571 mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED)
25782572 {
2579-/* If you get an error message here, you still need to unpack the runtime
2580- * archive! */
2573+// If you get an error message here, you still need to unpack the runtime
2574+// archive!
25812575 #ifdef magick
25822576 # undef magick
25832577 #endif
2584- /* A bit hackish, but avoids casting later and allows optimization */
2578+ // A bit hackish, but avoids casting later and allows optimization
25852579 # define static static const
25862580 #define magick