# HG changeset patch # User Bram Moolenaar # Date 1575234903 -3600 # Node ID 79e10adc821dd15f4443b27878cb6b14110b0d59 # Parent 04ce3b8a50ed4f9051d45b086a809174d3241a64 patch 8.1.2380: using old C style comments Commit: https://github.com/vim/vim/commit/306139005c31ea7e6f892dd119beba3c94dcb982 Author: Bram Moolenaar 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. diff --git a/src/getchar.c b/src/getchar.c --- a/src/getchar.c +++ b/src/getchar.c @@ -38,13 +38,13 @@ * Un-escaping is done by vgetc(). */ -#define MINIMAL_SIZE 20 /* minimal size for b_str */ +#define MINIMAL_SIZE 20 // minimal size for b_str static buffheader_T redobuff = {{NULL, {NUL}}, NULL, 0, 0}; static buffheader_T old_redobuff = {{NULL, {NUL}}, NULL, 0, 0}; static buffheader_T recordbuff = {{NULL, {NUL}}, NULL, 0, 0}; -static int typeahead_char = 0; /* typeahead char that's not flushed */ +static int typeahead_char = 0; // typeahead char that's not flushed /* * when block_redo is TRUE redo buffer will not be changed @@ -73,20 +73,19 @@ static int KeyNoremap = 0; // remapp * typebuf.tb_noremap[typebuf.tb_off] is the first valid flag. * (typebuf has been put in globals.h, because check_termcode() needs it). */ -#define RM_YES 0 /* tb_noremap: remap */ -#define RM_NONE 1 /* tb_noremap: don't remap */ -#define RM_SCRIPT 2 /* tb_noremap: remap local script mappings */ -#define RM_ABBR 4 /* tb_noremap: don't remap, do abbrev. */ - -/* typebuf.tb_buf has three parts: room in front (for result of mappings), the - * middle for typeahead and room for new characters (which needs to be 3 * - * MAXMAPLEN) for the Amiga). - */ +#define RM_YES 0 // tb_noremap: remap +#define RM_NONE 1 // tb_noremap: don't remap +#define RM_SCRIPT 2 // tb_noremap: remap local script mappings +#define RM_ABBR 4 // tb_noremap: don't remap, do abbrev. + +// typebuf.tb_buf has three parts: room in front (for result of mappings), the +// middle for typeahead and room for new characters (which needs to be 3 * +// MAXMAPLEN) for the Amiga). #define TYPELEN_INIT (5 * (MAXMAPLEN + 3)) -static char_u typebuf_init[TYPELEN_INIT]; /* initial typebuf.tb_buf */ -static char_u noremapbuf_init[TYPELEN_INIT]; /* initial typebuf.tb_noremap */ - -static int last_recorded_len = 0; /* number of last recorded chars */ +static char_u typebuf_init[TYPELEN_INIT]; // initial typebuf.tb_buf +static char_u noremapbuf_init[TYPELEN_INIT]; // initial typebuf.tb_noremap + +static int last_recorded_len = 0; // number of last recorded chars static int read_readbuf(buffheader_T *buf, int advance); static void init_typebuf(void); @@ -120,7 +119,7 @@ free_buff(buffheader_T *buf) static char_u * get_buffcont( buffheader_T *buffer, - int dozero) /* count == zero is not an error */ + int dozero) // count == zero is not an error { long_u count = 0; char_u *p = NULL; @@ -128,7 +127,7 @@ get_buffcont( char_u *str; buffblock_T *bp; - /* compute the total length of the string */ + // compute the total length of the string for (bp = buffer->bh_first.b_next; bp != NULL; bp = bp->b_next) count += (long_u)STRLEN(bp->b_str); @@ -196,22 +195,22 @@ get_inserted(void) add_buff( buffheader_T *buf, char_u *s, - long slen) /* length of "s" or -1 */ + long slen) // length of "s" or -1 { buffblock_T *p; long_u len; if (slen < 0) slen = (long)STRLEN(s); - if (slen == 0) /* don't add empty strings */ + if (slen == 0) // don't add empty strings return; - if (buf->bh_first.b_next == NULL) /* first add to list */ + if (buf->bh_first.b_next == NULL) // first add to list { buf->bh_space = 0; buf->bh_curr = &(buf->bh_first); } - else if (buf->bh_curr == NULL) /* buffer has already been read */ + else if (buf->bh_curr == NULL) // buffer has already been read { iemsg(_("E222: Add to read buffer")); return; @@ -236,7 +235,7 @@ add_buff( len = slen; p = alloc(offsetof(buffblock_T, b_str) + len + 1); if (p == NULL) - return; /* no space, just forget it */ + return; // no space, just forget it buf->bh_space = (int)(len - slen); vim_strncpy(p->b_str, s, (size_t)slen); @@ -282,7 +281,7 @@ add_char_buff(buffheader_T *buf, int c) if (IS_SPECIAL(c) || c == K_SPECIAL || c == NUL) { - /* translate special key code into three byte sequence */ + // translate special key code into three byte sequence temp[0] = K_SPECIAL; temp[1] = K_SECOND(c); temp[2] = K_THIRD(c); @@ -291,7 +290,7 @@ add_char_buff(buffheader_T *buf, int c) #ifdef FEAT_GUI else if (c == CSI) { - /* Translate a CSI to a CSI - KS_EXTRA - KE_CSI sequence */ + // Translate a CSI to a CSI - KS_EXTRA - KE_CSI sequence temp[0] = CSI; temp[1] = KS_EXTRA; temp[2] = (int)KE_CSI; @@ -307,10 +306,10 @@ add_char_buff(buffheader_T *buf, int c) } } -/* First read ahead buffer. Used for translated commands. */ +// First read ahead buffer. Used for translated commands. static buffheader_T readbuf1 = {{NULL, {NUL}}, NULL, 0, 0}; -/* Second read ahead buffer. Used for redo. */ +// Second read ahead buffer. Used for redo. static buffheader_T readbuf2 = {{NULL, {NUL}}, NULL, 0, 0}; /* @@ -336,7 +335,7 @@ read_readbuf(buffheader_T *buf, int adva char_u c; buffblock_T *curr; - if (buf->bh_first.b_next == NULL) /* buffer is empty */ + if (buf->bh_first.b_next == NULL) // buffer is empty return NUL; curr = buf->bh_first.b_next; @@ -435,8 +434,8 @@ flush_buffers(flush_buffers_T flush_type typebuf.tb_off = MAXMAPLEN; typebuf.tb_len = 0; #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) - /* Reset the flag that text received from a client or from feedkeys() - * was inserted in the typeahead buffer. */ + // Reset the flag that text received from a client or from feedkeys() + // was inserted in the typeahead buffer. typebuf_was_filled = FALSE; #endif } @@ -493,7 +492,7 @@ saveRedobuff(save_redo_T *save_redo) save_redo->sr_old_redobuff = old_redobuff; old_redobuff.bh_first.b_next = NULL; - /* Make a copy, so that ":normal ." in a function works. */ + // Make a copy, so that ":normal ." in a function works. s = get_buffcont(&save_redo->sr_redobuff, FALSE); if (s != NULL) { @@ -533,7 +532,7 @@ AppendToRedobuff(char_u *s) void AppendToRedobuffLit( char_u *str, - int len) /* length of "str" or -1 for up to the NUL */ + int len) // length of "str" or -1 for up to the NUL { char_u *s = str; int c; @@ -544,18 +543,18 @@ AppendToRedobuffLit( while (len < 0 ? *s != NUL : s - str < len) { - /* Put a string of normal characters in the redo buffer (that's - * faster). */ + // Put a string of normal characters in the redo buffer (that's + // faster). start = s; while (*s >= ' ' #ifndef EBCDIC - && *s < DEL /* EBCDIC: all chars above space are normal */ + && *s < DEL // EBCDIC: all chars above space are normal #endif && (len < 0 || s - str < len)) ++s; - /* Don't put '0' or '^' as last character, just in case a CTRL-D is - * typed next. */ + // Don't put '0' or '^' as last character, just in case a CTRL-D is + // typed next. if (*s == NUL && (s[-1] == '0' || s[-1] == '^')) --s; if (s > start) @@ -564,16 +563,16 @@ AppendToRedobuffLit( if (*s == NUL || (len >= 0 && s - str >= len)) break; - /* Handle a special or multibyte character. */ + // Handle a special or multibyte character. if (has_mbyte) - /* Handle composing chars separately. */ + // Handle composing chars separately. c = mb_cptr2char_adv(&s); else c = *s++; if (c < ' ' || c == DEL || (*s == NUL && (c == '0' || c == '^'))) add_char_buff(&redobuff, Ctrl_V); - /* CTRL-V '0' must be inserted as CTRL-V 048 (EBCDIC: xf0) */ + // CTRL-V '0' must be inserted as CTRL-V 048 (EBCDIC: xf0) if (*s == NUL && c == '0') #ifdef EBCDIC add_buff(&redobuff, (char_u *)"xf0", 3L); @@ -647,7 +646,7 @@ stuffReadbuffSpec(char_u *s) { if (*s == K_SPECIAL && s[1] != NUL && s[2] != NUL) { - /* Insert special key literally. */ + // Insert special key literally. stuffReadbuffLen(s, 3L); s += 3; } @@ -712,22 +711,22 @@ read_redo(int init, int old_redo) } if ((c = *p) != NUL) { - /* Reverse the conversion done by add_char_buff() */ - /* For a multi-byte character get all the bytes and return the - * converted character. */ + // Reverse the conversion done by add_char_buff() + // For a multi-byte character get all the bytes and return the + // converted character. if (has_mbyte && (c != K_SPECIAL || p[1] == KS_SPECIAL)) n = MB_BYTE2LEN_CHECK(c); else n = 1; for (i = 0; ; ++i) { - if (c == K_SPECIAL) /* special key or escaped K_SPECIAL */ + if (c == K_SPECIAL) // special key or escaped K_SPECIAL { c = TO_SPECIAL(p[1], p[2]); p += 2; } #ifdef FEAT_GUI - if (c == CSI) /* escaped CSI */ + if (c == CSI) // escaped CSI p += 2; #endif if (*++p == NUL && bp->b_next != NULL) @@ -736,14 +735,14 @@ read_redo(int init, int old_redo) p = bp->b_str; } buf[i] = c; - if (i == n - 1) /* last byte of a character */ + if (i == n - 1) // last byte of a character { if (n != 1) c = (*mb_ptr2char)(buf); break; } c = *p; - if (c == NUL) /* cannot happen? */ + if (c == NUL) // cannot happen? break; } } @@ -779,24 +778,24 @@ start_redo(long count, int old_redo) { int c; - /* init the pointers; return if nothing to redo */ + // init the pointers; return if nothing to redo if (read_redo(TRUE, old_redo) == FAIL) return FAIL; c = read_redo(FALSE, old_redo); - /* copy the buffer name, if present */ + // copy the buffer name, if present if (c == '"') { add_buff(&readbuf2, (char_u *)"\"", 1L); c = read_redo(FALSE, old_redo); - /* if a numbered buffer is used, increment the number */ + // if a numbered buffer is used, increment the number if (c >= '1' && c < '9') ++c; add_char_buff(&readbuf2, c); - /* the expression register should be re-evaluated */ + // the expression register should be re-evaluated if (c == '=') { add_char_buff(&readbuf2, CAR); @@ -806,7 +805,7 @@ start_redo(long count, int old_redo) c = read_redo(FALSE, old_redo); } - if (c == 'v') /* redo Visual */ + if (c == 'v') // redo Visual { VIsual = curwin->w_cursor; VIsual_active = TRUE; @@ -816,15 +815,15 @@ start_redo(long count, int old_redo) c = read_redo(FALSE, old_redo); } - /* try to enter the count (in place of a previous count) */ + // try to enter the count (in place of a previous count) if (count) { - while (VIM_ISDIGIT(c)) /* skip "old" count */ + while (VIM_ISDIGIT(c)) // skip "old" count c = read_redo(FALSE, old_redo); add_num_buff(&readbuf2, count); } - /* copy from the redo buffer into the stuff buffer */ + // copy from the redo buffer into the stuff buffer add_char_buff(&readbuf2, c); copy_redo(old_redo); return OK; @@ -844,7 +843,7 @@ start_redo_ins(void) return FAIL; start_stuff(); - /* skip the count and the command character */ + // skip the count and the command character while ((c = read_redo(FALSE, FALSE)) != NUL) { if (vim_strchr((char_u *)"AaIiRrOo", c) != NULL) @@ -855,7 +854,7 @@ start_redo_ins(void) } } - /* copy the typed text from the redo buffer into the stuff buffer */ + // copy the typed text from the redo buffer into the stuff buffer copy_redo(FALSE); block_redo = TRUE; return OK; @@ -965,30 +964,30 @@ ins_typebuf( */ newoff = MAXMAPLEN + 4; newlen = typebuf.tb_len + addlen + newoff + 4 * (MAXMAPLEN + 4); - if (newlen < 0) /* string is getting too long */ + if (newlen < 0) // string is getting too long { - emsg(_(e_toocompl)); /* also calls flush_buffers */ + emsg(_(e_toocompl)); // also calls flush_buffers setcursor(); return FAIL; } s1 = alloc(newlen); - if (s1 == NULL) /* out of memory */ + if (s1 == NULL) // out of memory return FAIL; s2 = alloc(newlen); - if (s2 == NULL) /* out of memory */ + if (s2 == NULL) // out of memory { vim_free(s1); return FAIL; } typebuf.tb_buflen = newlen; - /* copy the old chars, before the insertion point */ + // copy the old chars, before the insertion point mch_memmove(s1 + newoff, typebuf.tb_buf + typebuf.tb_off, (size_t)offset); - /* copy the new chars */ + // copy the new chars mch_memmove(s1 + newoff + offset, str, (size_t)addlen); - /* copy the old chars, after the insertion point, including the NUL at - * the end */ + // copy the old chars, after the insertion point, including the NUL at + // the end mch_memmove(s1 + newoff + offset + addlen, typebuf.tb_buf + typebuf.tb_off + offset, (size_t)(typebuf.tb_len - offset + 1)); @@ -1009,7 +1008,7 @@ ins_typebuf( } typebuf.tb_len += addlen; - /* If noremap == REMAP_SCRIPT: do remap script-local mappings. */ + // If noremap == REMAP_SCRIPT: do remap script-local mappings. if (noremap == REMAP_SCRIPT) val = RM_SCRIPT; else if (noremap == REMAP_SKIP) @@ -1035,9 +1034,9 @@ ins_typebuf( typebuf.tb_noremap[typebuf.tb_off + i + offset] = (--nrm >= 0) ? val : RM_YES; - /* tb_maplen and tb_silent only remember the length of mapped and/or - * silent mappings at the start of the buffer, assuming that a mapped - * sequence doesn't result in typed characters. */ + // tb_maplen and tb_silent only remember the length of mapped and/or + // silent mappings at the start of the buffer, assuming that a mapped + // sequence doesn't result in typed characters. if (nottyped || typebuf.tb_maplen > offset) typebuf.tb_maplen += addlen; if (silent || typebuf.tb_silent > offset) @@ -1045,7 +1044,7 @@ ins_typebuf( typebuf.tb_silent += addlen; cmd_silent = TRUE; } - if (typebuf.tb_no_abbr_cnt && offset == 0) /* and not used for abbrev.s */ + if (typebuf.tb_no_abbr_cnt && offset == 0) // and not used for abbrev.s typebuf.tb_no_abbr_cnt += addlen; return OK; @@ -1084,7 +1083,7 @@ ins_char_typebuf(int c) */ int typebuf_changed( - int tb_change_cnt) /* old value of typebuf.tb_change_cnt */ + int tb_change_cnt) // old value of typebuf.tb_change_cnt { return (tb_change_cnt != 0 && (typebuf.tb_change_cnt != tb_change_cnt #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) @@ -1121,7 +1120,7 @@ del_typebuf(int len, int offset) int i; if (len == 0) - return; /* nothing to do */ + return; // nothing to do typebuf.tb_len -= len; @@ -1148,31 +1147,31 @@ del_typebuf(int len, int offset) typebuf.tb_noremap + typebuf.tb_off, (size_t)offset); typebuf.tb_off = MAXMAPLEN; } - /* adjust typebuf.tb_buf (include the NUL at the end) */ + // adjust typebuf.tb_buf (include the NUL at the end) mch_memmove(typebuf.tb_buf + typebuf.tb_off + offset, typebuf.tb_buf + i + len, (size_t)(typebuf.tb_len - offset + 1)); - /* adjust typebuf.tb_noremap[] */ + // adjust typebuf.tb_noremap[] mch_memmove(typebuf.tb_noremap + typebuf.tb_off + offset, typebuf.tb_noremap + i + len, (size_t)(typebuf.tb_len - offset)); } - if (typebuf.tb_maplen > offset) /* adjust tb_maplen */ + if (typebuf.tb_maplen > offset) // adjust tb_maplen { if (typebuf.tb_maplen < offset + len) typebuf.tb_maplen = offset; else typebuf.tb_maplen -= len; } - if (typebuf.tb_silent > offset) /* adjust tb_silent */ + if (typebuf.tb_silent > offset) // adjust tb_silent { if (typebuf.tb_silent < offset + len) typebuf.tb_silent = offset; else typebuf.tb_silent -= len; } - if (typebuf.tb_no_abbr_cnt > offset) /* adjust tb_no_abbr_cnt */ + if (typebuf.tb_no_abbr_cnt > offset) // adjust tb_no_abbr_cnt { if (typebuf.tb_no_abbr_cnt < offset + len) typebuf.tb_no_abbr_cnt = offset; @@ -1181,8 +1180,8 @@ del_typebuf(int len, int offset) } #if defined(FEAT_CLIENTSERVER) || defined(FEAT_EVAL) - /* Reset the flag that text received from a client or from feedkeys() - * was inserted in the typeahead buffer. */ + // Reset the flag that text received from a client or from feedkeys() + // was inserted in the typeahead buffer. typebuf_was_filled = FALSE; #endif if (++typebuf.tb_change_cnt == 0) @@ -1221,7 +1220,7 @@ gotchars(char_u *chars, int len) continue; } - /* Handle one byte at a time; no translation to be done. */ + // Handle one byte at a time; no translation to be done. for (i = 0; i < buflen; ++i) updatescript(buf[i]); @@ -1229,7 +1228,7 @@ gotchars(char_u *chars, int len) { buf[buflen] = NUL; add_buff(&recordbuff, buf, (long)buflen); - /* remember how many chars were last recorded */ + // remember how many chars were last recorded last_recorded_len += buflen; } buflen = 0; @@ -1237,12 +1236,12 @@ gotchars(char_u *chars, int len) may_sync_undo(); #ifdef FEAT_EVAL - /* output "debug mode" message next time in debug mode */ + // output "debug mode" message next time in debug mode debug_did_msg = FALSE; #endif - /* Since characters have been typed, consider the following to be in - * another mapping. Search string will be kept in history. */ + // Since characters have been typed, consider the following to be in + // another mapping. Search string will be kept in history. ++maptick; } @@ -1277,7 +1276,7 @@ alloc_typebuf(void) return FAIL; } typebuf.tb_buflen = TYPELEN_INIT; - typebuf.tb_off = MAXMAPLEN + 4; /* can insert without realloc */ + typebuf.tb_off = MAXMAPLEN + 4; // can insert without realloc typebuf.tb_len = 0; typebuf.tb_maplen = 0; typebuf.tb_silent = 0; @@ -1314,7 +1313,7 @@ save_typebuf(void) { init_typebuf(); saved_typebuf[curscript] = typebuf; - /* If out of memory: restore typebuf and close file. */ + // If out of memory: restore typebuf and close file. if (alloc_typebuf() == FAIL) { closescript(); @@ -1323,10 +1322,10 @@ save_typebuf(void) return OK; } -static int old_char = -1; /* character put back by vungetc() */ -static int old_mod_mask; /* mod_mask for ungotten character */ -static int old_mouse_row; /* mouse_row related to old_char */ -static int old_mouse_col; /* mouse_col related to old_char */ +static int old_char = -1; // character put back by vungetc() +static int old_mod_mask; // mod_mask for ungotten character +static int old_mouse_row; // mouse_row related to old_char +static int old_mouse_col; // mouse_col related to old_char /* * Save all three kinds of typeahead, so that the user must type at a prompt. @@ -1383,7 +1382,7 @@ restore_typeahead(tasave_T *tp) void openscript( char_u *name, - int directly) /* when TRUE execute directly */ + int directly) // when TRUE execute directly { if (curscript + 1 == NSCRIPT) { @@ -1398,13 +1397,13 @@ openscript( #ifdef FEAT_EVAL if (ignore_script) - /* Not reading from script, also don't open one. Warning message? */ + // Not reading from script, also don't open one. Warning message? return; #endif - if (scriptin[curscript] != NULL) /* already reading script */ + if (scriptin[curscript] != NULL) // already reading script ++curscript; - /* use NameBuff for expanded name */ + // use NameBuff for expanded name expand_env(name, NameBuff, MAXPATHL); if ((scriptin[curscript] = mch_fopen((char *)NameBuff, READBIN)) == NULL) { @@ -1433,9 +1432,9 @@ openscript( int save_msg_scroll = msg_scroll; State = NORMAL; - msg_scroll = FALSE; /* no msg scrolling in Normal mode */ - restart_edit = 0; /* don't go to Insert mode */ - p_im = FALSE; /* don't use 'insertmode' */ + msg_scroll = FALSE; // no msg scrolling in Normal mode + restart_edit = 0; // don't go to Insert mode + p_im = FALSE; // don't use 'insertmode' clear_oparg(&oa); finish_op = FALSE; @@ -1574,8 +1573,8 @@ vgetc(void) int i; #ifdef FEAT_EVAL - /* Do garbage collection when garbagecollect() was called previously and - * we are now at the toplevel. */ + // Do garbage collection when garbagecollect() was called previously and + // we are now at the toplevel. if (may_garbage_collect && want_garbage_collect) garbage_collect(FALSE); #endif @@ -1868,8 +1867,8 @@ plain_vgetc(void) while (c == K_IGNORE || c == K_VER_SCROLLBAR || c == K_HOR_SCROLLBAR); if (c == K_PS) - /* Only handle the first pasted character. Drop the rest, since we - * don't know what to do with it. */ + // Only handle the first pasted character. Drop the rest, since we + // don't know what to do with it. c = bracketed_paste(PASTE_ONE_CHAR, FALSE, NULL); return c; @@ -1934,8 +1933,8 @@ char_avail(void) int retval; #ifdef FEAT_EVAL - /* When test_override("char_avail", 1) was called pretend there is no - * typeahead. */ + // When test_override("char_avail", 1) was called pretend there is no + // typeahead. if (disable_char_avail_for_testing) return FALSE; #endif @@ -1962,7 +1961,7 @@ f_getchar(typval_T *argvars, typval_T *r parse_queued_messages(); #endif - /* Position the cursor. Needed after a message that ends in a space. */ + // Position the cursor. Needed after a message that ends in a space. windgoto(msg_row, msg_col); ++no_mapping; @@ -1970,16 +1969,16 @@ f_getchar(typval_T *argvars, typval_T *r for (;;) { if (argvars[0].v_type == VAR_UNKNOWN) - /* getchar(): blocking wait. */ + // getchar(): blocking wait. n = plain_vgetc(); else if (tv_get_number_chk(&argvars[0], &error) == 1) - /* getchar(1): only check if char avail */ + // getchar(1): only check if char avail n = vpeekc_any(); else if (error || vpeekc_any() == NUL) - /* illegal argument or getchar(0) and no char avail: return zero */ + // illegal argument or getchar(0) and no char avail: return zero n = 0; else - /* getchar(0) and char avail: return char */ + // getchar(0) and char avail: return char n = plain_vgetc(); if (n == K_IGNORE) @@ -1997,10 +1996,10 @@ f_getchar(typval_T *argvars, typval_T *r rettv->vval.v_number = n; if (IS_SPECIAL(n) || mod_mask != 0) { - char_u temp[10]; /* modifier: 3, mbyte-char: 6, NUL: 1 */ + char_u temp[10]; // modifier: 3, mbyte-char: 6, NUL: 1 int i = 0; - /* Turn a special key into three bytes, plus modifier. */ + // Turn a special key into three bytes, plus modifier. if (mod_mask != 0) { temp[i++] = K_SPECIAL; @@ -2032,8 +2031,8 @@ f_getchar(typval_T *argvars, typval_T *r if (row >= 0 && col >= 0) { - /* Find the window at the mouse coordinates and compute the - * text position. */ + // Find the window at the mouse coordinates and compute the + // text position. win = mouse_find_win(&row, &col, FIND_POPUP); if (win == NULL) return; @@ -2572,7 +2571,7 @@ handle_mapping( else setcursor(); flush_buffers(FLUSH_MINIMAL); - *mapdepth = 0; /* for next one */ + *mapdepth = 0; // for next one *keylenp = keylen; return map_result_fail; } @@ -2713,15 +2712,15 @@ vungetc(int c) vgetorpeek(int advance) { int c, c1; - int timedout = FALSE; /* waited for more than 1 second - for mapping to complete */ - int mapdepth = 0; /* check for recursive mapping */ - int mode_deleted = FALSE; /* set when mode has been deleted */ + int timedout = FALSE; // waited for more than 1 second + // for mapping to complete + int mapdepth = 0; // check for recursive mapping + int mode_deleted = FALSE; // set when mode has been deleted #ifdef FEAT_CMDL_INFO int new_wcol, new_wrow; #endif #ifdef FEAT_GUI - int shape_changed = FALSE; /* adjusted cursor shape */ + int shape_changed = FALSE; // adjusted cursor shape #endif int n; int old_wcol, old_wrow; @@ -2767,13 +2766,13 @@ vgetorpeek(int advance) { if (advance) { - /* KeyTyped = FALSE; When the command that stuffed something - * was typed, behave like the stuffed command was typed. - * needed for CTRL-W CTRL-] to open a fold, for example. */ + // KeyTyped = FALSE; When the command that stuffed something + // was typed, behave like the stuffed command was typed. + // needed for CTRL-W CTRL-] to open a fold, for example. KeyStuffed = TRUE; } if (typebuf.tb_no_abbr_cnt == 0) - typebuf.tb_no_abbr_cnt = 1; /* no abbreviations now */ + typebuf.tb_no_abbr_cnt = 1; // no abbreviations now } else { @@ -2798,10 +2797,10 @@ vgetorpeek(int advance) if (typebuf.tb_maplen) line_breakcheck(); else - ui_breakcheck(); /* check for CTRL-C */ + ui_breakcheck(); // check for CTRL-C if (got_int) { - /* flush all input */ + // flush all input c = inchar(typebuf.tb_buf, typebuf.tb_buflen - 1, 0L); /* @@ -2820,8 +2819,8 @@ vgetorpeek(int advance) if (advance) { - /* Also record this character, it might be needed to - * get out of Insert mode. */ + // Also record this character, it might be needed to + // get out of Insert mode. *typebuf.tb_buf = c; gotchars(typebuf.tb_buf, 1); } @@ -2852,7 +2851,7 @@ vgetorpeek(int advance) * get a character: 2. from the typeahead buffer */ c = typebuf.tb_buf[typebuf.tb_off]; - if (advance) /* remove chars from tb_buf */ + if (advance) // remove chars from tb_buf { cmd_silent = (typebuf.tb_silent > 0); if (typebuf.tb_maplen > 0) @@ -2860,7 +2859,7 @@ vgetorpeek(int advance) else { KeyTyped = TRUE; - /* write char to script file(s) */ + // write char to script file(s) gotchars(typebuf.tb_buf + typebuf.tb_off, 1); } @@ -2911,7 +2910,7 @@ vgetorpeek(int advance) mode_deleted = TRUE; } #ifdef FEAT_GUI - /* may show a different cursor shape */ + // may show a different cursor shape if (gui.in_use && State != NORMAL && !cmd_silent) { int save_State; @@ -2927,7 +2926,7 @@ vgetorpeek(int advance) old_wcol = curwin->w_wcol; old_wrow = curwin->w_wrow; - /* move cursor left, if possible */ + // move cursor left, if possible if (curwin->w_cursor.col != 0) { if (curwin->w_wcol > 0) @@ -2956,7 +2955,7 @@ vgetorpeek(int advance) + curwin->w_wcol / curwin->w_width; curwin->w_wcol %= curwin->w_width; curwin->w_wcol += curwin_col_off(); - col = 0; /* no correction needed */ + col = 0; // no correction needed } else { @@ -2972,8 +2971,8 @@ vgetorpeek(int advance) } if (has_mbyte && col > 0 && curwin->w_wcol > 0) { - /* Correct when the cursor is on the right halve - * of a double-wide character. */ + // Correct when the cursor is on the right halve + // of a double-wide character. ptr = ml_get_curline(); col -= (*mb_head_off)(ptr, ptr + col); if ((*mb_ptr2cells)(ptr + col) > 1) @@ -2990,15 +2989,15 @@ vgetorpeek(int advance) curwin->w_wrow = old_wrow; } if (c < 0) - continue; /* end of input script reached */ - - /* Allow mapping for just typed characters. When we get here c - * is the number of extra bytes and typebuf.tb_len is 1. */ + continue; // end of input script reached + + // Allow mapping for just typed characters. When we get here c + // is the number of extra bytes and typebuf.tb_len is 1. for (n = 1; n <= c; ++n) typebuf.tb_noremap[typebuf.tb_off + n] = RM_YES; typebuf.tb_len += c; - /* buffer full, don't map */ + // buffer full, don't map if (typebuf.tb_len >= typebuf.tb_maplen + MAXMAPLEN) { timedout = TRUE; @@ -3011,20 +3010,20 @@ vgetorpeek(int advance) static int tc = 0; #endif - /* No typeahead left and inside ":normal". Must return - * something to avoid getting stuck. When an incomplete - * mapping is present, behave like it timed out. */ + // No typeahead left and inside ":normal". Must return + // something to avoid getting stuck. When an incomplete + // mapping is present, behave like it timed out. if (typebuf.tb_len > 0) { timedout = TRUE; continue; } - /* When 'insertmode' is set, ESC just beeps in Insert - * mode. Use CTRL-L to make edit() return. - * For the command line only CTRL-C always breaks it. - * For the cmdline window: Alternate between ESC and - * CTRL-C: ESC for most situations and CTRL-C to close the - * cmdline window. */ + // When 'insertmode' is set, ESC just beeps in Insert + // mode. Use CTRL-L to make edit() return. + // For the command line only CTRL-C always breaks it. + // For the cmdline window: Alternate between ESC and + // CTRL-C: ESC for most situations and CTRL-C to close the + // cmdline window. if (p_im && (State & INSERT)) c = Ctrl_L; #ifdef FEAT_TERMINAL @@ -3048,18 +3047,18 @@ vgetorpeek(int advance) /* * get a character: 3. from the user - update display */ - /* In insert mode a screen update is skipped when characters - * are still available. But when those available characters - * are part of a mapping, and we are going to do a blocking - * wait here. Need to update the screen to display the - * changed text so far. Also for when 'lazyredraw' is set and - * redrawing was postponed because there was something in the - * input buffer (e.g., termresponse). */ + // In insert mode a screen update is skipped when characters + // are still available. But when those available characters + // are part of a mapping, and we are going to do a blocking + // wait here. Need to update the screen to display the + // changed text so far. Also for when 'lazyredraw' is set and + // redrawing was postponed because there was something in the + // input buffer (e.g., termresponse). if (((State & INSERT) != 0 || p_lz) && (State & CMDLINE) == 0 && advance && must_redraw != 0 && !need_wait_return) { update_screen(0); - setcursor(); /* put cursor back where it belongs */ + setcursor(); // put cursor back where it belongs } /* @@ -3076,18 +3075,18 @@ vgetorpeek(int advance) if (((State & (NORMAL | INSERT)) || State == LANGMAP) && State != HITRETURN) { - /* this looks nice when typing a dead character map */ + // this looks nice when typing a dead character map if (State & INSERT && ptr2cells(typebuf.tb_buf + typebuf.tb_off + typebuf.tb_len - 1) == 1) { edit_putchar(typebuf.tb_buf[typebuf.tb_off + typebuf.tb_len - 1], FALSE); - setcursor(); /* put cursor back where it belongs */ + setcursor(); // put cursor back where it belongs c1 = 1; } #ifdef FEAT_CMDL_INFO - /* need to use the col and row from above here */ + // need to use the col and row from above here old_wcol = curwin->w_wcol; old_wrow = curwin->w_wrow; curwin->w_wcol = new_wcol; @@ -3103,7 +3102,7 @@ vgetorpeek(int advance) #endif } - /* this looks nice when typing a dead character map */ + // this looks nice when typing a dead character map if ((State & CMDLINE) #if defined(FEAT_CRYPT) || defined(FEAT_EVAL) && cmdline_star == 0 @@ -3156,37 +3155,37 @@ vgetorpeek(int advance) if (State & CMDLINE) unputcmdline(); else - setcursor(); /* put cursor back where it belongs */ + setcursor(); // put cursor back where it belongs } if (c < 0) - continue; /* end of input script reached */ - if (c == NUL) /* no character available */ + continue; // end of input script reached + if (c == NUL) // no character available { if (!advance) break; - if (wait_tb_len > 0) /* timed out */ + if (wait_tb_len > 0) // timed out { timedout = TRUE; continue; } } else - { /* allow mapping for just typed characters */ + { // allow mapping for just typed characters while (typebuf.tb_buf[typebuf.tb_off + typebuf.tb_len] != NUL) typebuf.tb_noremap[typebuf.tb_off + typebuf.tb_len++] = RM_YES; #ifdef HAVE_INPUT_METHOD - /* Get IM status right after getting keys, not after the - * timeout for a mapping (focus may be lost by then). */ + // Get IM status right after getting keys, not after the + // timeout for a mapping (focus may be lost by then). vgetc_im_active = im_get_status(); #endif } - } /* for (;;) */ - } /* if (!character from stuffbuf) */ - - /* if advance is FALSE don't loop on NULs */ + } // for (;;) + } // if (!character from stuffbuf) + + // if advance is FALSE don't loop on NULs } while ((c < 0 && c != K_CANCEL) || (advance && c == NUL)); /* @@ -3199,20 +3198,20 @@ vgetorpeek(int advance) if (c == ESC && !mode_deleted && !no_mapping && mode_displayed) { if (typebuf.tb_len && !KeyTyped) - redraw_cmdline = TRUE; /* delete mode later */ + redraw_cmdline = TRUE; // delete mode later else unshowmode(FALSE); } else if (c != ESC && mode_deleted) { if (typebuf.tb_len && !KeyTyped) - redraw_cmdline = TRUE; /* show mode later */ + redraw_cmdline = TRUE; // show mode later else showmode(); } } #ifdef FEAT_GUI - /* may unshow different cursor shape */ + // may unshow different cursor shape if (gui.in_use && shape_changed) gui_update_cursor(TRUE, FALSE); #endif @@ -3260,14 +3259,14 @@ vgetorpeek(int advance) inchar( char_u *buf, int maxlen, - long wait_time) /* milli seconds */ + long wait_time) // milli seconds { - int len = 0; /* init for GCC */ - int retesc = FALSE; /* return ESC with gotint */ + int len = 0; // init for GCC + int retesc = FALSE; // return ESC with gotint int script_char; int tb_change_cnt = typebuf.tb_change_cnt; - if (wait_time == -1L || wait_time > 100L) /* flush output before waiting */ + if (wait_time == -1L || wait_time > 100L) // flush output before waiting { cursor_on(); out_flush_cursor(FALSE, FALSE); @@ -3284,10 +3283,10 @@ inchar( */ if (State != HITRETURN) { - did_outofmem_msg = FALSE; /* display out of memory message (again) */ - did_swapwrite_msg = FALSE; /* display swap file write error again */ + did_outofmem_msg = FALSE; // display out of memory message (again) + did_swapwrite_msg = FALSE; // display swap file write error again } - undo_off = FALSE; /* restart undo now */ + undo_off = FALSE; // restart undo now /* * Get a character from a script file if there is one. @@ -3306,9 +3305,9 @@ inchar( if (got_int || (script_char = getc(scriptin[curscript])) < 0) { - /* Reached EOF. - * Careful: closescript() frees typebuf.tb_buf[] and buf[] may - * point inside typebuf.tb_buf[]. Don't use buf[] after this! */ + // Reached EOF. + // Careful: closescript() frees typebuf.tb_buf[] and buf[] may + // point inside typebuf.tb_buf[]. Don't use buf[] after this! closescript(); /* * When reading script file is interrupted, return an ESC to get @@ -3327,7 +3326,7 @@ inchar( } } - if (script_char < 0) /* did not get a character from script */ + if (script_char < 0) // did not get a character from script { /* * If we got an interrupt, skip all previously typed characters and @@ -3365,14 +3364,14 @@ inchar( len = ui_inchar(buf, maxlen / 3, wait_time, tb_change_cnt); } - /* If the typebuf was changed further down, it is like nothing was added by - * this call. */ + // If the typebuf was changed further down, it is like nothing was added by + // this call. if (typebuf_changed(tb_change_cnt)) return 0; - /* Note the change in the typeahead buffer, this matters for when - * vgetorpeek() is called recursively, e.g. using getchar(1) in a timer - * function. */ + // Note the change in the typeahead buffer, this matters for when + // vgetorpeek() is called recursively, e.g. using getchar(1) in a timer + // function. if (len > 0 && ++typebuf.tb_change_cnt == 0) typebuf.tb_change_cnt = 1; @@ -3400,15 +3399,15 @@ fix_input_buffer(char_u *buf, int len) for (i = len; --i >= 0; ++p) { #ifdef FEAT_GUI - /* When the GUI is used any character can come after a CSI, don't - * escape it. */ + // When the GUI is used any character can come after a CSI, don't + // escape it. if (gui.in_use && p[0] == CSI && i >= 2) { p += 2; i -= 2; } # ifndef MSWIN - /* When the GUI is not used CSI needs to be escaped. */ + // When the GUI is not used CSI needs to be escaped. else if (!gui.in_use && p[0] == CSI) { mch_memmove(p + 3, p + 1, (size_t)i); diff --git a/src/gui.c b/src/gui.c --- a/src/gui.c +++ b/src/gui.c @@ -10,7 +10,7 @@ #include "vim.h" -/* Structure containing all the GUI information */ +// Structure containing all the GUI information gui_T gui; #if !defined(FEAT_GUI_GTK) @@ -38,7 +38,7 @@ static void gui_do_fork(void); static int gui_read_child_pipe(int fd); -/* Return values for gui_read_child_pipe */ +// Return values for gui_read_child_pipe enum { GUI_CHILD_IO_ERROR, GUI_CHILD_OK, @@ -48,8 +48,8 @@ enum { static void gui_attempt_start(void); -static int can_update_cursor = TRUE; /* can display the cursor */ -static int disable_flush = 0; /* If > 0, gui_mch_flush() is disabled. */ +static int can_update_cursor = TRUE; // can display the cursor +static int disable_flush = 0; // If > 0, gui_mch_flush() is disabled. /* * The Athena scrollbars can move the thumb to after the end of the scrollbar, @@ -78,9 +78,9 @@ gui_start(char_u *arg UNUSED) old_term = vim_strsave(T_NAME); - settmode(TMODE_COOK); /* stop RAW mode */ + settmode(TMODE_COOK); // stop RAW mode if (full_screen) - cursor_on(); /* needed for ":gui" in .vimrc */ + cursor_on(); // needed for ":gui" in .vimrc full_screen = FALSE; ++recursive; @@ -125,30 +125,29 @@ gui_start(char_u *arg UNUSED) #endif { #ifdef FEAT_GUI_GTK - /* If there is 'f' in 'guioptions' and specify -g argument, - * gui_mch_init_check() was not called yet. */ + // If there is 'f' in 'guioptions' and specify -g argument, + // gui_mch_init_check() was not called yet. if (gui_mch_init_check() != OK) getout_preserve_modified(1); #endif gui_attempt_start(); } - if (!gui.in_use) /* failed to start GUI */ + if (!gui.in_use) // failed to start GUI { - /* Back to old term settings - * - * FIXME: If we got here because a child process failed and flagged to - * the parent to resume, and X11 is enabled with FEAT_TITLE, this will - * hit an X11 I/O error and do a longjmp(), leaving recursive - * permanently set to 1. This is probably not as big a problem as it - * sounds, because gui_mch_init() in both gui_x11.c and gui_gtk_x11.c - * return "OK" unconditionally, so it would be very difficult to - * actually hit this case. - */ + // Back to old term settings + // + // FIXME: If we got here because a child process failed and flagged to + // the parent to resume, and X11 is enabled with FEAT_TITLE, this will + // hit an X11 I/O error and do a longjmp(), leaving recursive + // permanently set to 1. This is probably not as big a problem as it + // sounds, because gui_mch_init() in both gui_x11.c and gui_gtk_x11.c + // return "OK" unconditionally, so it would be very difficult to + // actually hit this case. termcapinit(old_term); - settmode(TMODE_RAW); /* restart RAW mode */ + settmode(TMODE_RAW); // restart RAW mode #ifdef FEAT_TITLE - set_title_defaults(); /* set 'title' and 'icon' again */ + set_title_defaults(); // set 'title' and 'icon' again #endif #if defined(GUI_MAY_SPAWN) && defined(EXPERIMENTAL_GUI_CMD) if (msg) @@ -158,8 +157,8 @@ gui_start(char_u *arg UNUSED) vim_free(old_term); - /* If the GUI started successfully, trigger the GUIEnter event, otherwise - * the GUIFailed event. */ + // If the GUI started successfully, trigger the GUIEnter event, otherwise + // the GUIFailed event. gui_mch_update(); apply_autocmds(gui.in_use ? EVENT_GUIENTER : EVENT_GUIFAILED, NULL, NULL, FALSE, curbuf); @@ -202,7 +201,7 @@ gui_attempt_start(void) set_vim_var_nr(VV_WINDOWID, (long)x11_window); # endif - /* Display error messages in a dialog now. */ + // Display error messages in a dialog now. display_errors(); } #endif @@ -211,7 +210,7 @@ gui_attempt_start(void) #ifdef GUI_MAY_FORK -/* for waitpid() */ +// for waitpid() # if defined(HAVE_SYS_WAIT_H) || defined(HAVE_UNION_WAIT) # include # endif @@ -231,38 +230,38 @@ gui_attempt_start(void) static void gui_do_fork(void) { - int pipefd[2]; /* pipe between parent and child */ + int pipefd[2]; // pipe between parent and child int pipe_error; int status; int exit_status; pid_t pid = -1; - /* Setup a pipe between the child and the parent, so that the parent - * knows when the child has done the setsid() call and is allowed to - * exit. */ + // Setup a pipe between the child and the parent, so that the parent + // knows when the child has done the setsid() call and is allowed to + // exit. pipe_error = (pipe(pipefd) < 0); pid = fork(); - if (pid < 0) /* Fork error */ + if (pid < 0) // Fork error { emsg(_("E851: Failed to create a new process for the GUI")); return; } - else if (pid > 0) /* Parent */ + else if (pid > 0) // Parent { - /* Give the child some time to do the setsid(), otherwise the - * exit() may kill the child too (when starting gvim from inside a - * gvim). */ + // Give the child some time to do the setsid(), otherwise the + // exit() may kill the child too (when starting gvim from inside a + // gvim). if (!pipe_error) { - /* The read returns when the child closes the pipe (or when - * the child dies for some reason). */ + // The read returns when the child closes the pipe (or when + // the child dies for some reason). close(pipefd[1]); status = gui_read_child_pipe(pipefd[0]); if (status == GUI_CHILD_FAILED) { - /* The child failed to start the GUI, so the caller must - * continue. There may be more error information written - * to stderr by the child. */ + // The child failed to start the GUI, so the caller must + // continue. There may be more error information written + // to stderr by the child. # ifdef __NeXT__ wait4(pid, &exit_status, 0, (struct rusage *)0); # else @@ -275,14 +274,14 @@ gui_do_fork(void) { pipe_error = TRUE; } - /* else GUI_CHILD_OK: parent exit */ + // else GUI_CHILD_OK: parent exit } if (pipe_error) ui_delay(301L, TRUE); - /* When swapping screens we may need to go to the next line, e.g., - * after a hit-enter prompt and using ":gui". */ + // When swapping screens we may need to go to the next line, e.g., + // after a hit-enter prompt and using ":gui". if (newline_on_exit) mch_errmsg("\r\n"); @@ -292,10 +291,10 @@ gui_do_fork(void) */ _exit(0); } - /* Child */ + // Child #ifdef FEAT_GUI_GTK - /* Call gtk_init_check() here after fork(). See gui_init_check(). */ + // Call gtk_init_check() here after fork(). See gui_init_check(). if (gui_mch_init_check() != OK) getout_preserve_modified(1); #endif @@ -315,14 +314,14 @@ gui_do_fork(void) close(pipefd[0]); # if defined(FEAT_GUI_GNOME) && defined(FEAT_SESSION) - /* Tell the session manager our new PID */ + // Tell the session manager our new PID gui_mch_forked(); # endif - /* Try to start the GUI */ + // Try to start the GUI gui_attempt_start(); - /* Notify the parent */ + // Notify the parent if (!pipe_error) { if (gui.in_use) @@ -332,7 +331,7 @@ gui_do_fork(void) close(pipefd[1]); } - /* If we failed to start the GUI, exit now. */ + // If we failed to start the GUI, exit now. if (!gui.in_use) getout_preserve_modified(1); } @@ -364,7 +363,7 @@ gui_read_child_pipe(int fd) return GUI_CHILD_FAILED; } -#endif /* GUI_MAY_FORK */ +#endif // GUI_MAY_FORK /* * Call this when vim starts up, whether or not the GUI is started @@ -372,8 +371,8 @@ gui_read_child_pipe(int fd) void gui_prepare(int *argc, char **argv) { - gui.in_use = FALSE; /* No GUI yet (maybe later) */ - gui.starting = FALSE; /* No GUI yet (maybe later) */ + gui.in_use = FALSE; // No GUI yet (maybe later) + gui.starting = FALSE; // No GUI yet (maybe later) gui_mch_prepare(argc, argv); } @@ -397,7 +396,7 @@ gui_init_check(void) gui.shell_created = FALSE; gui.dying = FALSE; - gui.in_focus = TRUE; /* so the guicursor setting works */ + gui.in_focus = TRUE; // so the guicursor setting works gui.dragged_sb = SBAR_NONE; gui.dragged_wp = NULL; gui.pointer_hidden = FALSE; @@ -441,7 +440,7 @@ gui_init_check(void) gui.menu_font = NOFONT; # endif # endif - gui.menu_is_active = TRUE; /* default: include menu */ + gui.menu_is_active = TRUE; // default: include menu # ifndef FEAT_GUI_GTK gui.menu_height = MENU_DEFAULT_HEIGHT; gui.menu_width = 0; @@ -499,7 +498,7 @@ gui_init(void) clip_init(TRUE); - /* If can't initialize, don't try doing the rest */ + // If can't initialize, don't try doing the rest if (gui_init_check() == FAIL) { --recursive; @@ -596,8 +595,8 @@ gui_init(void) { stat_T s; - /* if ".gvimrc" file is not owned by user, set 'secure' - * mode */ + // if ".gvimrc" file is not owned by user, set 'secure' + // mode if (mch_stat(GVIMRC_FILE, &s) || s.st_uid != getuid()) secure = p_secure; } @@ -638,19 +637,19 @@ gui_init(void) --recursive; } - /* If recursive call opened the shell, return here from the first call */ + // If recursive call opened the shell, return here from the first call if (gui.in_use) return; /* * Create the GUI shell. */ - gui.in_use = TRUE; /* Must be set after menus have been set up */ + gui.in_use = TRUE; // Must be set after menus have been set up if (gui_mch_init() == FAIL) goto error; - /* Avoid a delay for an error message that was printed in the terminal - * where Vim was started. */ + // Avoid a delay for an error message that was printed in the terminal + // where Vim was started. emsg_on_display = FALSE; msg_scrolled = 0; clear_sb_text(TRUE); @@ -686,7 +685,7 @@ gui_init(void) gui.num_rows = Rows; gui_reset_scroll_region(); - /* Create initial scrollbars */ + // Create initial scrollbars FOR_ALL_WINDOWS(wp) { gui_create_scrollbar(&wp->w_scrollbars[SBAR_LEFT], SBAR_LEFT, wp); @@ -701,10 +700,10 @@ gui_init(void) sign_gui_started(); #endif - /* Configure the desired menu and scrollbars */ + // Configure the desired menu and scrollbars gui_init_which_components(NULL); - /* All components of the GUI have been created now */ + // All components of the GUI have been created now gui.shell_created = TRUE; #ifdef FEAT_GUI_MSWIN @@ -723,8 +722,8 @@ gui_init(void) # endif #endif #if defined(FEAT_GUI_MOTIF) && defined(FEAT_MENU) - /* Need to set the size of the menubar after all the menus have been - * created. */ + // Need to set the size of the menubar after all the menus have been + // created. gui_mch_compute_menu_height((Widget)0); #endif @@ -739,16 +738,16 @@ gui_init(void) #endif init_gui_options(); #ifdef FEAT_ARABIC - /* Our GUI can't do bidi. */ + // Our GUI can't do bidi. p_tbidi = FALSE; #endif #if defined(FEAT_GUI_GTK) - /* Give GTK+ a chance to put all widget's into place. */ + // Give GTK+ a chance to put all widget's into place. gui_mch_update(); # ifdef FEAT_MENU - /* If there is no 'm' in 'guioptions' we need to remove the menu now. - * It was still there to make F10 work. */ + // If there is no 'm' in 'guioptions' we need to remove the menu now. + // It was still there to make F10 work. if (vim_strchr(p_go, GO_MENUS) == NULL) { --gui.starting; @@ -758,19 +757,19 @@ gui_init(void) } # endif - /* Now make sure the shell fits on the screen. */ + // Now make sure the shell fits on the screen. if (gui_mch_maximized()) gui_set_shellsize(FALSE, TRUE, RESIZE_BOTH); else gui_set_shellsize(TRUE, TRUE, RESIZE_BOTH); #endif - /* When 'lines' was set while starting up the topframe may have to be - * resized. */ + // When 'lines' was set while starting up the topframe may have to be + // resized. win_new_shellsize(); #ifdef FEAT_BEVAL_GUI - /* Always create the Balloon Evaluation area, but disable it when - * 'ballooneval' is off. */ + // Always create the Balloon Evaluation area, but disable it when + // 'ballooneval' is off. if (balloonEval != NULL) { # ifdef FEAT_VARTABS @@ -804,8 +803,8 @@ gui_init(void) if (!im_xim_isvalid_imactivate()) emsg(_("E599: Value of 'imactivatekey' is invalid")); #endif - /* When 'cmdheight' was set during startup it may not have taken - * effect yet. */ + // When 'cmdheight' was set during startup it may not have taken + // effect yet. if (p_ch != 1L) command_height(); @@ -814,7 +813,7 @@ gui_init(void) error2: #ifdef FEAT_GUI_X11 - /* undo gui_mch_init() */ + // undo gui_mch_init() gui_mch_uninit(); #endif @@ -827,8 +826,8 @@ error: void gui_exit(int rc) { - /* don't free the fonts, it leads to a BUS error - * richard@whitequeen.com Jul 99 */ + // don't free the fonts, it leads to a BUS error + // richard@whitequeen.com Jul 99 free_highlight_fonts(); gui.in_use = FALSE; gui_mch_exit(rc); @@ -850,7 +849,7 @@ gui_shell_closed(void) save_cmdmod = cmdmod; - /* Only exit when there are no changed files */ + // Only exit when there are no changed files exiting = TRUE; # ifdef FEAT_BROWSE cmdmod.browse = TRUE; @@ -858,14 +857,14 @@ gui_shell_closed(void) # if defined(FEAT_GUI_DIALOG) || defined(FEAT_CON_DIALOG) cmdmod.confirm = TRUE; # endif - /* If there are changed buffers, present the user with a dialog if - * possible, otherwise give an error message. */ + // If there are changed buffers, present the user with a dialog if + // possible, otherwise give an error message. if (!check_changed_any(FALSE, FALSE)) getout(0); exiting = FALSE; cmdmod = save_cmdmod; - gui_update_screen(); /* redraw, window may show changed buffer */ + gui_update_screen(); // redraw, window may show changed buffer } #endif @@ -894,26 +893,26 @@ gui_init_font(char_u *font_list, int fon else { #ifdef FEAT_XFONTSET - /* When using a fontset, the whole list of fonts is one name. */ + // When using a fontset, the whole list of fonts is one name. if (fontset) ret = gui_mch_init_font(font_list, TRUE); else #endif while (*font_list != NUL) { - /* Isolate one comma separated font name. */ + // Isolate one comma separated font name. (void)copy_option_part(&font_list, font_name, FONTLEN, ","); - /* Careful!!! The Win32 version of gui_mch_init_font(), when - * called with "*" will change p_guifont to the selected font - * name, which frees the old value. This makes font_list - * invalid. Thus when OK is returned here, font_list must no - * longer be used! */ + // Careful!!! The Win32 version of gui_mch_init_font(), when + // called with "*" will change p_guifont to the selected font + // name, which frees the old value. This makes font_list + // invalid. Thus when OK is returned here, font_list must no + // longer be used! if (gui_mch_init_font(font_name, FALSE) == OK) { #if !defined(FEAT_GUI_GTK) - /* If it's a Unicode font, try setting 'guifontwide' to a - * similar double-width font. */ + // If it's a Unicode font, try setting 'guifontwide' to a + // similar double-width font. if ((p_guifontwide == NULL || *p_guifontwide == NUL) && strstr((char *)font_name, "10646") != NULL) set_guifontwide(font_name); @@ -939,7 +938,7 @@ gui_init_font(char_u *font_list, int fon if (ret == OK) { #ifndef FEAT_GUI_GTK - /* Set normal font as current font */ + // Set normal font as current font # ifdef FEAT_XFONTSET if (gui.fontset != NOFONTSET) gui_mch_set_fontset(gui.fontset); @@ -961,7 +960,7 @@ gui_init_font(char_u *font_list, int fon set_guifontwide(char_u *name) { int i = 0; - char_u wide_name[FONTLEN + 10]; /* room for 2 * width and '*' */ + char_u wide_name[FONTLEN + 10]; // room for 2 * width and '*' char_u *wp = NULL; char_u *p; GuiFont font; @@ -973,18 +972,18 @@ set_guifontwide(char_u *name) if (*p == '-') { ++i; - if (i == 6) /* font type: change "--" to "-*-" */ + if (i == 6) // font type: change "--" to "-*-" { if (p[1] == '-') *wp++ = '*'; } - else if (i == 12) /* found the width */ + else if (i == 12) // found the width { ++p; i = getdigits(&p); if (i != 0) { - /* Double the width specification. */ + // Double the width specification. sprintf((char *)wp, "%d%s", i * 2, p); font = gui_mch_get_font(wide_name, FALSE); if (font != NOFONT) @@ -1000,7 +999,7 @@ set_guifontwide(char_u *name) } } } -#endif /* !FEAT_GUI_GTK */ +#endif // !FEAT_GUI_GTK /* * Get the font for 'guifontwide'. @@ -1013,14 +1012,14 @@ gui_get_wide_font(void) char_u font_name[FONTLEN]; char_u *p; - if (!gui.in_use) /* Can't allocate font yet, assume it's OK. */ - return OK; /* Will give an error message later. */ + if (!gui.in_use) // Can't allocate font yet, assume it's OK. + return OK; // Will give an error message later. if (p_guifontwide != NULL && *p_guifontwide != NUL) { for (p = p_guifontwide; *p != NUL; ) { - /* Isolate one comma separated font name. */ + // Isolate one comma separated font name. (void)copy_option_part(&p, font_name, FONTLEN, ","); font = gui_mch_get_font(font_name, FALSE); if (font != NOFONT) @@ -1032,7 +1031,7 @@ gui_get_wide_font(void) gui_mch_free_font(gui.wide_font); #ifdef FEAT_GUI_GTK - /* Avoid unnecessary overhead if 'guifontwide' is equal to 'guifont'. */ + // Avoid unnecessary overhead if 'guifontwide' is equal to 'guifont'. if (font != NOFONT && gui.norm_font != NOFONT && pango_font_description_equal(font, gui.norm_font)) { @@ -1081,8 +1080,8 @@ gui_check_pos(void) */ void gui_update_cursor( - int force, /* when TRUE, update even when not moved */ - int clear_selection)/* clear selection under cursor */ + int force, // when TRUE, update even when not moved + int clear_selection) // clear selection under cursor { int cur_width = 0; int cur_height = 0; @@ -1093,13 +1092,13 @@ gui_update_cursor( guicolor_T shape_fg = INVALCOLOR; guicolor_T shape_bg = INVALCOLOR; #endif - guicolor_T cfg, cbg, cc; /* cursor fore-/background color */ - int cattr; /* cursor attributes */ + guicolor_T cfg, cbg, cc; // cursor fore-/background color + int cattr; // cursor attributes int attr; attrentry_T *aep = NULL; - /* Don't update the cursor when halfway busy scrolling or the screen size - * doesn't match 'columns' and 'lines. ScreenLines[] isn't valid then. */ + // Don't update the cursor when halfway busy scrolling or the screen size + // doesn't match 'columns' and 'lines. ScreenLines[] isn't valid then. if (!can_update_cursor || screen_Columns != gui.num_cols || screen_Rows != gui.num_rows) return; @@ -1118,15 +1117,15 @@ gui_update_cursor( gui.cursor_row = gui.row; gui.cursor_col = gui.col; - /* Only write to the screen after ScreenLines[] has been initialized */ + // Only write to the screen after ScreenLines[] has been initialized if (!screen_cleared || ScreenLines == NULL) return; - /* Clear the selection if we are about to write over it */ + // Clear the selection if we are about to write over it if (clear_selection) clip_may_clear_selection(gui.row, gui.row); - /* Check that the cursor is inside the shell (resizing may have made - * it invalid) */ + // Check that the cursor is inside the shell (resizing may have made + // it invalid) if (gui.row >= screen_Rows || gui.col >= screen_Columns) return; @@ -1147,7 +1146,7 @@ gui_update_cursor( else id = shape->id; - /* get the colors and attributes for the cursor. Default is inverted */ + // get the colors and attributes for the cursor. Default is inverted cfg = INVALCOLOR; cbg = INVALCOLOR; cattr = HL_INVERSE; @@ -1292,16 +1291,16 @@ gui_update_cursor( if (has_mbyte && (*mb_off2cells)(LineOffset[gui.row] + gui.col, LineOffset[gui.row] + screen_Columns) > 1) { - /* Double wide character. */ + // Double wide character. if (shape->shape != SHAPE_VER) cur_width += gui.char_width; #ifdef FEAT_RIGHTLEFT if (CURSOR_BAR_RIGHT) { - /* gui.col points to the left halve of the character but - * the vertical line needs to be on the right halve. - * A double-wide horizontal line is also drawn from the - * right halve in gui_mch_draw_part_cursor(). */ + // gui.col points to the left halve of the character but + // the vertical line needs to be on the right halve. + // A double-wide horizontal line is also drawn from the + // right halve in gui_mch_draw_part_cursor(). col_off = TRUE; ++gui.col; } @@ -1313,7 +1312,7 @@ gui_update_cursor( --gui.col; #endif -#ifndef FEAT_GUI_MSWIN /* doesn't seem to work for MSWindows */ +#ifndef FEAT_GUI_MSWIN // doesn't seem to work for MSWindows gui.highlight_mask = ScreenAttrs[LineOffset[gui.row] + gui.col]; (void)gui_screenchar(LineOffset[gui.row] + gui.col, GUI_MON_TRS_CURSOR | GUI_MON_NOCLEAR, @@ -1347,7 +1346,7 @@ gui_position_components(int total_width int text_area_width; int text_area_height; - /* avoid that moving components around generates events */ + // avoid that moving components around generates events ++hold_gui_events; text_area_x = 0; @@ -1436,9 +1435,9 @@ gui_get_base_height(void) if (gui.which_scrollbars[SBAR_BOTTOM]) base_height += gui.scrollbar_height; #ifdef FEAT_GUI_GTK - /* We can't take the sizes properly into account until anything is - * realized. Therefore we recalculate all the values here just before - * setting the size. (--mdcki) */ + // We can't take the sizes properly into account until anything is + // realized. Therefore we recalculate all the values here just before + // setting the size. (--mdcki) #else # ifdef FEAT_MENU if (gui.menu_is_active) @@ -1477,7 +1476,7 @@ gui_resize_shell(int pixel_width, int pi { static int busy = FALSE; - if (!gui.shell_created) /* ignore when still initializing */ + if (!gui.shell_created) // ignore when still initializing return; /* @@ -1496,7 +1495,7 @@ again: new_pixel_height = 0; busy = TRUE; - /* Flush pending output before redrawing */ + // Flush pending output before redrawing out_flush(); gui.num_cols = (pixel_width - gui_get_base_width()) / gui.char_width; @@ -1512,8 +1511,8 @@ again: if (State == ASKMORE || State == CONFIRM) gui.row = gui.num_rows; - /* Only comparing Rows and Columns may be sufficient, but let's stay on - * the safe side. */ + // Only comparing Rows and Columns may be sufficient, but let's stay on + // the safe side. if (gui.num_rows != screen_Rows || gui.num_cols != screen_Columns || gui.num_rows != Rows || gui.num_cols != Columns) shell_resized(); @@ -1526,9 +1525,9 @@ again: busy = FALSE; - /* We may have been called again while redrawing the screen. - * Need to do it all again with the latest size then. But only if the size - * actually changed. */ + // We may have been called again while redrawing the screen. + // Need to do it all again with the latest size then. But only if the size + // actually changed. if (new_pixel_height) { if (pixel_width == new_pixel_width && pixel_height == new_pixel_height) @@ -1552,8 +1551,8 @@ again: gui_may_resize_shell(void) { if (new_pixel_height) - /* careful: gui_resize_shell() may postpone the resize again if we - * were called indirectly by it */ + // careful: gui_resize_shell() may postpone the resize again if we + // were called indirectly by it gui_resize_shell(new_pixel_width, new_pixel_height); } @@ -1576,7 +1575,7 @@ gui_get_shellsize(void) gui_set_shellsize( int mustset UNUSED, int fit_to_display, - int direction) /* RESIZE_HOR, RESIZE_VER */ + int direction) // RESIZE_HOR, RESIZE_VER { int base_width; int base_height; @@ -1596,8 +1595,8 @@ gui_set_shellsize( return; #if defined(MSWIN) || defined(FEAT_GUI_GTK) - /* If not setting to a user specified size and maximized, calculate the - * number of characters that fit in the maximized window. */ + // If not setting to a user specified size and maximized, calculate the + // number of characters that fit in the maximized window. if (!mustset && (vim_strchr(p_go, GO_KEEPWINSIZE) != NULL || gui_mch_maximized())) { @@ -1609,7 +1608,7 @@ gui_set_shellsize( base_width = gui_get_base_width(); base_height = gui_get_base_height(); if (fit_to_display) - /* Remember the original window position. */ + // Remember the original window position. (void)gui_mch_get_winpos(&x, &y); width = Columns * gui.char_width + base_width; @@ -1640,7 +1639,7 @@ gui_set_shellsize( #ifdef FEAT_GUI_GTK if (did_adjust == 2 || (width + gui.char_width >= screen_w && height + gui.char_height >= screen_h)) - /* don't unmaximize if at maximum size */ + // don't unmaximize if at maximum size un_maximize = FALSE; #endif } @@ -1655,8 +1654,8 @@ gui_set_shellsize( #ifdef FEAT_GUI_GTK if (un_maximize) { - /* If the window size is smaller than the screen unmaximize the - * window, otherwise resizing won't work. */ + // If the window size is smaller than the screen unmaximize the + // window, otherwise resizing won't work. gui_mch_get_screen_dimensions(&screen_w, &screen_h); if ((width + gui.char_width < screen_w || height + gui.char_height * 2 < screen_h) @@ -1670,9 +1669,9 @@ gui_set_shellsize( if (fit_to_display && x >= 0 && y >= 0) { - /* Some window managers put the Vim window left of/above the screen. - * Only change the position if it wasn't already negative before - * (happens on MS-Windows with a secondary monitor). */ + // Some window managers put the Vim window left of/above the screen. + // Only change the position if it wasn't already negative before + // (happens on MS-Windows with a secondary monitor). gui_mch_update(); if (gui_mch_get_winpos(&x, &y) == OK && (x < 0 || y < 0)) gui_mch_set_winpos(x < 0 ? 0 : x, y < 0 ? 0 : y); @@ -1707,18 +1706,18 @@ gui_reset_scroll_region(void) static void gui_start_highlight(int mask) { - if (mask > HL_ALL) /* highlight code */ + if (mask > HL_ALL) // highlight code gui.highlight_mask = mask; - else /* mask */ + else // mask gui.highlight_mask |= mask; } void gui_stop_highlight(int mask) { - if (mask > HL_ALL) /* highlight code */ + if (mask > HL_ALL) // highlight code gui.highlight_mask = HL_NORMAL; - else /* mask */ + else // mask gui.highlight_mask &= ~mask; } @@ -1733,12 +1732,12 @@ gui_clear_block( int row2, int col2) { - /* Clear the selection if we are about to write over it */ + // Clear the selection if we are about to write over it clip_may_clear_selection(row1, row2); gui_mch_clear_block(row1, col1, row2, col2); - /* Invalidate cursor if it was in this block */ + // Invalidate cursor if it was in this block if ( gui.cursor_row >= row1 && gui.cursor_row <= row2 && gui.cursor_col >= col1 && gui.cursor_col <= col2) gui.cursor_is_valid = FALSE; @@ -1761,11 +1760,11 @@ gui_write( { char_u *p; int arg1 = 0, arg2 = 0; - int force_cursor = FALSE; /* force cursor update */ + int force_cursor = FALSE; // force cursor update int force_scrollbar = FALSE; static win_T *old_curwin = NULL; -/* #define DEBUG_GUI_WRITE */ +// #define DEBUG_GUI_WRITE #ifdef DEBUG_GUI_WRITE { int i; @@ -1810,19 +1809,19 @@ gui_write( } switch (*p) { - case 'C': /* Clear screen */ + case 'C': // Clear screen clip_scroll_selection(9999); gui_mch_clear_all(); gui.cursor_is_valid = FALSE; force_scrollbar = TRUE; break; - case 'M': /* Move cursor */ + case 'M': // Move cursor gui_set_cursor(arg1, arg2); break; - case 's': /* force cursor (shape) update */ + case 's': // force cursor (shape) update force_cursor = TRUE; break; - case 'R': /* Set scroll region */ + case 'R': // Set scroll region if (arg1 < arg2) { gui.scroll_region_top = arg1; @@ -1834,7 +1833,7 @@ gui_write( gui.scroll_region_bot = arg1; } break; - case 'V': /* Set vertical scroll region */ + case 'V': // Set vertical scroll region if (arg1 < arg2) { gui.scroll_region_left = arg1; @@ -1846,33 +1845,33 @@ gui_write( gui.scroll_region_right = arg1; } break; - case 'd': /* Delete line */ + case 'd': // Delete line gui_delete_lines(gui.row, 1); break; - case 'D': /* Delete lines */ + case 'D': // Delete lines gui_delete_lines(gui.row, arg1); break; - case 'i': /* Insert line */ + case 'i': // Insert line gui_insert_lines(gui.row, 1); break; - case 'I': /* Insert lines */ + case 'I': // Insert lines gui_insert_lines(gui.row, arg1); break; - case '$': /* Clear to end-of-line */ + case '$': // Clear to end-of-line gui_clear_block(gui.row, gui.col, gui.row, (int)Columns - 1); break; - case 'h': /* Turn on highlighting */ + case 'h': // Turn on highlighting gui_start_highlight(arg1); break; - case 'H': /* Turn off highlighting */ + case 'H': // Turn off highlighting gui_stop_highlight(arg1); break; - case 'f': /* flash the window (visual bell) */ + case 'f': // flash the window (visual bell) gui_mch_flash(arg1 == 0 ? 20 : arg1); break; default: - p = s + 1; /* Skip the ESC */ + p = s + 1; // Skip the ESC break; } len -= (int)(++p - s); @@ -1880,9 +1879,9 @@ gui_write( } else if ( #ifdef EBCDIC - CtrlChar(s[0]) != 0 /* Ctrl character */ + CtrlChar(s[0]) != 0 // Ctrl character #else - s[0] < 0x20 /* Ctrl character */ + s[0] < 0x20 // Ctrl character #endif #ifdef FEAT_SIGN_ICONS && s[0] != SIGN_BYTE @@ -1892,7 +1891,7 @@ gui_write( #endif ) { - if (s[0] == '\n') /* NL */ + if (s[0] == '\n') // NL { gui.col = 0; if (gui.row < gui.scroll_region_bot) @@ -1900,26 +1899,26 @@ gui_write( else gui_delete_lines(gui.scroll_region_top, 1); } - else if (s[0] == '\r') /* CR */ + else if (s[0] == '\r') // CR { gui.col = 0; } - else if (s[0] == '\b') /* Backspace */ + else if (s[0] == '\b') // Backspace { if (gui.col) --gui.col; } - else if (s[0] == Ctrl_L) /* cursor-right */ + else if (s[0] == Ctrl_L) // cursor-right { ++gui.col; } - else if (s[0] == Ctrl_G) /* Beep */ + else if (s[0] == Ctrl_G) // Beep { gui_mch_beep(); } - /* Other Ctrl character: shouldn't happen! */ - - --len; /* Skip this char */ + // Other Ctrl character: shouldn't happen! + + --len; // Skip this char ++s; } else @@ -1947,20 +1946,20 @@ gui_write( } } - /* Postponed update of the cursor (won't work if "can_update_cursor" isn't - * set). */ + // Postponed update of the cursor (won't work if "can_update_cursor" isn't + // set). if (force_cursor) gui_update_cursor(TRUE, TRUE); - /* When switching to another window the dragging must have stopped. - * Required for GTK, dragged_sb isn't reset. */ + // When switching to another window the dragging must have stopped. + // Required for GTK, dragged_sb isn't reset. if (old_curwin != curwin) gui.dragged_sb = SBAR_NONE; - /* Update the scrollbars after clearing the screen or when switched - * to another window. - * Update the horizontal scrollbar always, it's difficult to check all - * situations where it might change. */ + // Update the scrollbars after clearing the screen or when switched + // to another window. + // Update the horizontal scrollbar always, it's difficult to check all + // situations where it might change. if (force_scrollbar || old_curwin != curwin) gui_update_scrollbars(force_scrollbar); else @@ -1975,7 +1974,7 @@ gui_write( gui.dragged_sb = SBAR_NONE; #endif - gui_may_flush(); /* In case vim decides to take a nap */ + gui_may_flush(); // In case vim decides to take a nap } /* @@ -1988,7 +1987,7 @@ gui_dont_update_cursor(int undraw) { if (gui.in_use) { - /* Undraw the cursor now, we probably can't do it after the change. */ + // Undraw the cursor now, we probably can't do it after the change. if (undraw) gui_undraw_cursor(); can_update_cursor = FALSE; @@ -1999,8 +1998,8 @@ gui_dont_update_cursor(int undraw) gui_can_update_cursor(void) { can_update_cursor = TRUE; - /* No need to update the cursor right now, there is always more output - * after scrolling. */ + // No need to update the cursor right now, there is always more output + // after scrolling. } /* @@ -2047,7 +2046,7 @@ gui_outstr(char_u *s, int len) { if (has_mbyte) { - /* Find out how many chars fit in the current line. */ + // Find out how many chars fit in the current line. cells = 0; for (this_len = 0; this_len < len; ) { @@ -2057,7 +2056,7 @@ gui_outstr(char_u *s, int len) this_len += (*mb_ptr2len)(s + this_len); } if (this_len > len) - this_len = len; /* don't include following composing char */ + this_len = len; // don't include following composing char } else if (gui.col + len > Columns) @@ -2069,11 +2068,11 @@ gui_outstr(char_u *s, int len) 0, (guicolor_T)0, (guicolor_T)0, 0); s += this_len; len -= this_len; - /* fill up for a double-width char that doesn't fit. */ + // fill up for a double-width char that doesn't fit. if (len > 0 && gui.col < Columns) (void)gui_outstr_nowrap((char_u *)" ", 1, 0, (guicolor_T)0, (guicolor_T)0, 0); - /* The cursor may wrap to the next line. */ + // The cursor may wrap to the next line. if (gui.col >= Columns) { gui.col = 0; @@ -2089,20 +2088,20 @@ gui_outstr(char_u *s, int len) */ static int gui_screenchar( - int off, /* Offset from start of screen */ + int off, // Offset from start of screen int flags, - guicolor_T fg, /* colors for cursor */ - guicolor_T bg, /* colors for cursor */ - int back) /* backup this many chars when using bold trick */ + guicolor_T fg, // colors for cursor + guicolor_T bg, // colors for cursor + int back) // backup this many chars when using bold trick { char_u buf[MB_MAXBYTES + 1]; - /* Don't draw right halve of a double-width UTF-8 char. "cannot happen" */ + // Don't draw right halve of a double-width UTF-8 char. "cannot happen" if (enc_utf8 && ScreenLines[off] == 0) return OK; if (enc_utf8 && ScreenLinesUC[off] != 0) - /* Draw UTF-8 multi-byte character. */ + // Draw UTF-8 multi-byte character. return gui_outstr_nowrap(buf, utfc_char2bytes(off, buf), flags, fg, bg, back); @@ -2113,7 +2112,7 @@ gui_screenchar( return gui_outstr_nowrap(buf, 2, flags, fg, bg, back); } - /* Draw non-multi-byte character or DBCS character. */ + // Draw non-multi-byte character or DBCS character. return gui_outstr_nowrap(ScreenLines + off, enc_dbcs ? (*mb_ptr2len)(ScreenLines + off) : 1, flags, fg, bg, back); @@ -2127,31 +2126,31 @@ gui_screenchar( */ static int gui_screenstr( - int off, /* Offset from start of screen */ - int len, /* string length in screen cells */ + int off, // Offset from start of screen + int len, // string length in screen cells int flags, - guicolor_T fg, /* colors for cursor */ - guicolor_T bg, /* colors for cursor */ - int back) /* backup this many chars when using bold trick */ + guicolor_T fg, // colors for cursor + guicolor_T bg, // colors for cursor + int back) // backup this many chars when using bold trick { char_u *buf; int outlen = 0; int i; int retval; - if (len <= 0) /* "cannot happen"? */ + if (len <= 0) // "cannot happen"? return OK; if (enc_utf8) { buf = alloc(len * MB_MAXBYTES + 1); if (buf == NULL) - return OK; /* not much we could do here... */ + return OK; // not much we could do here... for (i = off; i < off + len; ++i) { if (ScreenLines[i] == 0) - continue; /* skip second half of double-width char */ + continue; // skip second half of double-width char if (ScreenLinesUC[i] == 0) buf[outlen++] = ScreenLines[i]; @@ -2159,7 +2158,7 @@ gui_screenstr( outlen += utfc_char2bytes(i, buf + outlen); } - buf[outlen] = NUL; /* only to aid debugging */ + buf[outlen] = NUL; // only to aid debugging retval = gui_outstr_nowrap(buf, outlen, flags, fg, bg, back); vim_free(buf); @@ -2169,20 +2168,20 @@ gui_screenstr( { buf = alloc(len * 2 + 1); if (buf == NULL) - return OK; /* not much we could do here... */ + return OK; // not much we could do here... for (i = off; i < off + len; ++i) { buf[outlen++] = ScreenLines[i]; - /* handle double-byte single-width char */ + // handle double-byte single-width char if (ScreenLines[i] == 0x8e) buf[outlen++] = ScreenLines2[i]; else if (MB_BYTE2LEN(ScreenLines[i]) == 2) buf[outlen++] = ScreenLines[++i]; } - buf[outlen] = NUL; /* only to aid debugging */ + buf[outlen] = NUL; // only to aid debugging retval = gui_outstr_nowrap(buf, outlen, flags, fg, bg, back); vim_free(buf); @@ -2194,7 +2193,7 @@ gui_screenstr( flags, fg, bg, back); } } -#endif /* FEAT_GUI_GTK */ +#endif // FEAT_GUI_GTK /* * Output the given string at the current cursor position. If the string is @@ -2214,9 +2213,9 @@ gui_outstr_nowrap( char_u *s, int len, int flags, - guicolor_T fg, /* colors for cursor */ - guicolor_T bg, /* colors for cursor */ - int back) /* backup this many chars when using bold trick */ + guicolor_T fg, // colors for cursor + guicolor_T bg, // colors for cursor + int back) // backup this many chars when using bold trick { long_u highlight_mask; long_u hl_mask_todo; @@ -2258,7 +2257,7 @@ gui_outstr_nowrap( if (*s == MULTISIGN_BYTE) multi_sign = TRUE; # endif - /* draw spaces instead */ + // draw spaces instead if (*curwin->w_p_scl == 'n' && *(curwin->w_p_scl + 1) == 'u' && (curwin->w_p_nu || curwin->w_p_rnu)) { @@ -2283,7 +2282,7 @@ gui_outstr_nowrap( if (gui.highlight_mask > HL_ALL) { aep = syn_gui_attr2entry(gui.highlight_mask); - if (aep == NULL) /* highlighting not set */ + if (aep == NULL) // highlighting not set highlight_mask = 0; else highlight_mask = aep->ae_attr; @@ -2293,7 +2292,7 @@ gui_outstr_nowrap( hl_mask_todo = highlight_mask; #if !defined(FEAT_GUI_GTK) - /* Set the font */ + // Set the font if (aep != NULL && aep->ae_u.gui.font != NOFONT) font = aep->ae_u.gui.font; # ifdef FEAT_XFONTSET @@ -2354,7 +2353,7 @@ gui_outstr_nowrap( draw_flags = 0; - /* Set the color */ + // Set the color bg_color = gui.back_pixel; if ((flags & GUI_MON_IS_CURSOR) && gui.in_focus) { @@ -2401,12 +2400,12 @@ gui_outstr_nowrap( } gui_mch_set_sp_color(sp_color); - /* Clear the selection if we are about to write over it */ + // Clear the selection if we are about to write over it if (!(flags & GUI_MON_NOCLEAR)) clip_may_clear_selection(gui.row, gui.row); - /* If there's no bold font, then fake it */ + // If there's no bold font, then fake it if (hl_mask_todo & (HL_BOLD | HL_STANDOUT)) draw_flags |= DRAW_BOLD; @@ -2419,29 +2418,29 @@ gui_outstr_nowrap( return FAIL; #if defined(FEAT_GUI_GTK) - /* If there's no italic font, then fake it. - * For GTK2, we don't need a different font for italic style. */ + // If there's no italic font, then fake it. + // For GTK2, we don't need a different font for italic style. if (hl_mask_todo & HL_ITALIC) draw_flags |= DRAW_ITALIC; - /* Do we underline the text? */ + // Do we underline the text? if (hl_mask_todo & HL_UNDERLINE) draw_flags |= DRAW_UNDERL; #else - /* Do we underline the text? */ + // Do we underline the text? if ((hl_mask_todo & HL_UNDERLINE) || (hl_mask_todo & HL_ITALIC)) draw_flags |= DRAW_UNDERL; #endif - /* Do we undercurl the text? */ + // Do we undercurl the text? if (hl_mask_todo & HL_UNDERCURL) draw_flags |= DRAW_UNDERC; - /* Do we strikethrough the text? */ + // Do we strikethrough the text? if (hl_mask_todo & HL_STRIKETHROUGH) draw_flags |= DRAW_STRIKE; - /* Do we draw transparently? */ + // Do we draw transparently? if (flags & GUI_MON_TRS_CURSOR) draw_flags |= DRAW_TRANSP; @@ -2449,31 +2448,31 @@ gui_outstr_nowrap( * Draw the text. */ #ifdef FEAT_GUI_GTK - /* The value returned is the length in display cells */ + // The value returned is the length in display cells len = gui_gtk2_draw_string(gui.row, col, s, len, draw_flags); #else if (enc_utf8) { - int start; /* index of bytes to be drawn */ - int cells; /* cellwidth of bytes to be drawn */ - int thislen; /* length of bytes to be drawn */ - int cn; /* cellwidth of current char */ - int i; /* index of current char */ - int c; /* current char value */ - int cl; /* byte length of current char */ - int comping; /* current char is composing */ - int scol = col; /* screen column */ - int curr_wide = FALSE; /* use 'guifontwide' */ + int start; // index of bytes to be drawn + int cells; // cellwidth of bytes to be drawn + int thislen; // length of bytes to be drawn + int cn; // cellwidth of current char + int i; // index of current char + int c; // current char value + int cl; // byte length of current char + int comping; // current char is composing + int scol = col; // screen column + int curr_wide = FALSE; // use 'guifontwide' int prev_wide = FALSE; int wide_changed; # ifdef MSWIN - int sep_comp = FALSE; /* Don't separate composing chars. */ + int sep_comp = FALSE; // Don't separate composing chars. # else - int sep_comp = TRUE; /* Separate composing chars. */ + int sep_comp = TRUE; // Separate composing chars. # endif - /* Break the string at a composing character, it has to be drawn on - * top of the previous character. */ + // Break the string at a composing character, it has to be drawn on + // top of the previous character. start = 0; cells = 0; for (i = 0; i < len; i += cl) @@ -2481,7 +2480,7 @@ gui_outstr_nowrap( c = utf_ptr2char(s + i); cn = utf_char2cells(c); comping = utf_iscomposing(c); - if (!comping) /* count cells from non-composing chars */ + if (!comping) // count cells from non-composing chars cells += cn; if (!comping || sep_comp) { @@ -2495,20 +2494,20 @@ gui_outstr_nowrap( curr_wide = FALSE; } cl = utf_ptr2len(s + i); - if (cl == 0) /* hit end of string */ - len = i + cl; /* len must be wrong "cannot happen" */ + if (cl == 0) // hit end of string + len = i + cl; // len must be wrong "cannot happen" wide_changed = curr_wide != prev_wide; - /* Print the string so far if it's the last character or there is - * a composing character. */ + // Print the string so far if it's the last character or there is + // a composing character. if (i + cl >= len || (comping && sep_comp && i > start) || wide_changed # if defined(FEAT_GUI_X11) || (cn > 1 # ifdef FEAT_XFONTSET - /* No fontset: At least draw char after wide char at - * right position. */ + // No fontset: At least draw char after wide char at + // right position. && fontset == NOFONTSET # endif ) @@ -2531,8 +2530,8 @@ gui_outstr_nowrap( } scol += cells; cells = 0; - /* Adjust to not draw a character which width is changed - * against with last one. */ + // Adjust to not draw a character which width is changed + // against with last one. if (wide_changed && !(comping && sep_comp)) { scol -= cn; @@ -2540,8 +2539,8 @@ gui_outstr_nowrap( } # if defined(FEAT_GUI_X11) - /* No fontset: draw a space to fill the gap after a wide char - * */ + // No fontset: draw a space to fill the gap after a wide char + // if (cn > 1 && (draw_flags & DRAW_TRANSP) == 0 # ifdef FEAT_XFONTSET && fontset == NOFONTSET @@ -2551,11 +2550,11 @@ gui_outstr_nowrap( 1, draw_flags); # endif } - /* Draw a composing char on top of the previous char. */ + // Draw a composing char on top of the previous char. if (comping && sep_comp) { # if defined(__APPLE_CC__) && TARGET_API_MAC_CARBON - /* Carbon ATSUI autodraws composing char over previous char */ + // Carbon ATSUI autodraws composing char over previous char gui_mch_draw_string(gui.row, scol, s + i, cl, draw_flags | DRAW_TRANSP); # else @@ -2566,7 +2565,7 @@ gui_outstr_nowrap( } prev_wide = curr_wide; } - /* The stuff below assumes "len" is the length in screen columns. */ + // The stuff below assumes "len" is the length in screen columns. len = scol - col; } else @@ -2574,23 +2573,23 @@ gui_outstr_nowrap( gui_mch_draw_string(gui.row, col, s, len, draw_flags); if (enc_dbcs == DBCS_JPNU) { - /* Get the length in display cells, this can be different from the - * number of bytes for "euc-jp". */ + // Get the length in display cells, this can be different from the + // number of bytes for "euc-jp". len = mb_string2cells(s, len); } } -#endif /* !FEAT_GUI_GTK */ +#endif // !FEAT_GUI_GTK if (!(flags & (GUI_MON_IS_CURSOR | GUI_MON_TRS_CURSOR))) gui.col = col + len; - /* May need to invert it when it's part of the selection. */ + // May need to invert it when it's part of the selection. if (flags & GUI_MON_NOCLEAR) clip_may_redraw_selection(gui.row, col, len); if (!(flags & (GUI_MON_IS_CURSOR | GUI_MON_TRS_CURSOR))) { - /* Invalidate the old physical cursor position if we wrote over it */ + // Invalidate the old physical cursor position if we wrote over it if (gui.cursor_row == gui.row && gui.cursor_col >= col && gui.cursor_col < col + len) @@ -2599,7 +2598,7 @@ gui_outstr_nowrap( #ifdef FEAT_SIGN_ICONS if (draw_sign) - /* Draw the sign on top of the spaces. */ + // Draw the sign on top of the spaces. gui_mch_drawsign(gui.row, signcol, gui.highlight_mask); # if defined(FEAT_NETBEANS_INTG) && (defined(FEAT_GUI_X11) \ || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MSWIN)) @@ -2670,7 +2669,7 @@ gui_redraw_block( int col1, int row2, int col2, - int flags) /* flags for gui_outstr_nowrap() */ + int flags) // flags for gui_outstr_nowrap() { int old_row, old_col; long_u old_hl_mask; @@ -2681,18 +2680,18 @@ gui_redraw_block( int retval = FALSE; int orig_col1, orig_col2; - /* Don't try to update when ScreenLines is not valid */ + // Don't try to update when ScreenLines is not valid if (!screen_cleared || ScreenLines == NULL) return retval; - /* Don't try to draw outside the shell! */ - /* Check everything, strange values may be caused by a big border width */ + // Don't try to draw outside the shell! + // Check everything, strange values may be caused by a big border width col1 = check_col(col1); col2 = check_col(col2); row1 = check_row(row1); row2 = check_row(row2); - /* Remember where our cursor was */ + // Remember where our cursor was old_row = gui.row; old_col = gui.col; old_hl_mask = gui.highlight_mask; @@ -2701,8 +2700,8 @@ gui_redraw_block( for (gui.row = row1; gui.row <= row2; gui.row++) { - /* When only half of a double-wide character is in the block, include - * the other half. */ + // When only half of a double-wide character is in the block, include + // the other half. col1 = orig_col1; col2 = orig_col2; off = LineOffset[gui.row]; @@ -2739,8 +2738,8 @@ gui_redraw_block( off = LineOffset[gui.row] + gui.col; len = col2 - col1 + 1; - /* Find how many chars back this highlighting starts, or where a space - * is. Needed for when the bold trick is used */ + // Find how many chars back this highlighting starts, or where a space + // is. Needed for when the bold trick is used for (back = 0; back < col1; ++back) if (ScreenAttrs[off - 1 - back] != ScreenAttrs[off] || ScreenLines[off - 1 - back] == ' ') @@ -2748,8 +2747,8 @@ gui_redraw_block( retval = (col1 > 0 && ScreenAttrs[off - 1] != 0 && back == 0 && ScreenLines[off - 1] != ' '); - /* Break it up in strings of characters with the same attributes. */ - /* Print UTF-8 characters individually. */ + // Break it up in strings of characters with the same attributes. + // Print UTF-8 characters individually. while (len > 0) { first_attr = ScreenAttrs[off]; @@ -2757,7 +2756,7 @@ gui_redraw_block( #if !defined(FEAT_GUI_GTK) if (enc_utf8 && ScreenLinesUC[off] != 0) { - /* output multi-byte character separately */ + // output multi-byte character separately nback = gui_screenchar(off, flags, (guicolor_T)0, (guicolor_T)0, back); if (gui.col < Columns && ScreenLines[off + 1] == 0) @@ -2767,7 +2766,7 @@ gui_redraw_block( } else if (enc_dbcs == DBCS_JPNU && ScreenLines[off] == 0x8e) { - /* output double-byte, single-width character separately */ + // output double-byte, single-width character separately nback = gui_screenchar(off, flags, (guicolor_T)0, (guicolor_T)0, back); idx = 1; @@ -2779,28 +2778,28 @@ gui_redraw_block( for (idx = 0; idx < len; ++idx) { if (enc_utf8 && ScreenLines[off + idx] == 0) - continue; /* skip second half of double-width char */ + continue; // skip second half of double-width char if (ScreenAttrs[off + idx] != first_attr) break; } - /* gui_screenstr() takes care of multibyte chars */ + // gui_screenstr() takes care of multibyte chars nback = gui_screenstr(off, idx, flags, (guicolor_T)0, (guicolor_T)0, back); #else for (idx = 0; idx < len && ScreenAttrs[off + idx] == first_attr; idx++) { - /* Stop at a multi-byte Unicode character. */ + // Stop at a multi-byte Unicode character. if (enc_utf8 && ScreenLinesUC[off + idx] != 0) break; if (enc_dbcs == DBCS_JPNU) { - /* Stop at a double-byte single-width char. */ + // Stop at a double-byte single-width char. if (ScreenLines[off + idx] == 0x8e) break; if (len > 1 && (*mb_ptr2len)(ScreenLines + off + idx) == 2) - ++idx; /* skip second byte of double-byte char */ + ++idx; // skip second byte of double-byte char } } nback = gui_outstr_nowrap(ScreenLines + off, idx, flags, @@ -2809,8 +2808,8 @@ gui_redraw_block( } if (nback == FAIL) { - /* Must back up to start drawing where a bold or italic word - * starts. */ + // Must back up to start drawing where a bold or italic word + // starts. off -= back; len += back; gui.col -= back; @@ -2824,7 +2823,7 @@ gui_redraw_block( } } - /* Put the cursor back where it was */ + // Put the cursor back where it was gui.row = old_row; gui.col = old_col; gui.highlight_mask = (int)old_hl_mask; @@ -2839,15 +2838,15 @@ gui_delete_lines(int row, int count) return; if (row + count > gui.scroll_region_bot) - /* Scrolled out of region, just blank the lines out */ + // Scrolled out of region, just blank the lines out gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot, gui.scroll_region_right); else { gui_mch_delete_lines(row, count); - /* If the cursor was in the deleted lines it's now gone. If the - * cursor was in the scrolled lines adjust its position. */ + // If the cursor was in the deleted lines it's now gone. If the + // cursor was in the scrolled lines adjust its position. if (gui.cursor_row >= row && gui.cursor_col >= gui.scroll_region_left && gui.cursor_col <= gui.scroll_region_right) @@ -2867,7 +2866,7 @@ gui_insert_lines(int row, int count) return; if (row + count > gui.scroll_region_bot) - /* Scrolled out of region, just blank the lines out */ + // Scrolled out of region, just blank the lines out gui_clear_block(row, gui.scroll_region_left, gui.scroll_region_bot, gui.scroll_region_right); else @@ -2992,7 +2991,7 @@ gui_wait_for_chars(long wtime, int tb_ch gui_inchar( char_u *buf, int maxlen, - long wtime, /* milli seconds */ + long wtime, // milli seconds int tb_change_cnt) { return gui_wait_for_chars_buf(buf, maxlen, wtime, tb_change_cnt); @@ -3069,7 +3068,7 @@ gui_send_mouse_event( button_char = KE_MOUSERIGHT; button_set: { - /* Don't put events in the input queue now. */ + // Don't put events in the input queue now. if (hold_gui_events) return; @@ -3077,8 +3076,8 @@ button_set: string[4] = KS_EXTRA; string[5] = (int)button_char; - /* Pass the pointer coordinates of the scroll event so that we - * know which window to scroll. */ + // Pass the pointer coordinates of the scroll event so that we + // know which window to scroll. row = gui_xy2colrow(x, y, &col); string[6] = (char_u)(col / 128 + ' ' + 1); string[7] = (char_u)(col % 128 + ' ' + 1); @@ -3105,14 +3104,14 @@ button_set: } #ifdef FEAT_CLIPBOARD - /* If a clipboard selection is in progress, handle it */ + // If a clipboard selection is in progress, handle it if (clip_star.state == SELECT_IN_PROGRESS) { clip_process_selection(button, X_2_COL(x), Y_2_ROW(y), repeated_click); return; } - /* Determine which mouse settings to look for based on the current mode */ + // Determine which mouse settings to look for based on the current mode switch (get_real_state()) { case NORMAL_BUSY: @@ -3130,9 +3129,9 @@ button_set: case INSERT: case INSERT+LANGMAP: checkfor = MOUSE_INSERT; break; case ASKMORE: - case HITRETURN: /* At the more- and hit-enter prompt pass the - mouse event for a click on or below the - message line. */ + case HITRETURN: // At the more- and hit-enter prompt pass the + // mouse event for a click on or below the + // message line. if (Y_2_ROW(y) >= msg_row) checkfor = MOUSE_NORMAL; else @@ -3192,7 +3191,7 @@ button_set: */ if (!mouse_has(checkfor) || checkfor == MOUSE_COMMAND) { - /* Don't do modeless selection in Visual mode. */ + // Don't do modeless selection in Visual mode. if (checkfor != MOUSE_NONEF && VIsual_active && (State & NORMAL)) return; @@ -3207,9 +3206,9 @@ button_set: modifiers &= ~ MOUSE_SHIFT; } - /* If the selection is done, allow the right button to extend it. - * If the selection is cleared, allow the right button to start it - * from the cursor position. */ + // If the selection is done, allow the right button to extend it. + // If the selection is cleared, allow the right button to start it + // from the cursor position. if (button == MOUSE_RIGHT) { if (clip_star.state == SELECT_CLEARED) @@ -3230,14 +3229,14 @@ button_set: repeated_click); did_clip = TRUE; } - /* Allow the left button to start the selection */ + // Allow the left button to start the selection else if (button == MOUSE_LEFT) { clip_start_selection(X_2_COL(x), Y_2_ROW(y), repeated_click); did_clip = TRUE; } - /* Always allow pasting */ + // Always allow pasting if (button != MOUSE_MIDDLE) { if (!mouse_has(checkfor) || button == MOUSE_RELEASE) @@ -3252,7 +3251,7 @@ button_set: clip_clear_selection(&clip_star); #endif - /* Don't put events in the input queue now. */ + // Don't put events in the input queue now. if (hold_gui_events) return; @@ -3266,7 +3265,7 @@ button_set: { if (row == prev_row && col == prev_col) return; - /* Dragging above the window, set "row" to -1 to cause a scroll. */ + // Dragging above the window, set "row" to -1 to cause a scroll. if (y < 0) row = -1; } @@ -3283,7 +3282,7 @@ button_set: ) repeated_click = FALSE; - string[0] = CSI; /* this sequence is recognized by check_termcode() */ + string[0] = CSI; // this sequence is recognized by check_termcode() string[1] = KS_MOUSE; string[2] = KE_FILLER; if (button != MOUSE_DRAG && button != MOUSE_RELEASE) @@ -3356,7 +3355,7 @@ gui_menu_cb(vimmenu_T *menu) { char_u bytes[sizeof(long_u)]; - /* Don't put events in the input queue now. */ + // Don't put events in the input queue now. if (hold_gui_events) return; @@ -3464,7 +3463,7 @@ gui_init_which_components(char_u *oldval break; #endif case GO_GREY: - /* make menu's have grey items, ignored here */ + // make menu's have grey items, ignored here break; #ifdef FEAT_TOOLBAR case GO_TOOLBAR: @@ -3482,7 +3481,7 @@ gui_init_which_components(char_u *oldval #endif break; default: - /* Ignore options that are not supported */ + // Ignore options that are not supported break; } @@ -3500,13 +3499,13 @@ gui_init_which_components(char_u *oldval #endif #ifdef FEAT_GUI_TABLINE - /* Update the GUI tab line, it may appear or disappear. This may - * cause the non-GUI tab line to disappear or appear. */ + // Update the GUI tab line, it may appear or disappear. This may + // cause the non-GUI tab line to disappear or appear. using_tabline = gui_has_tabline(); if (!gui_mch_showing_tabline() != !using_tabline) { - /* We don't want a resize event change "Rows" here, save and - * restore it. Resizing is handled below. */ + // We don't want a resize event change "Rows" here, save and + // restore it. Resizing is handled below. i = Rows; gui_update_tabline(); Rows = i; @@ -3514,16 +3513,16 @@ gui_init_which_components(char_u *oldval if (using_tabline) fix_size = TRUE; if (!gui_use_tabline()) - redraw_tabline = TRUE; /* may draw non-GUI tab line */ + redraw_tabline = TRUE; // may draw non-GUI tab line } #endif for (i = 0; i < 3; i++) { - /* The scrollbar needs to be updated when it is shown/unshown and - * when switching tab pages. But the size only changes when it's - * shown/unshown. Thus we need two places to remember whether a - * scrollbar is there or not. */ + // The scrollbar needs to be updated when it is shown/unshown and + // when switching tab pages. But the size only changes when it's + // shown/unshown. Thus we need two places to remember whether a + // scrollbar is there or not. if (gui.which_scrollbars[i] != prev_which_scrollbars[i] || gui.which_scrollbars[i] != curtab->tp_prev_which_scrollbars[i]) @@ -3553,8 +3552,8 @@ gui_init_which_components(char_u *oldval #ifdef FEAT_MENU if (gui.menu_is_active != prev_menu_is_active) { - /* We don't want a resize event change "Rows" here, save and - * restore it. Resizing is handled below. */ + // We don't want a resize event change "Rows" here, save and + // restore it. Resizing is handled below. i = Rows; gui_mch_enable_menu(gui.menu_is_active); Rows = i; @@ -3598,22 +3597,22 @@ gui_init_which_components(char_u *oldval long prev_Columns = Columns; long prev_Rows = Rows; #endif - /* Adjust the size of the window to make the text area keep the - * same size and to avoid that part of our window is off-screen - * and a scrollbar can't be used, for example. */ + // Adjust the size of the window to make the text area keep the + // same size and to avoid that part of our window is off-screen + // and a scrollbar can't be used, for example. gui_set_shellsize(FALSE, fix_size, need_set_size); #ifdef FEAT_GUI_GTK - /* GTK has the annoying habit of sending us resize events when - * changing the window size ourselves. This mostly happens when - * waiting for a character to arrive, quite unpredictably, and may - * change Columns and Rows when we don't want it. Wait for a - * character here to avoid this effect. - * If you remove this, please test this command for resizing - * effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q". - * Don't do this while starting up though. - * Don't change Rows when adding menu/toolbar/tabline. - * Don't change Columns when adding vertical toolbar. */ + // GTK has the annoying habit of sending us resize events when + // changing the window size ourselves. This mostly happens when + // waiting for a character to arrive, quite unpredictably, and may + // change Columns and Rows when we don't want it. Wait for a + // character here to avoid this effect. + // If you remove this, please test this command for resizing + // effects (with optional left scrollbar): ":vsp|q|vsp|q|vsp|q". + // Don't do this while starting up though. + // Don't change Rows when adding menu/toolbar/tabline. + // Don't change Columns when adding vertical toolbar. if (!gui.starting && need_set_size != (RESIZE_VERT | RESIZE_HOR)) (void)char_avail(); if ((need_set_size & RESIZE_VERT) == 0) @@ -3622,10 +3621,10 @@ gui_init_which_components(char_u *oldval Columns = prev_Columns; #endif } - /* When the console tabline appears or disappears the window positions - * change. */ + // When the console tabline appears or disappears the window positions + // change. if (firstwin->w_winrow != tabline_height()) - shell_new_rows(); /* recompute window positions and heights */ + shell_new_rows(); // recompute window positions and heights } } @@ -3666,8 +3665,8 @@ gui_update_tabline(void) if (!gui.starting && starting == 0) { - /* Updating the tabline uses direct GUI commands, flush - * outstanding instructions first. (esp. clear screen) */ + // Updating the tabline uses direct GUI commands, flush + // outstanding instructions first. (esp. clear screen) out_flush(); if (!showit != !shown) @@ -3675,8 +3674,8 @@ gui_update_tabline(void) if (showit != 0) gui_mch_update_tabline(); - /* When the tabs change from hidden to shown or from shown to - * hidden the size of the text area should remain the same. */ + // When the tabs change from hidden to shown or from shown to + // hidden the size of the text area should remain the same. if (!showit != !shown) gui_set_shellsize(FALSE, showit, RESIZE_VERT); } @@ -3688,7 +3687,7 @@ gui_update_tabline(void) void get_tabline_label( tabpage_T *tp, - int tooltip) /* TRUE: get tooltip */ + int tooltip) // TRUE: get tooltip { int modified = FALSE; char_u buf[40]; @@ -3696,7 +3695,7 @@ get_tabline_label( win_T *wp; char_u **opt; - /* Use 'guitablabel' or 'guitabtooltip' if it's set. */ + // Use 'guitablabel' or 'guitabtooltip' if it's set. opt = (tooltip ? &p_gtt : &p_gtl); if (**opt != NUL) { @@ -3714,7 +3713,7 @@ get_tabline_label( set_vim_var_nr(VV_LNUM, printer_page_num); use_sandbox = was_set_insecurely(opt_name, 0); # endif - /* It's almost as going to the tabpage, but without autocommands. */ + // It's almost as going to the tabpage, but without autocommands. curtab->tp_firstwin = firstwin; curtab->tp_lastwin = lastwin; curtab->tp_curwin = curwin; @@ -3726,12 +3725,12 @@ get_tabline_label( curwin = curtab->tp_curwin; curbuf = curwin->w_buffer; - /* Can't use NameBuff directly, build_stl_str_hl() uses it. */ + // Can't use NameBuff directly, build_stl_str_hl() uses it. build_stl_str_hl(curwin, res, MAXPATHL, *opt, use_sandbox, 0, (int)Columns, NULL, NULL); STRCPY(NameBuff, res); - /* Back to the original curtab. */ + // Back to the original curtab. curtab = save_curtab; topframe = curtab->tp_topframe; firstwin = curtab->tp_firstwin; @@ -3745,11 +3744,11 @@ get_tabline_label( called_emsg |= save_called_emsg; } - /* If 'guitablabel'/'guitabtooltip' is not set or the result is empty then - * use a default label. */ + // If 'guitablabel'/'guitabtooltip' is not set or the result is empty then + // use a default label. if (**opt == NUL || *NameBuff == NUL) { - /* Get the buffer name into NameBuff[] and shorten it. */ + // Get the buffer name into NameBuff[] and shorten it. get_trans_bufname(tp == curtab ? curbuf : tp->tp_curwin->w_buffer); if (!tooltip) shorten_dir(NameBuff); @@ -3786,14 +3785,14 @@ send_tabline_event(int nr) if (nr == tabpage_index(curtab)) return FALSE; - /* Don't put events in the input queue now. */ + // Don't put events in the input queue now. if (hold_gui_events # ifdef FEAT_CMDWIN || cmdwin_type != 0 # endif ) { - /* Set it back to the current tab page. */ + // Set it back to the current tab page. gui_mch_set_curtab(tabpage_index(curtab)); return FALSE; } @@ -3865,7 +3864,7 @@ gui_create_scrollbar(scrollbar_T *sb, in { static int sbar_ident = 0; - sb->ident = sbar_ident++; /* No check for too big, but would it happen? */ + sb->ident = sbar_ident++; // No check for too big, but would it happen? sb->wp = wp; sb->type = type; sb->value = 0; @@ -3935,7 +3934,7 @@ gui_drag_scrollbar(scrollbar_T *sb, long if (sb == NULL) return; - /* Don't put events in the input queue now. */ + // Don't put events in the input queue now. if (hold_gui_events) return; @@ -3958,13 +3957,13 @@ gui_drag_scrollbar(scrollbar_T *sb, long { gui.dragged_sb = SBAR_NONE; #ifdef FEAT_GUI_GTK - /* Keep the "dragged_wp" value until after the scrolling, for when the - * mouse button is released. GTK2 doesn't send the button-up event. */ + // Keep the "dragged_wp" value until after the scrolling, for when the + // mouse button is released. GTK2 doesn't send the button-up event. gui.dragged_wp = NULL; #endif } - /* Vertical sbar info is kept in the first sbar (the left one) */ + // Vertical sbar info is kept in the first sbar (the left one) if (sb->wp != NULL) sb = &sb->wp->w_scrollbars[0]; @@ -3984,14 +3983,14 @@ gui_drag_scrollbar(scrollbar_T *sb, long sb->value = value; #ifdef USE_ON_FLY_SCROLL - /* When not allowed to do the scrolling right now, return. - * This also checked input_available(), but that causes the first click in - * a scrollbar to be ignored when Vim doesn't have focus. */ + // When not allowed to do the scrolling right now, return. + // This also checked input_available(), but that causes the first click in + // a scrollbar to be ignored when Vim doesn't have focus. if (dont_scroll) return; #endif - /* Disallow scrolling the current window when the completion popup menu is - * visible. */ + // Disallow scrolling the current window when the completion popup menu is + // visible. if ((sb->wp == NULL || sb->wp == curwin) && pum_visible()) return; @@ -4004,7 +4003,7 @@ gui_drag_scrollbar(scrollbar_T *sb, long } #endif - if (sb->wp != NULL) /* vertical scrollbar */ + if (sb->wp != NULL) // vertical scrollbar { sb_num = 0; for (wp = firstwin; wp != sb->wp && wp != NULL; wp = wp->w_next) @@ -4034,12 +4033,12 @@ gui_drag_scrollbar(scrollbar_T *sb, long } } # ifdef FEAT_FOLDING - /* Value may have been changed for closed fold. */ + // Value may have been changed for closed fold. sb->value = sb->wp->w_topline - 1; # endif - /* When dragging one scrollbar and there is another one at the other - * side move the thumb of that one too. */ + // When dragging one scrollbar and there is another one at the other + // side move the thumb of that one too. if (gui.which_scrollbars[SBAR_RIGHT] && gui.which_scrollbars[SBAR_LEFT]) gui_mch_set_scrollbar_thumb( &sb->wp->w_scrollbars[ @@ -4074,7 +4073,7 @@ gui_drag_scrollbar(scrollbar_T *sb, long } if (old_leftcol != curwin->w_leftcol) { - updateWindow(curwin); /* update window, status and cmdline */ + updateWindow(curwin); // update window, status and cmdline setcursor(); } #else @@ -4098,7 +4097,7 @@ gui_drag_scrollbar(scrollbar_T *sb, long )))) { do_check_scrollbind(TRUE); - /* need to update the window right here */ + // need to update the window right here FOR_ALL_WINDOWS(wp) if (wp->w_redr_type > 0) updateWindow(wp); @@ -4133,21 +4132,21 @@ gui_may_update_scrollbars(void) void gui_update_scrollbars( - int force) /* Force all scrollbars to get updated */ + int force) // Force all scrollbars to get updated { win_T *wp; scrollbar_T *sb; - long val, size, max; /* need 32 bits here */ + long val, size, max; // need 32 bits here int which_sb; int h, y; static win_T *prev_curwin = NULL; - /* Update the horizontal scrollbar */ + // Update the horizontal scrollbar gui_update_horiz_scrollbar(force); #ifndef MSWIN - /* Return straight away if there is neither a left nor right scrollbar. - * On MS-Windows this is required anyway for scrollwheel messages. */ + // Return straight away if there is neither a left nor right scrollbar. + // On MS-Windows this is required anyway for scrollwheel messages. if (!gui.which_scrollbars[SBAR_LEFT] && !gui.which_scrollbars[SBAR_RIGHT]) return; #endif @@ -4174,14 +4173,14 @@ gui_update_scrollbars( gui.dragged_wp->w_scrollbars[0].max); } - /* avoid that moving components around generates events */ + // avoid that moving components around generates events ++hold_gui_events; for (wp = firstwin; wp != NULL; wp = W_NEXT(wp)) { - if (wp->w_buffer == NULL) /* just in case */ + if (wp->w_buffer == NULL) // just in case continue; - /* Skip a scrollbar that is being dragged. */ + // Skip a scrollbar that is being dragged. if (!force && (gui.dragged_sb == SBAR_LEFT || gui.dragged_sb == SBAR_RIGHT) && gui.dragged_wp == wp) @@ -4192,20 +4191,20 @@ gui_update_scrollbars( #else max = wp->w_buffer->b_ml.ml_line_count + wp->w_height - 2; #endif - if (max < 0) /* empty buffer */ + if (max < 0) // empty buffer max = 0; val = wp->w_topline - 1; size = wp->w_height; #ifdef SCROLL_PAST_END - if (val > max) /* just in case */ + if (val > max) // just in case val = max; #else - if (size > max + 1) /* just in case */ + if (size > max + 1) // just in case size = max + 1; if (val > max - size + 1) val = max - size + 1; #endif - if (val < 0) /* minimal value is 0 */ + if (val < 0) // minimal value is 0 val = 0; /* @@ -4225,7 +4224,7 @@ gui_update_scrollbars( * This can happen during changing files. Just don't update the * scrollbar for now. */ - sb->height = 0; /* Force update next time */ + sb->height = 0; // Force update next time if (gui.which_scrollbars[SBAR_LEFT]) gui_do_scrollbar(wp, SBAR_LEFT, FALSE); if (gui.which_scrollbars[SBAR_RIGHT]) @@ -4238,14 +4237,14 @@ gui_update_scrollbars( || sb->width != wp->w_width || prev_curwin != curwin) { - /* Height, width or position of scrollbar has changed. For - * vertical split: curwin changed. */ + // Height, width or position of scrollbar has changed. For + // vertical split: curwin changed. sb->height = wp->w_height; sb->top = wp->w_winrow; sb->status_height = wp->w_status_height; sb->width = wp->w_width; - /* Calculate height and position in pixels */ + // Calculate height and position in pixels h = (sb->height + sb->status_height) * gui.char_height; y = sb->top * gui.char_height + gui.border_offset; #if defined(FEAT_MENU) && !defined(FEAT_GUI_GTK) && !defined(FEAT_GUI_MOTIF) && !defined(FEAT_GUI_PHOTON) @@ -4271,7 +4270,7 @@ gui_update_scrollbars( if (wp->w_winrow == 0) { - /* Height of top scrollbar includes width of top border */ + // Height of top scrollbar includes width of top border h += gui.border_offset; y -= gui.border_offset; } @@ -4291,10 +4290,10 @@ gui_update_scrollbars( } } - /* Reduce the number of calls to gui_mch_set_scrollbar_thumb() by - * checking if the thumb moved at least a pixel. Only do this for - * Athena, most other GUIs require the update anyway to make the - * arrows work. */ + // Reduce the number of calls to gui_mch_set_scrollbar_thumb() by + // checking if the thumb moved at least a pixel. Only do this for + // Athena, most other GUIs require the update anyway to make the + // arrows work. #ifdef FEAT_GUI_ATHENA if (max == 0) y = 0; @@ -4305,7 +4304,7 @@ gui_update_scrollbars( if (force || sb->value != val || sb->size != size || sb->max != max) #endif { - /* Thumb of scrollbar has moved */ + // Thumb of scrollbar has moved sb->value = val; #ifdef FEAT_GUI_ATHENA sb->pixval = y; @@ -4334,27 +4333,27 @@ gui_update_scrollbars( static void gui_do_scrollbar( win_T *wp, - int which, /* SBAR_LEFT or SBAR_RIGHT */ - int enable) /* TRUE to enable scrollbar */ + int which, // SBAR_LEFT or SBAR_RIGHT + int enable) // TRUE to enable scrollbar { int midcol = curwin->w_wincol + curwin->w_width / 2; int has_midcol = (wp->w_wincol <= midcol && wp->w_wincol + wp->w_width >= midcol); - /* Only enable scrollbars that contain the middle column of the current - * window. */ + // Only enable scrollbars that contain the middle column of the current + // window. if (gui.which_scrollbars[SBAR_RIGHT] != gui.which_scrollbars[SBAR_LEFT]) { - /* Scrollbars only on one side. Don't enable scrollbars that don't - * contain the middle column of the current window. */ + // Scrollbars only on one side. Don't enable scrollbars that don't + // contain the middle column of the current window. if (!has_midcol) enable = FALSE; } else { - /* Scrollbars on both sides. Don't enable scrollbars that neither - * contain the middle column of the current window nor are on the far - * side. */ + // Scrollbars on both sides. Don't enable scrollbars that neither + // contain the middle column of the current window nor are on the far + // side. if (midcol > Columns / 2) { if (which == SBAR_LEFT ? wp->w_wincol != 0 : !has_midcol) @@ -4391,7 +4390,7 @@ gui_do_scroll(void) if (wp == NULL) break; if (wp == NULL) - /* Couldn't find window */ + // Couldn't find window return FALSE; /* @@ -4413,9 +4412,9 @@ gui_do_scroll(void) scrolldown(-nlines, gui.dragged_wp == NULL); else scrollup(nlines, gui.dragged_wp == NULL); - /* Reset dragged_wp after using it. "dragged_sb" will have been reset for - * the mouse-up event already, but we still want it to behave like when - * dragging. But not the next click in an arrow. */ + // Reset dragged_wp after using it. "dragged_sb" will have been reset for + // the mouse-up event already, but we still want it to behave like when + // dragging. But not the next click in an arrow. if (gui.dragged_sb == SBAR_NONE) gui.dragged_wp = NULL; @@ -4427,15 +4426,15 @@ gui_do_scroll(void) { if (get_scrolloff_value() != 0) { - cursor_correct(); /* fix window for 'so' */ - update_topline(); /* avoid up/down jump */ + cursor_correct(); // fix window for 'so' + update_topline(); // avoid up/down jump } if (old_cursor.lnum != wp->w_cursor.lnum) coladvance(wp->w_curswant); wp->w_scbind_pos = wp->w_topline; } - /* Make sure wp->w_leftcol and wp->w_skipcol are correct. */ + // Make sure wp->w_leftcol and wp->w_skipcol are correct. validate_cursor(); curwin = save_wp; @@ -4460,16 +4459,16 @@ gui_do_scroll(void) wp->w_lines_valid = 0; } - /* Don't set must_redraw here, it may cause the popup menu to - * disappear when losing focus after a scrollbar drag. */ + // Don't set must_redraw here, it may cause the popup menu to + // disappear when losing focus after a scrollbar drag. if (wp->w_redr_type < type) wp->w_redr_type = type; mch_disable_flush(); - updateWindow(wp); /* update window, status line, and cmdline */ + updateWindow(wp); // update window, status line, and cmdline mch_enable_flush(); } - /* May need to redraw the popup menu. */ + // May need to redraw the popup menu. if (pum_visible()) pum_redraw(); @@ -4498,15 +4497,15 @@ scroll_line_len(linenr_T lnum) { w = chartabsize(p, col); MB_PTR_ADV(p); - if (*p == NUL) /* don't count the last character */ + if (*p == NUL) // don't count the last character break; col += w; } return col; } -/* Remember which line is currently the longest, so that we don't have to - * search for it when scrolling horizontally. */ +// Remember which line is currently the longest, so that we don't have to +// search for it when scrolling horizontally. static linenr_T longest_lnum = 0; /* @@ -4518,9 +4517,9 @@ gui_find_longest_lnum(void) { linenr_T ret = 0; - /* Calculate maximum for horizontal scrollbar. Check for reasonable - * line numbers, topline and botline can be invalid when displaying is - * postponed. */ + // Calculate maximum for horizontal scrollbar. Check for reasonable + // line numbers, topline and botline can be invalid when displaying is + // postponed. if (vim_strchr(p_go, GO_HORSCROLL) == NULL && curwin->w_topline <= curwin->w_cursor.lnum && curwin->w_botline > curwin->w_cursor.lnum @@ -4530,9 +4529,9 @@ gui_find_longest_lnum(void) colnr_T n; long max = 0; - /* Use maximum of all visible lines. Remember the lnum of the - * longest line, closest to the cursor line. Used when scrolling - * below. */ + // Use maximum of all visible lines. Remember the lnum of the + // longest line, closest to the cursor line. Used when scrolling + // below. for (lnum = curwin->w_topline; lnum < curwin->w_botline; ++lnum) { n = scroll_line_len(lnum); @@ -4548,7 +4547,7 @@ gui_find_longest_lnum(void) } } else - /* Use cursor line only. */ + // Use cursor line only. ret = curwin->w_cursor.lnum; return ret; @@ -4557,7 +4556,7 @@ gui_find_longest_lnum(void) static void gui_update_horiz_scrollbar(int force) { - long value, size, max; /* need 32 bit ints here */ + long value, size, max; // need 32 bit ints here if (!gui.which_scrollbars[SBAR_BOTTOM]) return; @@ -4597,7 +4596,7 @@ gui_update_horiz_scrollbar(int force) if (virtual_active()) { - /* May move the cursor even further to the right. */ + // May move the cursor even further to the right. if (curwin->w_virtcol >= (colnr_T)max) max = curwin->w_virtcol; } @@ -4605,8 +4604,8 @@ gui_update_horiz_scrollbar(int force) #ifndef SCROLL_PAST_END max += curwin->w_width - 1; #endif - /* The line number isn't scrolled, thus there is less space when - * 'number' or 'relativenumber' is set (also for 'foldcolumn'). */ + // The line number isn't scrolled, thus there is less space when + // 'number' or 'relativenumber' is set (also for 'foldcolumn'). size -= curwin_col_off(); #ifndef SCROLL_PAST_END max -= curwin_col_off(); @@ -4615,7 +4614,7 @@ gui_update_horiz_scrollbar(int force) #ifndef SCROLL_PAST_END if (value > max - size + 1) - value = max - size + 1; /* limit the value to allowable range */ + value = max - size + 1; // limit the value to allowable range #endif #ifdef FEAT_RIGHTLEFT @@ -4647,7 +4646,7 @@ gui_update_horiz_scrollbar(int force) int gui_do_horiz_scroll(long_u leftcol, int compute_longest_lnum) { - /* no wrapping, no scrolling */ + // no wrapping, no scrolling if (curwin->w_p_wrap) return FALSE; @@ -4656,8 +4655,8 @@ gui_do_horiz_scroll(long_u leftcol, int curwin->w_leftcol = (colnr_T)leftcol; - /* When the line of the cursor is too short, move the cursor to the - * longest visible line. */ + // When the line of the cursor is too short, move the cursor to the + // longest visible line. if (vim_strchr(p_go, GO_HORSCROLL) == NULL && !virtual_active() && (colnr_T)leftcol > scroll_line_len(curwin->w_cursor.lnum)) @@ -4667,7 +4666,7 @@ gui_do_horiz_scroll(long_u leftcol, int curwin->w_cursor.lnum = gui_find_longest_lnum(); curwin->w_cursor.col = 0; } - /* Do a sanity check on "longest_lnum", just in case. */ + // Do a sanity check on "longest_lnum", just in case. else if (longest_lnum >= curwin->w_topline && longest_lnum < curwin->w_botline) { @@ -4756,8 +4755,8 @@ gui_bg_default(void) void init_gui_options(void) { - /* Set the 'background' option according to the lightness of the - * background color, unless the user has set it already. */ + // Set the 'background' option according to the lightness of the + // background color, unless the user has set it already. if (!option_was_set((char_u *)"bg") && STRCMP(p_bg, gui_bg_default()) != 0) { set_option_value((char_u *)"bg", 0L, gui_bg_default(), 0); @@ -4771,7 +4770,7 @@ gui_new_scrollbar_colors(void) { win_T *wp; - /* Nothing to do if GUI hasn't started yet. */ + // Nothing to do if GUI hasn't started yet. if (!gui.in_use) return; @@ -4802,9 +4801,9 @@ gui_focus_change(int in_focus) xim_set_focus(in_focus); # endif - /* Put events in the input queue only when allowed. - * ui_focus_change() isn't called directly, because it invokes - * autocommands and that must not happen asynchronously. */ + // Put events in the input queue only when allowed. + // ui_focus_change() isn't called directly, because it invokes + // autocommands and that must not happen asynchronously. if (!hold_gui_events) { char_u bytes[3]; @@ -4828,29 +4827,29 @@ gui_mouse_focus(int x, int y) char_u st[8]; #ifdef FEAT_MOUSESHAPE - /* Get window pointer, and update mouse shape as well. */ + // Get window pointer, and update mouse shape as well. wp = xy2win(x, y, IGNORE_POPUP); #endif - /* Only handle this when 'mousefocus' set and ... */ + // Only handle this when 'mousefocus' set and ... if (p_mousef - && !hold_gui_events /* not holding events */ - && (State & (NORMAL|INSERT))/* Normal/Visual/Insert mode */ - && State != HITRETURN /* but not hit-return prompt */ - && msg_scrolled == 0 /* no scrolled message */ - && !need_mouse_correct /* not moving the pointer */ - && gui.in_focus) /* gvim in focus */ + && !hold_gui_events // not holding events + && (State & (NORMAL|INSERT))// Normal/Visual/Insert mode + && State != HITRETURN // but not hit-return prompt + && msg_scrolled == 0 // no scrolled message + && !need_mouse_correct // not moving the pointer + && gui.in_focus) // gvim in focus { - /* Don't move the mouse when it's left or right of the Vim window */ + // Don't move the mouse when it's left or right of the Vim window if (x < 0 || x > Columns * gui.char_width) return; #ifndef FEAT_MOUSESHAPE wp = xy2win(x, y, IGNORE_POPUP); #endif if (wp == curwin || wp == NULL) - return; /* still in the same old window, or none at all */ - - /* Ignore position in the tab pages line. */ + return; // still in the same old window, or none at all + + // Ignore position in the tab pages line. if (Y_2_ROW(y) < tabline_height()) return; @@ -4862,7 +4861,7 @@ gui_mouse_focus(int x, int y) */ if (finish_op) { - /* abort the current operator first */ + // abort the current operator first st[0] = ESC; add_to_input_buf(st, 1); } @@ -4878,7 +4877,7 @@ gui_mouse_focus(int x, int y) st[3] = (char_u)MOUSE_RELEASE; add_to_input_buf(st, 8); #ifdef FEAT_GUI_GTK - /* Need to wake up the main loop */ + // Need to wake up the main loop if (gtk_main_level() > 0) gtk_main_quit(); #endif @@ -4937,7 +4936,7 @@ gui_mouse_correct(void) need_mouse_correct = FALSE; wp = gui_mouse_window(IGNORE_POPUP); - if (wp != curwin && wp != NULL) /* If in other than current window */ + if (wp != curwin && wp != NULL) // If in other than current window { validate_cline_row(); gui_mch_setmouse((int)W_ENDCOL(curwin) * gui.char_width - 3, @@ -4959,7 +4958,7 @@ xy2win(int x, int y, mouse_find_T popup) row = Y_2_ROW(y); col = X_2_COL(x); - if (row < 0 || col < 0) /* before first window */ + if (row < 0 || col < 0) // before first window return NULL; wp = mouse_find_win(&row, &col, popup); if (wp == NULL) @@ -4972,7 +4971,7 @@ xy2win(int x, int y, mouse_find_T popup) else update_mouseshape(SHAPE_IDX_MORE); } - else if (row > wp->w_height) /* below status line */ + else if (row > wp->w_height) // below status line update_mouseshape(SHAPE_IDX_CLINE); else if (!(State & CMDLINE) && wp->w_vsep_width > 0 && col == wp->w_width && (row != wp->w_height || !stl_connected(wp)) && msg_scrolled == 0) @@ -5013,8 +5012,8 @@ ex_gui(exarg_T *eap) emsg(_(e_nogvim)); return; #else - /* Clear the command. Needed for when forking+exiting, to avoid part - * of the argument ending up after the shell prompt. */ + // Clear the command. Needed for when forking+exiting, to avoid part + // of the argument ending up after the shell prompt. msg_clr_eos_force(); # ifdef GUI_MAY_SPAWN if (!ends_excmd(*eap->arg)) @@ -5098,11 +5097,11 @@ display_errors(void) fflush(stderr); else if (error_ga.ga_data != NULL) { - /* avoid putting up a message box with blanks only */ + // avoid putting up a message box with blanks only for (p = (char_u *)error_ga.ga_data; *p != NUL; ++p) if (!isspace(*p)) { - /* Truncate a very long message, it will go off-screen. */ + // Truncate a very long message, it will go off-screen. if (STRLEN(p) > 2000) STRCPY(p + 2000 - 14, "...(truncated)"); (void)do_dialog(VIM_ERROR, (char_u *)_("Error"), @@ -5150,7 +5149,7 @@ gui_update_screen(void) update_topline(); validate_cursor(); - /* Trigger CursorMoved if the cursor moved. */ + // Trigger CursorMoved if the cursor moved. if (!finish_op && (has_cursormoved() # ifdef FEAT_PROP_POPUP || popup_visible @@ -5190,7 +5189,7 @@ gui_update_screen(void) need_cursor_line_redraw = FALSE; } # endif - update_screen(0); /* may need to update the screen */ + update_screen(0); // may need to update the screen setcursor(); out_flush_cursor(TRUE, FALSE); } @@ -5205,8 +5204,8 @@ gui_update_screen(void) char_u * get_find_dialog_text( char_u *arg, - int *wwordp, /* return: TRUE if \< \> found */ - int *mcasep) /* return: TRUE if \C found */ + int *wwordp, // return: TRUE if \< \> found + int *mcasep) // return: TRUE if \C found { char_u *text; @@ -5222,14 +5221,14 @@ get_find_dialog_text( int len = (int)STRLEN(text); int i; - /* Remove "\V" */ + // Remove "\V" if (len >= 2 && STRNCMP(text, "\\V", 2) == 0) { mch_memmove(text, text + 2, (size_t)(len - 1)); len -= 2; } - /* Recognize "\c" and "\C" and remove. */ + // Recognize "\c" and "\C" and remove. if (len >= 2 && *text == '\\' && (text[1] == 'c' || text[1] == 'C')) { *mcasep = (text[1] == 'C'); @@ -5237,7 +5236,7 @@ get_find_dialog_text( len -= 2; } - /* Recognize "\" and remove. */ + // Recognize "\" and remove. if (len >= 4 && STRNCMP(text, "\\<", 2) == 0 && STRNCMP(text + len - 2, "\\>", 2) == 0) @@ -5247,7 +5246,7 @@ get_find_dialog_text( text[len - 4] = NUL; } - /* Recognize "\/" or "\?" and remove. */ + // Recognize "\/" or "\?" and remove. for (i = 0; i + 1 < len; ++i) if (text[i] == '\\' && (text[i + 1] == '/' || text[i + 1] == '?')) @@ -5266,10 +5265,10 @@ get_find_dialog_text( */ int gui_do_findrepl( - int flags, /* one of FRD_REPLACE, FRD_FINDNEXT, etc. */ + int flags, // one of FRD_REPLACE, FRD_FINDNEXT, etc. char_u *find_text, char_u *repl_text, - int down) /* Search downwards. */ + int down) // Search downwards. { garray_T ga; int i; @@ -5279,13 +5278,13 @@ gui_do_findrepl( int save_did_emsg = did_emsg; static int busy = FALSE; - /* When the screen is being updated we should not change buffers and - * windows structures, it may cause freed memory to be used. Also don't - * do this recursively (pressing "Find" quickly several times. */ + // When the screen is being updated we should not change buffers and + // windows structures, it may cause freed memory to be used. Also don't + // do this recursively (pressing "Find" quickly several times. if (updating_screen || busy) return FALSE; - /* refuse replace when text cannot be changed */ + // refuse replace when text cannot be changed if ((type == FRD_REPLACE || type == FRD_REPLACEALL) && text_locked()) return FALSE; @@ -5302,7 +5301,7 @@ gui_do_findrepl( ga_concat(&ga, (char_u *)"\\c"); if (flags & FRD_WHOLE_WORD) ga_concat(&ga, (char_u *)"\\<"); - /* escape / and \ */ + // escape slash and backslash p = vim_strsave_escaped(find_text, (char_u *)"/\\"); if (p != NULL) ga_concat(&ga, p); @@ -5313,7 +5312,7 @@ gui_do_findrepl( if (type == FRD_REPLACEALL) { ga_concat(&ga, (char_u *)"/"); - /* escape / and \ */ + // escape slash and backslash p = vim_strsave_escaped(repl_text, (char_u *)"/\\"); if (p != NULL) ga_concat(&ga, p); @@ -5324,8 +5323,8 @@ gui_do_findrepl( if (type == FRD_REPLACE) { - /* Do the replacement when the text at the cursor matches. Thus no - * replacement is done if the cursor was moved! */ + // Do the replacement when the text at the cursor matches. Thus no + // replacement is done if the cursor was moved! regmatch.regprog = vim_regcomp(ga.ga_data, RE_MAGIC + RE_STRING); regmatch.rm_ic = 0; if (regmatch.regprog != NULL) @@ -5334,13 +5333,13 @@ gui_do_findrepl( if (vim_regexec_nl(®match, p, (colnr_T)0) && regmatch.startp[0] == p) { - /* Clear the command line to remove any old "No match" - * error. */ + // Clear the command line to remove any old "No match" + // error. msg_end_prompt(); if (u_save_cursor() == OK) { - /* A button was pressed thus undo should be synced. */ + // A button was pressed thus undo should be synced. u_sync(FALSE); del_bytes((long)(regmatch.endp[0] - regmatch.startp[0]), @@ -5356,7 +5355,7 @@ gui_do_findrepl( if (type == FRD_REPLACEALL) { - /* A button was pressed, thus undo should be synced. */ + // A button was pressed, thus undo should be synced. u_sync(FALSE); do_cmdline_cmd(ga.ga_data); } @@ -5364,8 +5363,8 @@ gui_do_findrepl( { int searchflags = SEARCH_MSG + SEARCH_MARK; - /* Search for the next match. - * Don't skip text under cursor for single replace. */ + // Search for the next match. + // Don't skip text under cursor for single replace. if (type == FRD_REPLACE) searchflags += SEARCH_START; i = msg_scroll; @@ -5375,26 +5374,26 @@ gui_do_findrepl( } else { - /* We need to escape '?' if and only if we are searching in the up - * direction */ + // We need to escape '?' if and only if we are searching in the up + // direction p = vim_strsave_escaped(ga.ga_data, (char_u *)"?"); if (p != NULL) (void)do_search(NULL, '?', p, 1L, searchflags, NULL); vim_free(p); } - msg_scroll = i; /* don't let an error message set msg_scroll */ + msg_scroll = i; // don't let an error message set msg_scroll } - /* Don't want to pass did_emsg to other code, it may cause disabling - * syntax HL if we were busy redrawing. */ + // Don't want to pass did_emsg to other code, it may cause disabling + // syntax HL if we were busy redrawing. did_emsg = save_did_emsg; if (State & (NORMAL | INSERT)) { - gui_update_screen(); /* update the screen */ - msg_didout = 0; /* overwrite any message */ - need_wait_return = FALSE; /* don't wait for return */ + gui_update_screen(); // update the screen + msg_didout = 0; // overwrite any message + need_wait_return = FALSE; // don't wait for return } vim_free(ga.ga_data); @@ -5432,9 +5431,9 @@ drop_callback(void *cookie) { char_u *p = cookie; - /* If Shift held down, change to first file's directory. If the first - * item is a directory, change to that directory (and let the explorer - * plugin show the contents). */ + // If Shift held down, change to first file's directory. If the first + // item is a directory, change to that directory (and let the explorer + // plugin show the contents). if (p != NULL) { if (mch_isdir(p)) @@ -5447,7 +5446,7 @@ drop_callback(void *cookie) vim_free(p); } - /* Update the screen display */ + // Update the screen display update_screen(NOT_VALID); # ifdef FEAT_MENU gui_update_menus(0); @@ -5500,9 +5499,9 @@ gui_handle_drop( if (i > 0) add_to_input_buf((char_u*)" ", 1); - /* We don't know what command is used thus we can't be sure - * about which characters need to be escaped. Only escape the - * most common ones. */ + // We don't know what command is used thus we can't be sure + // about which characters need to be escaped. Only escape the + // most common ones. # ifdef BACKSLASH_IN_FILENAME p = vim_strsave_escaped(fnames[i], (char_u *)" \t\"|"); # else @@ -5518,20 +5517,20 @@ gui_handle_drop( } else { - /* Go to the window under mouse cursor, then shorten given "fnames" by - * current window, because a window can have local current dir. */ + // Go to the window under mouse cursor, then shorten given "fnames" by + // current window, because a window can have local current dir. gui_wingoto_xy(x, y); shorten_filenames(fnames, count); - /* If Shift held down, remember the first item. */ + // If Shift held down, remember the first item. if ((modifiers & MOUSE_SHIFT) != 0) p = vim_strsave(fnames[0]); else p = NULL; - /* Handle the drop, :edit or :split to get to the file. This also - * frees fnames[]. Skip this if there is only one item, it's a - * directory and Shift is held down. */ + // Handle the drop, :edit or :split to get to the file. This also + // frees fnames[]. Skip this if there is only one item, it's a + // directory and Shift is held down. if (count == 1 && (modifiers & MOUSE_SHIFT) != 0 && mch_isdir(fnames[0])) { diff --git a/src/gui_at_fs.c b/src/gui_at_fs.c --- a/src/gui_at_fs.c +++ b/src/gui_at_fs.c @@ -43,11 +43,11 @@ #include "vim.h" -/* Only include this when using the file browser */ +// Only include this when using the file browser #ifdef FEAT_BROWSE -/* Weird complication: for "make lint" Text.h doesn't combine with Xm.h */ +// Weird complication: for "make lint" Text.h doesn't combine with Xm.h #if defined(FEAT_GUI_MOTIF) && defined(FMT8BIT) # undef FMT8BIT #endif @@ -56,7 +56,7 @@ # include "gui_at_sb.h" #endif -/***************** SFinternal.h */ +////////////////// SFinternal.h #include #include @@ -170,7 +170,7 @@ static int (*SFfunc)(); static int SFstatus = SEL_FILE_NULL; -/***************** forward declare static functions */ +///////////////// forward declare static functions static void SFsetText(char *path); static void SFtextChanged(void); @@ -184,7 +184,7 @@ static void SFvSliderMovedCallback(Widge static Boolean SFworkProc(void); static int SFcompareEntries(const void *p, const void *q); -/***************** xstat.h */ +////////////////// xstat.h #ifndef S_IXUSR # define S_IXUSR 0100 @@ -198,7 +198,7 @@ static int SFcompareEntries(const void * #define S_ISXXX(m) ((m) & (S_IXUSR | S_IXGRP | S_IXOTH)) -/***************** Path.c */ +////////////////// Path.c #include @@ -515,7 +515,7 @@ SFgetHomeDirs(void) SFhomeDir.path = SFcurrentPath; SFhomeDir.entries = entries; SFhomeDir.nEntries = i; - SFhomeDir.vOrigin = 0; /* :-) */ + SFhomeDir.vOrigin = 0; // :-) SFhomeDir.nChars = maxChars + 2; SFhomeDir.hOrigin = 0; SFhomeDir.changed = 1; @@ -969,7 +969,7 @@ SFdirModTimer(XtPointer cl UNUSED, XtInt SFdirModTimer, (XtPointer) NULL); } -/* Return a single character describing what kind of file STATBUF is. */ +// Return a single character describing what kind of file STATBUF is. static char SFstatChar(stat_T *statBuf) @@ -981,11 +981,11 @@ SFstatChar(stat_T *statBuf) #ifdef S_ISSOCK if (S_ISSOCK (statBuf->st_mode)) return '='; -#endif /* S_ISSOCK */ +#endif // S_ISSOCK return ' '; } -/***************** Draw.c */ +////////////////// Draw.c #ifdef FEAT_GUI_NEXTAW # include @@ -1604,7 +1604,7 @@ SFenterList(Widget w UNUSED, int n, XEnt { int nw; - /* sanity */ + // sanity if (SFcurrentInvert[n] != -1) { SFinvertEntry(n); @@ -1980,7 +1980,7 @@ SFworkProc(void) return True; } -/***************** Dir.c */ +////////////////// Dir.c static int SFcompareEntries(const void *p, const void *q) @@ -2020,7 +2020,7 @@ SFgetDir( while ((dp = readdir(dirp))) { - /* Ignore "." and ".." */ + // Ignore "." and ".." if (strcmp(dp->d_name, ".") == 0 || strcmp(dp->d_name, "..") == 0) continue; if (i >= Alloc) @@ -2051,7 +2051,7 @@ SFgetDir( return 0; } -/***************** SFinternal.h */ +////////////////// SFinternal.h #include #include @@ -2202,7 +2202,7 @@ SFsetColors( XSetForeground(gui.dpy, SFtextGC, fg); XSetForeground(gui.dpy, SFlineGC, fg); - /* This is an xor GC, so combine the fg and background */ + // This is an xor GC, so combine the fg and background XSetBackground(gui.dpy, SFinvertGC, fg ^ bg); XSetForeground(gui.dpy, SFinvertGC, fg ^ bg); } @@ -2250,7 +2250,7 @@ SFcreateWidgets( XtNtitle, prompt, NULL); - /* Add WM_DELETE_WINDOW protocol */ + // Add WM_DELETE_WINDOW protocol XtAppAddActions(XtWidgetToApplicationContext(selFile), actions, XtNumber(actions)); XtOverrideTranslations(selFile, @@ -2522,7 +2522,7 @@ SFcreateWidgets( XtSetMappedWhenManaged(selFile, False); XtRealizeWidget(selFile); - /* Add WM_DELETE_WINDOW protocol */ + // Add WM_DELETE_WINDOW protocol SFwmDeleteWindow = XInternAtom(SFdisplay, "WM_DELETE_WINDOW", False); XSetWMProtocols(SFdisplay, XtWindow(selFile), &SFwmDeleteWindow, 1); @@ -2609,7 +2609,7 @@ SFgetText(void) XtNstring, &wcbuf, NULL); mbslength = wcstombs(NULL, wcbuf, 0); - /* Hack: some broken wcstombs() returns zero, just get a large buffer */ + // Hack: some broken wcstombs() returns zero, just get a large buffer if (mbslength == 0 && wcbuf != NULL && wcbuf[0] != 0) mbslength = MAXPATHL; buf=(char *)XtMalloc(mbslength + 1); @@ -2645,7 +2645,7 @@ vim_SelFile( guicolor_T fg, guicolor_T bg, guicolor_T scroll_fg, - guicolor_T scroll_bg) /* The "Scrollbar" group colors */ + guicolor_T scroll_bg) // The "Scrollbar" group colors { static int firstTime = 1; XEvent event; @@ -2731,4 +2731,4 @@ vim_SelFile( } } } -#endif /* FEAT_BROWSE */ +#endif // FEAT_BROWSE diff --git a/src/gui_at_sb.c b/src/gui_at_sb.c --- a/src/gui_at_sb.c +++ b/src/gui_at_sb.c @@ -56,9 +56,9 @@ CONNECTION WITH THE USE OR PERFORMANCE O */ -/* ScrollBar.c */ -/* created by weissman, Mon Jul 7 13:20:03 1986 */ -/* converted by swick, Thu Aug 27 1987 */ +// ScrollBar.c +// created by weissman, Mon Jul 7 13:20:03 1986 +// converted by swick, Thu Aug 27 1987 #include "vim.h" @@ -70,7 +70,7 @@ CONNECTION WITH THE USE OR PERFORMANCE O #include -/* Private definitions. */ +// Private definitions. static char defaultTranslations[] = ": NotifyScroll()\n\ @@ -164,7 +164,7 @@ static XtActionsRec actions[] = ScrollbarClassRec vim_scrollbarClassRec = { - { /* core fields */ + { // core fields /* superclass */ (WidgetClass) &simpleClassRec, /* class_name */ "Scrollbar", /* size */ sizeof(ScrollbarRec), @@ -198,13 +198,13 @@ ScrollbarClassRec vim_scrollbarClassRec /* display_accelerator*/ XtInheritDisplayAccelerator, /* extension */ NULL }, - { /* simple fields */ + { // simple fields /* change_sensitive */ XtInheritChangeSensitive, #ifndef OLDXAW /* extension */ NULL #endif }, - { /* scrollbar fields */ + { // scrollbar fields /* empty */ 0 } }; @@ -240,7 +240,7 @@ FillArea( int fill, int draw_shadow) { - int tlen = bottom - top; /* length of thumb in pixels */ + int tlen = bottom - top; // length of thumb in pixels int sw, margin, floor; int lx, ly, lw, lh; @@ -273,24 +273,24 @@ FillArea( { if (!(sbw->scrollbar.orientation == XtorientHorizontal)) { - /* Top border */ + // Top border XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), sbw->scrollbar.top_shadow_GC, lx, ly, lx + lw - 1, ly); - /* Bottom border */ + // Bottom border XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), sbw->scrollbar.bot_shadow_GC, lx, ly + lh - 1, lx + lw - 1, ly + lh - 1); } else { - /* Left border */ + // Left border XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), sbw->scrollbar.top_shadow_GC, lx, ly, lx, ly + lh - 1); - /* Right border */ + // Right border XDrawLine (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), sbw->scrollbar.bot_shadow_GC, lx + lw - 1, ly, lx + lw - 1, ly + lh - 1); @@ -306,24 +306,24 @@ FillArea( if (!(sbw->scrollbar.orientation == XtorientHorizontal)) { - /* Left border */ + // Left border XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), sbw->scrollbar.top_shadow_GC, lx, ly, lx, ly + lh - 1); - /* Right border */ + // Right border XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), sbw->scrollbar.bot_shadow_GC, lx + lw - 1, ly, lx + lw - 1, ly + lh - 1); } else { - /* Top border */ + // Top border XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), sbw->scrollbar.top_shadow_GC, lx, ly, lx + lw - 1, ly); - /* Bottom border */ + // Bottom border XDrawLine(XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), sbw->scrollbar.bot_shadow_GC, lx, ly + lh - 1, lx + lw - 1, ly + lh - 1); @@ -336,11 +336,11 @@ FillArea( } } -/* Paint the thumb in the area specified by sbw->top and - sbw->shown. The old area is erased. The painting and - erasing is done cleverly so that no flickering will occur. +/* + * Paint the thumb in the area specified by sbw->top and + * sbw->shown. The old area is erased. The painting and + * erasing is done cleverly so that no flickering will occur. */ - static void PaintThumb(ScrollbarWidget sbw) { @@ -369,7 +369,7 @@ PaintThumb(ScrollbarWidget sbw) if (newbot > oldbot) FillArea(sbw, AT_MAX(newtop, oldbot-1), newbot, 1,0); - /* Only draw the missing shadows */ + // Only draw the missing shadows FillArea(sbw, newtop, newbot, 0, 1); } } @@ -408,7 +408,7 @@ PaintArrows(ScrollbarWidget sbw) point[5].x = thickness / 2; point[5].y = sbw->scrollbar.length - sbw->scrollbar.shadow_width - 1; - /* horizontal arrows require that x and y coordinates be swapped */ + // horizontal arrows require that x and y coordinates be swapped if (sbw->scrollbar.orientation == XtorientHorizontal) { int n; @@ -420,7 +420,7 @@ PaintArrows(ScrollbarWidget sbw) point[n].y = swap; } } - /* draw the up/left arrow */ + // draw the up/left arrow XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), sbw->scrollbar.gc, point, 3, @@ -433,7 +433,7 @@ PaintArrows(ScrollbarWidget sbw) sbw->scrollbar.top_shadow_GC, point[0].x, point[0].y, point[2].x, point[2].y); - /* draw the down/right arrow */ + // draw the down/right arrow XFillPolygon (XtDisplay ((Widget) sbw), XtWindow ((Widget) sbw), sbw->scrollbar.gc, point+3, 3, @@ -497,8 +497,8 @@ CreateGC(Widget w) gcValues.fill_style = FillSolid; mask |= GCFillStyle; } - /* the creation should be non-caching, because */ - /* we now set and clear clip masks on the gc returned */ + // the creation should be non-caching, because + // we now set and clear clip masks on the gc returned sbw->scrollbar.gc = XtGetGC (w, mask, &gcValues); } @@ -519,8 +519,8 @@ SetDimensions(ScrollbarWidget sbw) static void Initialize( - Widget request UNUSED, /* what the client asked for */ - Widget new, /* what we're going to give him */ + Widget request UNUSED, // what the client asked for + Widget new, // what we're going to give him ArgList args UNUSED, Cardinal *num_args UNUSED) { @@ -551,16 +551,16 @@ Realize( Mask *valueMask, XSetWindowAttributes *attributes) { - /* The Simple widget actually stuffs the value in the valuemask. */ + // The Simple widget actually stuffs the value in the valuemask. (*vim_scrollbarWidgetClass->core_class.superclass->core_class.realize) (w, valueMask, attributes); } static Boolean SetValues( - Widget current, /* what I am */ - Widget request UNUSED, /* what he wants me to be */ - Widget desired, /* what I will become */ + Widget current, // what I am + Widget request UNUSED, // what he wants me to be + Widget desired, // what I will become ArgList args UNUSED, Cardinal *num_args UNUSED) { @@ -600,8 +600,8 @@ SetValues( static void Resize(Widget w) { - /* ForgetGravity has taken care of background, but thumb may - * have to move as a result of the new size. */ + // ForgetGravity has taken care of background, but thumb may + // have to move as a result of the new size. SetDimensions ((ScrollbarWidget) w); Redisplay(w, (XEvent*) NULL, (Region)NULL); } @@ -633,11 +633,11 @@ Redisplay(Widget w, XEvent *event, Regio if (region == NULL || XRectInRegion (region, x, y, width, height) != RectangleOut) { - /* Forces entire thumb to be painted. */ + // Forces entire thumb to be painted. sbw->scrollbar.topLoc = -(sbw->scrollbar.length + 1); PaintThumb (sbw); } - /* we'd like to be region aware here!!!! */ + // we'd like to be region aware here!!!! PaintArrows(sbw); } @@ -693,7 +693,7 @@ PeekNotifyEvent(Display *dpy, XEvent *ev { struct EventData *eventData = (struct EventData*)args; - return ((++eventData->count == QLength(dpy)) /* since PeekIf blocks */ + return ((++eventData->count == QLength(dpy)) // since PeekIf blocks || CompareEvents(event, eventData->oldEvent)); } @@ -719,9 +719,9 @@ LookAhead(Widget w, XEvent *event) static void ExtractPosition( XEvent *event, - Position *x, /* RETURN */ - Position *y, /* RETURN */ - unsigned int *state) /* RETURN */ + Position *x, // RETURN + Position *y, // RETURN + unsigned int *state) // RETURN { switch (event->type) { @@ -771,8 +771,8 @@ HandleThumb( ExtractPosition(event, &x, &y, (unsigned int *)NULL); loc = PICKLENGTH(sbw, x, y); - /* if the motion event puts the pointer in thumb, call Move and Notify */ - /* also call Move and Notify if we're already in continuous scroll mode */ + // if the motion event puts the pointer in thumb, call Move and Notify + // also call Move and Notify if we're already in continuous scroll mode if (sbw->scrollbar.scroll_mode == SMODE_CONT || (loc >= sbw->scrollbar.topLoc && loc <= sbw->scrollbar.topLoc + (int)sbw->scrollbar.shownLength)) @@ -876,7 +876,7 @@ ScrollSome( { ScrollbarWidget sbw = (ScrollbarWidget) w; - if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if scroll continuous */ + if (sbw->scrollbar.scroll_mode == SMODE_CONT) // if scroll continuous return; if (LookAhead(w, event)) @@ -900,7 +900,7 @@ NotifyScroll( int call_data = 0; unsigned int state; - if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if scroll continuous */ + if (sbw->scrollbar.scroll_mode == SMODE_CONT) // if scroll continuous return; if (LookAhead (w, event)) @@ -968,7 +968,7 @@ NotifyScroll( if (call_data) XtCallCallbacks(w, XtNscrollProc, (XtPointer)(long_u)call_data); - /* establish autoscroll */ + // establish autoscroll if (delay) sbw->scrollbar.timer_id = XtAppAddTimeOut(XtWidgetToApplicationContext(w), @@ -985,9 +985,9 @@ EndScroll( ScrollbarWidget sbw = (ScrollbarWidget) w; sbw->scrollbar.scroll_mode = SMODE_NONE; - /* no need to remove any autoscroll timeout; it will no-op */ - /* because the scroll_mode is SMODE_NONE */ - /* but be sure to remove timeout in destroy proc */ + // no need to remove any autoscroll timeout; it will no-op + // because the scroll_mode is SMODE_NONE + // but be sure to remove timeout in destroy proc } static float @@ -1016,7 +1016,7 @@ MoveThumb( float top; char old_mode = sbw->scrollbar.scroll_mode; - sbw->scrollbar.scroll_mode = SMODE_CONT; /* indicate continuous scroll */ + sbw->scrollbar.scroll_mode = SMODE_CONT; // indicate continuous scroll if (LookAhead(w, event)) return; @@ -1028,7 +1028,7 @@ MoveThumb( top = FractionLoc(sbw, x, y); - if (old_mode != SMODE_CONT) /* start dragging: set offset */ + if (old_mode != SMODE_CONT) // start dragging: set offset { if (event->xbutton.button == Button2) sbw->scrollbar.scroll_off = sbw->scrollbar.shown / 2.; @@ -1045,7 +1045,7 @@ MoveThumb( sbw->scrollbar.top = top; PaintThumb(sbw); - XFlush(XtDisplay(w)); /* re-draw it before Notifying */ + XFlush(XtDisplay(w)); // re-draw it before Notifying } @@ -1057,8 +1057,8 @@ NotifyThumb( Cardinal *num_params UNUSED) { ScrollbarWidget sbw = (ScrollbarWidget)w; - /* Use a union to avoid a warning for the weird conversion from float to - * XtPointer. Comes from Xaw/Scrollbar.c. */ + // Use a union to avoid a warning for the weird conversion from float to + // XtPointer. Comes from Xaw/Scrollbar.c. union { XtPointer xtp; float xtf; @@ -1067,9 +1067,9 @@ NotifyThumb( if (LookAhead(w, event)) return; - /* thumbProc is not pretty, but is necessary for backwards - compatibility on those architectures for which it work{s,ed}; - the intent is to pass a (truncated) float by value. */ + // thumbProc is not pretty, but is necessary for backwards + // compatibility on those architectures for which it work{s,ed}; + // the intent is to pass a (truncated) float by value. xtpf.xtf = sbw->scrollbar.top; XtCallCallbacks(w, XtNthumbProc, xtpf.xtp); XtCallCallbacks(w, XtNjumpProc, (XtPointer)&sbw->scrollbar.top); @@ -1137,7 +1137,7 @@ AllocBotShadowGC(Widget w) bot = sbw->scrollbar.top_shadow_GC; } - /* top-left shadow */ + // top-left shadow if ((region == NULL) || (XRectInRegion (region, 0, 0, w, s) != RectangleOut) || (XRectInRegion (region, 0, 0, s, h) != RectangleOut)) @@ -1151,7 +1151,7 @@ AllocBotShadowGC(Widget w) XFillPolygon (dpy, win, top, pt, 6, Complex, CoordModeOrigin); } - /* bottom-right shadow */ + // bottom-right shadow if ((region == NULL) || (XRectInRegion (region, 0, hms, w, s) != RectangleOut) || (XRectInRegion (region, wms, 0, s, h) != RectangleOut)) @@ -1176,7 +1176,7 @@ vim_XawScrollbarSetThumb(Widget w, doubl { ScrollbarWidget sbw = (ScrollbarWidget) w; - if (sbw->scrollbar.scroll_mode == SMODE_CONT) /* if still thumbing */ + if (sbw->scrollbar.scroll_mode == SMODE_CONT) // if still thumbing return; sbw->scrollbar.max = (max > 1.0) ? 1.0 : diff --git a/src/gui_athena.c b/src/gui_athena.c --- a/src/gui_athena.c +++ b/src/gui_athena.c @@ -34,7 +34,7 @@ # include # include # include -#endif /* FEAT_GUI_NEXTAW */ +#endif // FEAT_GUI_NEXTAW #ifndef FEAT_GUI_NEXTAW # include "gui_at_sb.h" @@ -46,9 +46,9 @@ static Widget vimForm = (Widget)0; Widget textArea = (Widget)0; #ifdef FEAT_MENU static Widget menuBar = (Widget)0; -static XtIntervalId timer = 0; /* 0 = expired, otherwise active */ +static XtIntervalId timer = 0; // 0 = expired, otherwise active -/* Used to figure out menu ordering */ +// Used to figure out menu ordering static vimmenu_T *a_cur_menu = NULL; static Cardinal athena_calculate_ins_pos(Widget); @@ -96,7 +96,7 @@ gui_athena_scroll_cb_jump( if (sb == NULL) return; - else if (sb->wp != NULL) /* Left or right scrollbar */ + else if (sb->wp != NULL) // Left or right scrollbar { /* * Careful: need to get scrollbar info out of first (left) scrollbar @@ -105,7 +105,7 @@ gui_athena_scroll_cb_jump( */ sb_info = &sb->wp->w_scrollbars[0]; } - else /* Bottom scrollbar */ + else // Bottom scrollbar sb_info = sb; value = (long)(*((float *)call_data) * (float)(sb_info->max + 1) + 0.001); @@ -134,7 +134,7 @@ gui_athena_scroll_cb_scroll( if (sb == NULL) return; - if (sb->wp != NULL) /* Left or right scrollbar */ + if (sb->wp != NULL) // Left or right scrollbar { /* * Careful: need to get scrollbar info out of first (left) scrollbar @@ -144,7 +144,7 @@ gui_athena_scroll_cb_scroll( sb_info = &sb->wp->w_scrollbars[0]; if (sb_info->size > 5) - page = sb_info->size - 2; /* use two lines of context */ + page = sb_info->size - 2; // use two lines of context else page = sb_info->size; #ifdef FEAT_GUI_NEXTAW @@ -177,7 +177,7 @@ gui_athena_scroll_cb_scroll( } #endif } - else /* Bottom scrollbar */ + else // Bottom scrollbar { sb_info = sb; #ifdef FEAT_GUI_NEXTAW @@ -194,14 +194,14 @@ gui_athena_scroll_cb_scroll( data = 1; } #endif - if (data < -1) /* page-width left */ + if (data < -1) // page-width left { if (sb->size > 8) data = -(sb->size - 5); else data = -sb->size; } - else if (data > 1) /* page-width right */ + else if (data > 1) // page-width right { if (sb->size > 8) data = (sb->size - 5); @@ -216,8 +216,8 @@ gui_athena_scroll_cb_scroll( else if (value < 0) value = 0; - /* Update the bottom scrollbar an extra time (why is this needed?? */ - if (sb->wp == NULL) /* Bottom scrollbar */ + // Update the bottom scrollbar an extra time (why is this needed?? + if (sb->wp == NULL) // Bottom scrollbar gui_mch_set_scrollbar_thumb(sb, value, sb->size, sb->max); gui_drag_scrollbar(sb, value, FALSE); @@ -235,7 +235,7 @@ gui_x11_create_widgets(void) */ gui.border_offset = gui.border_width; - /* The form containing all the other widgets */ + // The form containing all the other widgets vimForm = XtVaCreateManagedWidget("vimForm", formWidgetClass, vimShell, XtNborderWidth, 0, @@ -243,7 +243,7 @@ gui_x11_create_widgets(void) gui_athena_scroll_colors(vimForm); #ifdef FEAT_MENU - /* The top menu bar */ + // The top menu bar menuBar = XtVaCreateManagedWidget("menuBar", boxWidgetClass, vimForm, XtNresizable, True, @@ -259,8 +259,8 @@ gui_x11_create_widgets(void) #endif #ifdef FEAT_TOOLBAR - /* Don't create it Managed, it will be managed when creating the first - * item. Otherwise an empty toolbar shows up. */ + // Don't create it Managed, it will be managed when creating the first + // item. Otherwise an empty toolbar shows up. toolBar = XtVaCreateWidget("toolBar", boxWidgetClass, vimForm, XtNresizable, True, @@ -276,7 +276,7 @@ gui_x11_create_widgets(void) gui_athena_menu_colors(toolBar); #endif - /* The text area. */ + // The text area. textArea = XtVaCreateManagedWidget("textArea", coreWidgetClass, vimForm, XtNresizable, True, @@ -315,7 +315,7 @@ gui_x11_create_widgets(void) XtNumber(pullAction)); #endif - /* Pretend we don't have input focus, we will get an event if we do. */ + // Pretend we don't have input focus, we will get an event if we do. gui.in_focus = FALSE; } @@ -352,10 +352,9 @@ gui_athena_create_pullright_pixmap(Widge to.addr = (XtPointer)&font; to.size = sizeof(XFontStruct *); #endif - /* Assumption: The menuBar children will use the same font as the - * pulldown menu items AND they will all be of type - * XtNfont. - */ + // Assumption: The menuBar children will use the same font as the + // pulldown menu items AND they will all be of type + // XtNfont. XtVaGetValues(menuBar, XtNchildren, &children, XtNnumChildren, &num_children, NULL); @@ -369,7 +368,7 @@ gui_athena_create_pullright_pixmap(Widge #endif ) == False) return None; - /* "font" should now contain data */ + // "font" should now contain data } else #ifdef FONTSET_ALWAYS @@ -449,18 +448,18 @@ static void createXpmImages(char_u *path static void get_toolbar_pixmap(vimmenu_T *menu, Pixmap *sen) { - char_u buf[MAXPATHL]; /* buffer storing expanded pathname */ - char **xpm = NULL; /* xpm array */ + char_u buf[MAXPATHL]; // buffer storing expanded pathname + char **xpm = NULL; // xpm array - buf[0] = NUL; /* start with NULL path */ + buf[0] = NUL; // start with NULL path if (menu->iconfile != NULL) { - /* Use the "icon=" argument. */ + // Use the "icon=" argument. gui_find_iconfile(menu->iconfile, buf, "xpm"); createXpmImages(buf, NULL, sen); - /* If it failed, try using the menu name. */ + // If it failed, try using the menu name. if (*sen == (Pixmap)0 && gui_find_bitmap(menu->name, buf, "xpm") == OK) createXpmImages(buf, NULL, sen); if (*sen != (Pixmap)0) @@ -511,7 +510,7 @@ createXpmImages(char_u *path, char **xpm &color[TOP_SHADOW].pixel, &color[HIGHLIGHT].pixel); - /* Setup the color substitution table */ + // Setup the color substitution table attrs.valuemask = XpmColorSymbols; attrs.colorsymbols = color; attrs.numsymbols = 5; @@ -519,7 +518,7 @@ createXpmImages(char_u *path, char **xpm screenNum = DefaultScreen(gui.dpy); rootWindow = RootWindow(gui.dpy, screenNum); - /* Create the "sensitive" pixmap */ + // Create the "sensitive" pixmap if (xpm != NULL) status = XpmCreatePixmapFromData(gui.dpy, rootWindow, xpm, &map, &mask, &attrs); @@ -532,13 +531,13 @@ createXpmImages(char_u *path, char **xpm GC back_gc; GC mask_gc; - /* Need to create new Pixmaps with the mask applied. */ + // Need to create new Pixmaps with the mask applied. gcvalues.foreground = color[BACKGROUND].pixel; back_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues); mask_gc = XCreateGC(gui.dpy, map, GCForeground, &gcvalues); XSetClipMask(gui.dpy, mask_gc, mask); - /* Create the "sensitive" pixmap. */ + // Create the "sensitive" pixmap. *sen = XCreatePixmap(gui.dpy, rootWindow, attrs.width, attrs.height, DefaultDepth(gui.dpy, screenNum)); @@ -567,7 +566,7 @@ gui_mch_set_toolbar_pos( Dimension border; int height; - if (!XtIsManaged(toolBar)) /* nothing to do */ + if (!XtIsManaged(toolBar)) // nothing to do return; XtUnmanageChild(toolBar); XtVaGetValues(toolBar, @@ -602,7 +601,7 @@ gui_mch_set_text_area_pos( NULL); XtManageChild(textArea); #ifdef FEAT_TOOLBAR - /* Give keyboard focus to the textArea instead of the toolbar. */ + // Give keyboard focus to the textArea instead of the toolbar. gui_mch_reset_focus(); #endif } @@ -686,7 +685,7 @@ gui_mch_set_menu_pos( XtUnmanageChild(menuBar); XtVaGetValues(menuBar, XtNborderWidth, &border, NULL); - /* avoid trouble when there are no menu items, and h is 1 */ + // avoid trouble when there are no menu items, and h is 1 height = h - 2 * border; if (height < 0) height = 1; @@ -709,19 +708,17 @@ gui_mch_set_menu_pos( static Cardinal athena_calculate_ins_pos(Widget widget) { - /* Assume that if the parent of the vimmenu_T is NULL, then we can get - * to this menu by traversing "next", starting at "root_menu". - * - * This holds true for popup menus, toolbar, and toplevel menu items. - */ + // Assume that if the parent of the vimmenu_T is NULL, then we can get + // to this menu by traversing "next", starting at "root_menu". + // + // This holds true for popup menus, toolbar, and toplevel menu items. - /* Popup menus: "id" is NULL. Only submenu_id is valid */ + // Popup menus: "id" is NULL. Only submenu_id is valid - /* Menus that are not toplevel: "parent" will be non-NULL, "id" & - * "submenu_id" will be non-NULL. - */ + // Menus that are not toplevel: "parent" will be non-NULL, "id" & + // "submenu_id" will be non-NULL. - /* Toplevel menus: "parent" is NULL, id is the widget of the menu item */ + // Toplevel menus: "parent" is NULL, id is the widget of the menu item WidgetList children; Cardinal num_children = 0; @@ -793,7 +790,7 @@ gui_mch_add_menu(vimmenu_T *menu, int id gui_athena_menu_colors(menu->submenu_id); gui_athena_menu_font(menu->submenu_id); - /* Don't update the menu height when it was set at a fixed value */ + // Don't update the menu height when it was set at a fixed value if (!gui.menu_height_fixed) { /* @@ -827,9 +824,8 @@ gui_mch_add_menu(vimmenu_T *menu, int id XtVaSetValues(menu->id, XtNrightBitmap, pullerBitmap, NULL); - /* If there are other menu items that are not pulldown menus, - * we need to adjust the right margins of those, too. - */ + // If there are other menu items that are not pulldown menus, + // we need to adjust the right margins of those, too. { WidgetList children; Cardinal num_children; @@ -865,11 +861,10 @@ gui_mch_add_menu(vimmenu_T *menu, int id a_cur_menu = NULL; } -/* Used to determine whether a SimpleMenu has pulldown entries. - * - * "id" is the parent of the menu items. - * Ignore widget "ignore" in the pane. - */ +// Used to determine whether a SimpleMenu has pulldown entries. +// +// "id" is the parent of the menu items. +// Ignore widget "ignore" in the pane. static Boolean gui_athena_menu_has_submenus(Widget id, Widget ignore) { @@ -900,8 +895,8 @@ gui_athena_menu_font(Widget id) { XtUnmanageChild(id); XtVaSetValues(id, XtNfontSet, gui.menu_fontset, NULL); - /* We should force the widget to recalculate its - * geometry now. */ + // We should force the widget to recalculate its + // geometry now. XtManageChild(id); } else @@ -929,7 +924,7 @@ gui_athena_menu_font(Widget id) if (has_submenu(id)) XtVaSetValues(id, XtNrightBitmap, pullerBitmap, NULL); - /* Force the widget to recalculate its geometry now. */ + // Force the widget to recalculate its geometry now. if (managed) XtManageChild(id); } @@ -953,10 +948,9 @@ gui_mch_new_menu_font(void) gui_mch_submenu_change(root_menu, FALSE); { - /* Iterate through the menubar menu items and get the height of - * each one. The menu bar height is set to the maximum of all - * the heights. - */ + // Iterate through the menubar menu items and get the height of + // each one. The menu bar height is set to the maximum of all + // the heights. vimmenu_T *mp; int max_height = 9999; @@ -975,7 +969,7 @@ gui_mch_new_menu_font(void) } if (max_height != 9999) { - /* Don't update the menu height when it was set at a fixed value */ + // Don't update the menu height when it was set at a fixed value if (!gui.menu_height_fixed) { Dimension space, border; @@ -988,12 +982,11 @@ gui_mch_new_menu_font(void) } } } - /* Now, to simulate the window being resized. Only, this - * will resize the window to its current state. - * - * There has to be a better way, but I do not see one at this time. - * (David Harrison) - */ + // Now, to simulate the window being resized. Only, this + // will resize the window to its current state. + // + // There has to be a better way, but I do not see one at this time. + // (David Harrison) { Position w, h; @@ -1048,7 +1041,7 @@ gui_mch_new_tooltip_colors(void) static void gui_mch_submenu_change( vimmenu_T *menu, - int colors) /* TRUE for colors, FALSE for font */ + int colors) // TRUE for colors, FALSE for font { vimmenu_T *mp; @@ -1060,8 +1053,8 @@ gui_mch_submenu_change( { gui_athena_menu_colors(mp->id); #ifdef FEAT_TOOLBAR - /* For a toolbar item: Free the pixmap and allocate a new one, - * so that the background color is right. */ + // For a toolbar item: Free the pixmap and allocate a new one, + // so that the background color is right. if (mp->image != (Pixmap)0) { XFreePixmap(gui.dpy, mp->image); @@ -1071,7 +1064,7 @@ gui_mch_submenu_change( } # ifdef FEAT_BEVAL_GUI - /* If we have a tooltip, then we need to change its colors */ + // If we have a tooltip, then we need to change its colors if (mp->tip != NULL) { Arg args[2]; @@ -1089,9 +1082,8 @@ gui_mch_submenu_change( { gui_athena_menu_font(mp->id); #ifdef FEAT_BEVAL_GUI - /* If we have a tooltip, then we need to change its font */ - /* Assume XtNinternational == True (in createBalloonEvalWindow) - */ + // If we have a tooltip, then we need to change its font + // Assume XtNinternational == True (in createBalloonEvalWindow) if (mp->tip != NULL) { Arg args[1]; @@ -1106,7 +1098,7 @@ gui_mch_submenu_change( if (mp->children != NULL) { - /* Set the colors/font for the tear off widget */ + // Set the colors/font for the tear off widget if (mp->submenu_id != (Widget)0) { if (colors) @@ -1114,7 +1106,7 @@ gui_mch_submenu_change( else gui_athena_menu_font(mp->submenu_id); } - /* Set the colors for the children */ + // Set the colors for the children gui_mch_submenu_change(mp->children, colors); } } @@ -1171,18 +1163,15 @@ gui_mch_add_menu_item(vimmenu_T *menu, i } XtSetArg(args[n], XtNhighlightThickness, 0); n++; type = commandWidgetClass; - /* TODO: figure out the position in the toolbar? - * This currently works fine for the default toolbar, but - * what if we add/remove items during later runtime? - */ + // TODO: figure out the position in the toolbar? + // This currently works fine for the default toolbar, but + // what if we add/remove items during later runtime? - /* NOTE: "idx" isn't used here. The position is calculated by - * athena_calculate_ins_pos(). The position it calculates - * should be equal to "idx". - */ - /* TODO: Could we just store "idx" and use that as the child - * placement? - */ + // NOTE: "idx" isn't used here. The position is calculated by + // athena_calculate_ins_pos(). The position it calculates + // should be equal to "idx". + // TODO: Could we just store "idx" and use that as the child + // placement? if (menu->id == NULL) { @@ -1206,10 +1195,10 @@ gui_mch_add_menu_item(vimmenu_T *menu, i gui_mch_show_toolbar(TRUE); gui.toolbar_height = gui_mch_compute_toolbar_height(); return; - } /* toolbar menu item */ + } // toolbar menu item # endif - /* Add menu separator */ + // Add menu separator if (menu_is_separator(menu->name)) { menu->submenu_id = (Widget)0; @@ -1235,10 +1224,9 @@ gui_mch_add_menu_item(vimmenu_T *menu, i if (menu->id == (Widget)0) return; - /* If there are other "pulldown" items in this pane, then adjust - * the right margin to accommodate the arrow pixmap, otherwise - * the right margin will be the same as the left margin. - */ + // If there are other "pulldown" items in this pane, then adjust + // the right margin to accommodate the arrow pixmap, otherwise + // the right margin will be the same as the left margin. { Dimension left_margin; @@ -1263,16 +1251,15 @@ gui_mch_add_menu_item(vimmenu_T *menu, i void gui_mch_show_toolbar(int showit) { - Cardinal numChildren; /* how many children toolBar has */ + Cardinal numChildren; // how many children toolBar has if (toolBar == (Widget)0) return; XtVaGetValues(toolBar, XtNnumChildren, &numChildren, NULL); if (showit && numChildren > 0) { - /* Assume that we want to show the toolbar if p_toolbar contains valid - * option settings, therefore p_toolbar must not be NULL. - */ + // Assume that we want to show the toolbar if p_toolbar contains valid + // option settings, therefore p_toolbar must not be NULL. WidgetList children; XtVaGetValues(toolBar, XtNchildren, &children, NULL); @@ -1296,12 +1283,11 @@ gui_mch_show_toolbar(int showit) for (toolbar = root_menu; toolbar; toolbar = toolbar->next) if (menu_is_toolbar(toolbar->dname)) break; - /* Assumption: toolbar is NULL if there is no toolbar, - * otherwise it contains the toolbar menu structure. - * - * Assumption: "numChildren" == the number of items in the list - * of items beginning with toolbar->children. - */ + // Assumption: toolbar is NULL if there is no toolbar, + // otherwise it contains the toolbar menu structure. + // + // Assumption: "numChildren" == the number of items in the list + // of items beginning with toolbar->children. if (toolbar) { for (cur = toolbar->children; cur; cur = cur->next) @@ -1309,9 +1295,8 @@ gui_mch_show_toolbar(int showit) Arg args[2]; int n = 0; - /* Enable/Disable tooltip (OK to enable while currently - * enabled) - */ + // Enable/Disable tooltip (OK to enable while currently + // enabled) if (cur->tip != NULL) (*action)(cur->tip); if (text == 1) @@ -1387,12 +1372,12 @@ gui_mch_show_toolbar(int showit) int gui_mch_compute_toolbar_height(void) { - Dimension height; /* total Toolbar height */ - Dimension whgt; /* height of each widget */ - Dimension marginHeight; /* XmNmarginHeight of toolBar */ - Dimension shadowThickness; /* thickness of Xtparent(toolBar) */ - WidgetList children; /* list of toolBar's children */ - Cardinal numChildren; /* how many children toolBar has */ + Dimension height; // total Toolbar height + Dimension whgt; // height of each widget + Dimension marginHeight; // XmNmarginHeight of toolBar + Dimension shadowThickness; // thickness of Xtparent(toolBar) + WidgetList children; // list of toolBar's children + Cardinal numChildren; // how many children toolBar has int i; height = 0; @@ -1438,7 +1423,7 @@ gui_mch_get_toolbar_colors( void gui_mch_toggle_tearoffs(int enable UNUSED) { - /* no tearoff menus */ + // no tearoff menus } void @@ -1464,23 +1449,21 @@ gui_mch_destroy_menu(vimmenu_T *menu) { Widget parent; - /* There is no item for the toolbar. */ + // There is no item for the toolbar. if (menu->id == (Widget)0) return; parent = XtParent(menu->id); - /* When removing the last "pulldown" menu item from a pane, adjust the - * right margins of the remaining widgets. - */ + // When removing the last "pulldown" menu item from a pane, adjust the + // right margins of the remaining widgets. if (menu->submenu_id != (Widget)0) { - /* Go through the menu items in the parent of this item and - * adjust their margins, if necessary. - * This takes care of the case when we delete the last menu item in a - * pane that has a submenu. In this case, there will be no arrow - * pixmaps shown anymore. - */ + // Go through the menu items in the parent of this item and + // adjust their margins, if necessary. + // This takes care of the case when we delete the last menu item in a + // pane that has a submenu. In this case, there will be no arrow + // pixmaps shown anymore. { WidgetList children; Cardinal num_children; @@ -1515,11 +1498,10 @@ gui_mch_destroy_menu(vimmenu_T *menu) } } } - /* Please be sure to destroy the parent widget first (i.e. menu->id). - * - * This code should be basically identical to that in the file gui_motif.c - * because they are both Xt based. - */ + // Please be sure to destroy the parent widget first (i.e. menu->id). + // + // This code should be basically identical to that in the file gui_motif.c + // because they are both Xt based. if (menu->id != (Widget)0) { Cardinal num_children; @@ -1535,15 +1517,14 @@ gui_mch_destroy_menu(vimmenu_T *menu) #if defined(FEAT_TOOLBAR) && defined(FEAT_BEVAL_GUI) if (parent == toolBar && menu->tip != NULL) { - /* We try to destroy this before the actual menu, because there are - * callbacks, etc. that will be unregistered during the tooltip - * destruction. - * - * If you call "gui_mch_destroy_beval_area()" after destroying - * menu->id, then the tooltip's window will have already been - * deallocated by Xt, and unknown behaviour will ensue (probably - * a core dump). - */ + // We try to destroy this before the actual menu, because there are + // callbacks, etc. that will be unregistered during the tooltip + // destruction. + // + // If you call "gui_mch_destroy_beval_area()" after destroying + // menu->id, then the tooltip's window will have already been + // deallocated by Xt, and unknown behaviour will ensue (probably + // a core dump). gui_mch_destroy_beval_area(menu->tip); menu->tip = NULL; } @@ -1555,15 +1536,14 @@ gui_mch_destroy_menu(vimmenu_T *menu) * will be deleted soon anyway, and it will delete its children like * all good widgets do. */ - /* NOTE: The cause of the BadValue X Protocol Error is because when the - * last child is destroyed, it is first unmanaged, thus causing a - * geometry resize request from the parent Shell widget. - * Since the Shell widget has no more children, it is resized to have - * width/height of 0. XConfigureWindow() is then called with the - * width/height of 0, which generates the BadValue. - * - * This happens in phase two of the widget destruction process. - */ + // NOTE: The cause of the BadValue X Protocol Error is because when the + // last child is destroyed, it is first unmanaged, thus causing a + // geometry resize request from the parent Shell widget. + // Since the Shell widget has no more children, it is resized to have + // width/height of 0. XConfigureWindow() is then called with the + // width/height of 0, which generates the BadValue. + // + // This happens in phase two of the widget destruction process. { if (parent != menuBar #ifdef FEAT_TOOLBAR @@ -1588,7 +1568,7 @@ gui_mch_destroy_menu(vimmenu_T *menu) #ifdef FEAT_TOOLBAR else if (parent == toolBar) { - /* When removing last toolbar item, don't display the toolbar. */ + // When removing last toolbar item, don't display the toolbar. XtVaGetValues(toolBar, XtNnumChildren, &num_children, NULL); if (num_children == 0) gui_mch_show_toolbar(FALSE); @@ -1620,7 +1600,7 @@ gui_athena_menu_timeout( XtVaGetValues(w, XtNrightBitmap, &p, NULL); if ((p != None) && (p != XtUnspecifiedPixmap)) { - /* We are dealing with an item that has a submenu */ + // We are dealing with an item that has a submenu popup = get_popup_entry(XtParent(w)); if (popup == (Widget)0) return; @@ -1629,7 +1609,8 @@ gui_athena_menu_timeout( } } -/* This routine is used to calculate the position (in screen coordinates) +/* + * This routine is used to calculate the position (in screen coordinates) * where a submenu should appear relative to the menu entry that popped it * up. It should appear even with and just slightly to the left of the * rightmost end of the menu entry that caused the popup. @@ -1642,12 +1623,12 @@ gui_athena_popup_callback( XtPointer client_data, XtPointer call_data UNUSED) { - /* Assumption: XtIsSubclass(XtParent(w),simpleMenuWidgetClass) */ + // Assumption: XtIsSubclass(XtParent(w),simpleMenuWidgetClass) vimmenu_T *menu = (vimmenu_T *)client_data; Dimension width; Position root_x, root_y; - /* First, popdown any siblings that may have menus popped up */ + // First, popdown any siblings that may have menus popped up { vimmenu_T *i; @@ -1660,8 +1641,8 @@ gui_athena_popup_callback( XtVaGetValues(XtParent(w), XtNwidth, &width, NULL); - /* Assumption: XawSimpleMenuGetActiveEntry(XtParent(w)) == menu->id */ - /* i.e. This IS the active entry */ + // Assumption: XawSimpleMenuGetActiveEntry(XtParent(w)) == menu->id + // i.e. This IS the active entry XtTranslateCoords(menu->id,width - 5, 0, &root_x, &root_y); XtVaSetValues(w, XtNx, root_x, XtNy, root_y, @@ -1696,7 +1677,9 @@ gui_athena_popdown_submenus_action( } } -/* Used to determine if the given widget has a submenu that can be popped up. */ +/* + * Used to determine if the given widget has a submenu that can be popped up. + */ static Boolean has_submenu(Widget widget) { @@ -1740,7 +1723,7 @@ gui_athena_delayed_arm_action( { if (timer) { - /* If the timeout hasn't been triggered, remove it */ + // If the timeout hasn't been triggered, remove it XtRemoveTimeOut(timer); } gui_athena_popdown_submenus_action(w,event,args,nargs); @@ -1760,22 +1743,22 @@ get_popup_entry(Widget w) { Widget menuw; - /* Get the active entry for the current menu */ + // Get the active entry for the current menu if ((menuw = XawSimpleMenuGetActiveEntry(w)) == (Widget)0) return NULL; return submenu_widget(menuw); } -/* Given the widget that has been determined to have a submenu, return the submenu widget - * that is to be popped up. +/* + * Given the widget that has been determined to have a submenu, return the + * submenu widget that is to be popped up. */ static Widget submenu_widget(Widget widget) { - /* Precondition: has_submenu(widget) == True - * XtIsSubclass(XtParent(widget),simpleMenuWidgetClass) == True - */ + // Precondition: has_submenu(widget) == True + // XtIsSubclass(XtParent(widget),simpleMenuWidgetClass) == True char_u *pullright_name; Widget popup; @@ -1785,8 +1768,8 @@ submenu_widget(Widget widget) vim_free(pullright_name); return popup; - /* Postcondition: (popup != NULL) implies - * (XtIsSubclass(popup,simpleMenuWidgetClass) == True) */ + // Postcondition: (popup != NULL) implies + // (XtIsSubclass(popup,simpleMenuWidgetClass) == True) } void @@ -1799,7 +1782,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu) if (menu->submenu_id == (Widget)0) return; - /* Position the popup menu at the pointer */ + // Position the popup menu at the pointer if (XQueryPointer(gui.dpy, XtWindow(vimShell), &root, &child, &rootx, &rooty, &winx, &winy, &mask)) { @@ -1819,7 +1802,7 @@ gui_mch_show_popupmenu(vimmenu_T *menu) XtPopupSpringLoaded(menu->submenu_id); } -#endif /* FEAT_MENU */ +#endif // FEAT_MENU /* * Set the menu and scrollbar colors to their default values. @@ -1866,7 +1849,7 @@ gui_mch_set_scrollbar_thumb( */ if (max == 0) { - /* So you can't scroll it at all (normally it scrolls past end) */ + // So you can't scroll it at all (normally it scrolls past end) #ifdef FEAT_GUI_NEXTAW XawScrollbarSetThumb(sb->id, 0.0, 1.0); #else @@ -1921,7 +1904,7 @@ gui_mch_enable_scrollbar(scrollbar_T *sb void gui_mch_create_scrollbar( scrollbar_T *sb, - int orient) /* SBAR_VERT or SBAR_HORIZ */ + int orient) // SBAR_VERT or SBAR_HORIZ { sb->id = XtVaCreateWidget("scrollBar", #ifdef FEAT_GUI_NEXTAW @@ -1971,7 +1954,7 @@ gui_mch_set_scrollbar_colors(scrollbar_T XtNbackground, gui.scroll_bg_pixel, NULL); - /* This is needed for the rectangle below the vertical scrollbars. */ + // This is needed for the rectangle below the vertical scrollbars. if (sb == &gui.bottom_sbar && vimForm != (Widget)0) gui_athena_scroll_colors(vimForm); } @@ -1992,17 +1975,17 @@ gui_x11_get_wid(void) */ char_u * gui_mch_browse( - int saving UNUSED, /* select file to write */ - char_u *title, /* title for the window */ - char_u *dflt, /* default name */ - char_u *ext UNUSED, /* extension added */ - char_u *initdir, /* initial directory, NULL for current dir */ - char_u *filter UNUSED) /* file name filter */ + int saving UNUSED, // select file to write + char_u *title, // title for the window + char_u *dflt, // default name + char_u *ext UNUSED, // extension added + char_u *initdir, // initial directory, NULL for current dir + char_u *filter UNUSED) // file name filter { Position x, y; char_u dirbuf[MAXPATHL]; - /* Concatenate "initdir" and "dflt". */ + // Concatenate "initdir" and "dflt". if (initdir == NULL || *initdir == NUL) mch_dirname(dirbuf, MAXPATHL); else if (STRLEN(initdir) + 2 < MAXPATHL) @@ -2016,7 +1999,7 @@ gui_mch_browse( STRCAT(dirbuf, dflt); } - /* Position the file selector just below the menubar */ + // Position the file selector just below the menubar XtTranslateCoords(vimShell, (Position)0, (Position) #ifdef FEAT_MENU gui.menu_height @@ -2111,13 +2094,13 @@ gui_mch_dialog( title = (char_u *)_("Vim dialog"); dialogStatus = -1; - /* if our pointer is currently hidden, then we should show it. */ + // if our pointer is currently hidden, then we should show it. gui_mch_mousehide(FALSE); - /* Check 'v' flag in 'guioptions': vertical button placement. */ + // Check 'v' flag in 'guioptions': vertical button placement. vertical = (vim_strchr(p_go, GO_VERTICAL) != NULL); - /* The shell is created each time, to make sure it is resized properly */ + // The shell is created each time, to make sure it is resized properly dialogshell = XtVaCreatePopupShell("dialogShell", transientShellWidgetClass, vimShell, XtNtitle, title, @@ -2170,7 +2153,7 @@ gui_mch_dialog( XtSetKeyboardFocus(dialog, dialogtextfield); } - /* make a copy, so that we can insert NULs */ + // make a copy, so that we can insert NULs buts = vim_strsave(buttons); if (buts == NULL) return -1; @@ -2213,7 +2196,7 @@ gui_mch_dialog( XtRealizeWidget(dialogshell); - /* Setup for catching the close-window event, don't let it close Vim! */ + // Setup for catching the close-window event, don't let it close Vim! dialogatom = XInternAtom(gui.dpy, "WM_DELETE_WINDOW", False); XSetWMProtocols(gui.dpy, XtWindow(dialogshell), &dialogatom, 1); XtAddEventHandler(dialogshell, NoEventMask, True, dialog_wm_handler, NULL); @@ -2236,8 +2219,8 @@ gui_mch_dialog( y = 0; XtVaSetValues(dialogshell, XtNx, x, XtNy, y, NULL); - /* Position the mouse pointer in the dialog, required for when focus - * follows mouse. */ + // Position the mouse pointer in the dialog, required for when focus + // follows mouse. XWarpPointer(gui.dpy, (Window)0, XtWindow(dialogshell), 0, 0, 0, 0, 20, 40); diff --git a/src/gui_beval.c b/src/gui_beval.c --- a/src/gui_beval.c +++ b/src/gui_beval.c @@ -12,7 +12,7 @@ #if defined(FEAT_BEVAL_GUI) || defined(PROTO) -/* on Win32 only get_beval_info() is required */ +// on Win32 only get_beval_info() is required #if !defined(FEAT_GUI_MSWIN) || defined(PROTO) #ifdef FEAT_GUI_GTK @@ -32,7 +32,7 @@ # include # include # else - /* Assume Athena */ + // Assume Athena # include # ifdef FEAT_GUI_NEXTAW # include @@ -95,7 +95,7 @@ gui_mch_create_beval_area( void *clientData) { #ifndef FEAT_GUI_GTK - char *display_name; /* get from gui.dpy */ + char *display_name; // get from gui.dpy int screen_num; char *p; #endif @@ -157,7 +157,7 @@ gui_mch_destroy_beval_area(BalloonEval * { cancelBalloon(beval); removeEventHandler(beval); - /* Children will automatically be destroyed */ + // Children will automatically be destroyed # ifdef FEAT_GUI_GTK gtk_widget_destroy(beval->balloonShell); # else @@ -198,7 +198,7 @@ gui_mch_currently_showing_beval(void) return current_beval; } #endif -#endif /* !FEAT_GUI_MSWIN */ +#endif // !FEAT_GUI_MSWIN #if defined(FEAT_NETBEANS_INTG) || defined(FEAT_EVAL) || defined(PROTO) # if !defined(FEAT_GUI_MSWIN) || defined(PROTO) @@ -216,8 +216,8 @@ gui_mch_post_balloon(BalloonEval *beval, else undrawBalloon(beval); } -# endif /* !FEAT_GUI_MSWIN */ -#endif /* FEAT_NETBEANS_INTG || PROTO */ +# endif // !FEAT_GUI_MSWIN +#endif // FEAT_NETBEANS_INTG || PROTO #if !defined(FEAT_GUI_MSWIN) || defined(PROTO) #if defined(FEAT_BEVAL_TIP) || defined(PROTO) @@ -344,7 +344,7 @@ target_event_cb(GtkWidget *widget, GdkEv break; } - return FALSE; /* continue emission */ + return FALSE; // continue emission } static gint @@ -364,7 +364,7 @@ mainwin_event_cb(GtkWidget *widget UNUSE break; } - return FALSE; /* continue emission */ + return FALSE; // continue emission } static void @@ -383,7 +383,7 @@ pointer_event(BalloonEval *beval, int x, beval->state = state; cancelBalloon(beval); - /* Mouse buttons are pressed - no balloon now */ + // Mouse buttons are pressed - no balloon now if (!(state & ((int)GDK_BUTTON1_MASK | (int)GDK_BUTTON2_MASK | (int)GDK_BUTTON3_MASK))) { @@ -431,8 +431,8 @@ key_event(BalloonEval *beval, unsigned k ? (int)GDK_CONTROL_MASK : 0); break; default: - /* Don't do this for key release, we apparently get these with - * focus changes in some GTK version. */ + // Don't do this for key release, we apparently get these with + // focus changes in some GTK version. if (is_keypress) cancelBalloon(beval); break; @@ -455,7 +455,7 @@ timeout_cb(gpointer data) */ requestBalloon(beval); - return FALSE; /* don't call me again */ + return FALSE; // don't call me again } # if GTK_CHECK_VERSION(3,0,0) @@ -499,11 +499,11 @@ balloon_expose_event_cb(GtkWidget *widge &event->area, widget, "tooltip", 0, 0, -1, -1); - return FALSE; /* continue emission */ + return FALSE; // continue emission } -# endif /* !GTK_CHECK_VERSION(3,0,0) */ +# endif // !GTK_CHECK_VERSION(3,0,0) -#else /* !FEAT_GUI_GTK */ +#else // !FEAT_GUI_GTK static void addEventHandler(Widget target, BalloonEval *beval) @@ -551,8 +551,8 @@ pointerEventEH( static void pointerEvent(BalloonEval *beval, XEvent *event) { - Position distance; /* a measure of how much the pointer moved */ - Position delta; /* used to compute distance */ + Position distance; // a measure of how much the pointer moved + Position delta; // used to compute distance switch (event->type) { @@ -575,7 +575,7 @@ pointerEvent(BalloonEval *beval, XEvent beval->state = event->xmotion.state; if (beval->state & (Button1Mask|Button2Mask|Button3Mask)) { - /* Mouse buttons are pressed - no balloon now */ + // Mouse buttons are pressed - no balloon now cancelBalloon(beval); } else if (beval->state & (Mod1Mask|Mod2Mask|Mod3Mask)) @@ -663,9 +663,9 @@ pointerEvent(BalloonEval *beval, XEvent break; case LeaveNotify: - /* Ignore LeaveNotify events that are not "normal". - * Apparently we also get it when somebody else grabs focus. - * Happens for me every two seconds (some clipboard tool?) */ + // Ignore LeaveNotify events that are not "normal". + // Apparently we also get it when somebody else grabs focus. + // Happens for me every two seconds (some clipboard tool?) if (event->xcrossing.mode == NotifyNormal) cancelBalloon(beval); break; @@ -694,14 +694,14 @@ timerRoutine(XtPointer dx, XtIntervalId requestBalloon(beval); } -#endif /* !FEAT_GUI_GTK */ +#endif // !FEAT_GUI_GTK static void requestBalloon(BalloonEval *beval) { if (beval->showState != ShS_PENDING) { - /* Determine the beval to display */ + // Determine the beval to display if (beval->msgCB != NULL) { beval->showState = ShS_PENDING; @@ -733,7 +733,7 @@ set_printable_label_text(GtkLabel *label int uc; PangoAttrList *attr_list; - /* Convert to UTF-8 if it isn't already */ + // Convert to UTF-8 if it isn't already if (output_conv.vc_type != CONV_NONE) { convbuf = string_convert(&output_conv, text, NULL); @@ -741,14 +741,14 @@ set_printable_label_text(GtkLabel *label text = convbuf; } - /* First let's see how much we need to allocate */ + // First let's see how much we need to allocate len = 0; for (p = text; *p != NUL; p += charlen) { - if ((*p & 0x80) == 0) /* be quick for ASCII */ + if ((*p & 0x80) == 0) // be quick for ASCII { charlen = 1; - len += IS_NONPRINTABLE(*p) ? 2 : 1; /* nonprintable: ^X */ + len += IS_NONPRINTABLE(*p) ? 2 : 1; // nonprintable: ^X } else { @@ -756,14 +756,14 @@ set_printable_label_text(GtkLabel *label uc = utf_ptr2char(p); if (charlen != utf_char2len(uc)) - charlen = 1; /* reject overlong sequences */ + charlen = 1; // reject overlong sequences - if (charlen == 1 || uc < 0xa0) /* illegal byte or */ - len += 4; /* control char: */ + if (charlen == 1 || uc < 0xa0) // illegal byte or + len += 4; // control char: else if (!utf_printable(uc)) - /* Note: we assume here that utf_printable() doesn't - * care about characters outside the BMP. */ - len += 6; /* nonprintable: */ + // Note: we assume here that utf_printable() doesn't + // care about characters outside the BMP. + len += 6; // nonprintable: else len += charlen; } @@ -772,7 +772,7 @@ set_printable_label_text(GtkLabel *label attr_list = pango_attr_list_new(); buf = alloc(len + 1); - /* Now go for the real work */ + // Now go for the real work if (buf != NULL) { attrentry_T *aep; @@ -787,7 +787,7 @@ set_printable_label_text(GtkLabel *label GdkColor color = { 0, 0, 0, 0 }; #endif - /* Look up the RGB values of the SpecialKey foreground color. */ + // Look up the RGB values of the SpecialKey foreground color. aep = syn_gui_attr2entry(HL_ATTR(HLF_8)); pixel = (aep != NULL) ? aep->ae_u.gui.fg_color : INVALCOLOR; if (pixel != INVALCOLOR) @@ -807,7 +807,7 @@ set_printable_label_text(GtkLabel *label p = text; while (*p != NUL) { - /* Be quick for ASCII */ + // Be quick for ASCII if ((*p & 0x80) == 0 && !IS_NONPRINTABLE(*p)) { *pdest++ = *p++; @@ -818,29 +818,29 @@ set_printable_label_text(GtkLabel *label uc = utf_ptr2char(p); if (charlen != utf_char2len(uc)) - charlen = 1; /* reject overlong sequences */ + charlen = 1; // reject overlong sequences if (charlen == 1 || uc < 0xa0 || !utf_printable(uc)) { int outlen; - /* Careful: we can't just use transchar_byte() here, - * since 'encoding' is not necessarily set to "utf-8". */ + // Careful: we can't just use transchar_byte() here, + // since 'encoding' is not necessarily set to "utf-8". if (*p & 0x80 && charlen == 1) { - transchar_hex(pdest, *p); /* */ + transchar_hex(pdest, *p); // outlen = 4; } else if (uc >= 0x80) { - /* Note: we assume here that utf_printable() doesn't - * care about characters outside the BMP. */ - transchar_hex(pdest, uc); /* or */ + // Note: we assume here that utf_printable() doesn't + // care about characters outside the BMP. + transchar_hex(pdest, uc); // or outlen = (uc < 0x100) ? 4 : 6; } else { - transchar_nonprint(pdest, *p); /* ^X */ + transchar_nonprint(pdest, *p); // ^X outlen = 2; } if (pixel != INVALCOLOR) @@ -940,36 +940,36 @@ drawBalloon(BalloonEval *beval) pango_layout_set_wrap(layout, PANGO_WRAP_WORD); # endif pango_layout_set_width(layout, - /* try to come up with some reasonable width */ + // try to come up with some reasonable width PANGO_SCALE * CLAMP(gui.num_cols * gui.char_width, screen_w / 2, MAX(20, screen_w - 20))); - /* Calculate the balloon's width and height. */ + // Calculate the balloon's width and height. # if GTK_CHECK_VERSION(3,0,0) gtk_widget_get_preferred_size(beval->balloonShell, &requisition, NULL); # else gtk_widget_size_request(beval->balloonShell, &requisition); # endif - /* Compute position of the balloon area */ + // Compute position of the balloon area gdk_window_get_origin(gtk_widget_get_window(beval->target), &x, &y); x += beval->x; y += beval->y; - /* Get out of the way of the mouse pointer */ + // Get out of the way of the mouse pointer if (x + x_offset + requisition.width > screen_x + screen_w) y_offset += 15; if (y + y_offset + requisition.height > screen_y + screen_h) y_offset = -requisition.height - EVAL_OFFSET_Y; - /* Sanitize values */ + // Sanitize values x = CLAMP(x + x_offset, 0, MAX(0, screen_x + screen_w - requisition.width)); y = CLAMP(y + y_offset, 0, MAX(0, screen_y + screen_h - requisition.height)); - /* Show the balloon */ + // Show the balloon # if GTK_CHECK_VERSION(3,0,0) gtk_window_move(GTK_WINDOW(beval->balloonShell), x, y); # else @@ -1048,7 +1048,7 @@ createBalloonEvalWindow(BalloonEval *bev gtk_container_add(GTK_CONTAINER(beval->balloonShell), beval->balloonLabel); } -#else /* !FEAT_GUI_GTK */ +#else // !FEAT_GUI_GTK /* * Draw a balloon. @@ -1063,15 +1063,15 @@ drawBalloon(BalloonEval *beval) if (beval->msg != NULL) { - /* Show the Balloon */ + // Show the Balloon - /* Calculate the label's width and height */ + // Calculate the label's width and height #ifdef FEAT_GUI_MOTIF XmString s; - /* For the callback function we parse NL characters to create a - * multi-line label. This doesn't work for all languages, but - * XmStringCreateLocalized() doesn't do multi-line labels... */ + // For the callback function we parse NL characters to create a + // multi-line label. This doesn't work for all languages, but + // XmStringCreateLocalized() doesn't do multi-line labels... if (beval->msgCB != NULL) s = XmStringCreateLtoR((char *)beval->msg, XmFONTLIST_DEFAULT_TAG); else @@ -1092,8 +1092,8 @@ drawBalloon(BalloonEval *beval) h += gui.border_offset << 1; XtVaSetValues(beval->balloonLabel, XmNlabelString, s, NULL); XmStringFree(s); -#else /* Athena */ - /* Assume XtNinternational == True */ +#else // Athena + // Assume XtNinternational == True XFontSet fset; XFontSetExtents *ext; @@ -1108,7 +1108,7 @@ drawBalloon(BalloonEval *beval) XtVaSetValues(beval->balloonLabel, XtNlabel, beval->msg, NULL); #endif - /* Compute position of the balloon area */ + // Compute position of the balloon area tx = beval->x_root + EVAL_OFFSET_X; ty = beval->y_root + EVAL_OFFSET_Y; if ((tx + w) > beval->screen_width) @@ -1121,13 +1121,13 @@ drawBalloon(BalloonEval *beval) XmNy, ty, NULL); #else - /* Athena */ + // Athena XtVaSetValues(beval->balloonShell, XtNx, tx, XtNy, ty, NULL); #endif - /* Set tooltip colors */ + // Set tooltip colors { Arg args[2]; @@ -1136,7 +1136,7 @@ drawBalloon(BalloonEval *beval) args[0].value = gui.tooltip_bg_pixel; args[1].name = XmNforeground; args[1].value = gui.tooltip_fg_pixel; -#else /* Athena */ +#else // Athena args[0].name = XtNbackground; args[0].value = gui.tooltip_bg_pixel; args[1].name = XtNforeground; @@ -1194,7 +1194,7 @@ createBalloonEvalWindow(BalloonEval *bev beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval", overrideShellWidgetClass, gui.dpy, args, n); #else - /* Athena */ + // Athena XtSetArg(args[n], XtNallowShellResize, True); n++; beval->balloonShell = XtAppCreateShell("balloonEval", "BalloonEval", overrideShellWidgetClass, gui.dpy, args, n); @@ -1213,7 +1213,7 @@ createBalloonEvalWindow(BalloonEval *bev beval->balloonLabel = XtCreateManagedWidget("balloonLabel", xmLabelWidgetClass, beval->balloonShell, args, n); } -#else /* FEAT_GUI_ATHENA */ +#else // FEAT_GUI_ATHENA XtSetArg(args[n], XtNforeground, gui.tooltip_fg_pixel); n++; XtSetArg(args[n], XtNbackground, gui.tooltip_bg_pixel); n++; XtSetArg(args[n], XtNinternational, True); n++; @@ -1223,7 +1223,7 @@ createBalloonEvalWindow(BalloonEval *bev #endif } -#endif /* !FEAT_GUI_GTK */ -#endif /* !FEAT_GUI_MSWIN */ +#endif // !FEAT_GUI_GTK +#endif // !FEAT_GUI_MSWIN -#endif /* FEAT_BEVAL_GUI */ +#endif // FEAT_BEVAL_GUI diff --git a/src/gui_gtk.c b/src/gui_gtk.c --- a/src/gui_gtk.c +++ b/src/gui_gtk.c @@ -37,8 +37,8 @@ # include "gui_gtk_f.h" #endif -/* GTK defines MAX and MIN, but some system header files as well. Undefine - * them and don't use them. */ +// GTK defines MAX and MIN, but some system header files as well. Undefine +// them and don't use them. #ifdef MIN # undef MIN #endif @@ -47,7 +47,7 @@ #endif #ifdef FEAT_GUI_GNOME -/* Gnome redefines _() and N_(). Grrr... */ +// Gnome redefines _() and N_(). Grrr... # ifdef _ # undef _ # endif @@ -64,7 +64,7 @@ # undef bind_textdomain_codeset # endif # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS) -# define ENABLE_NLS /* so the texts in the dialog boxes are translated */ +# define ENABLE_NLS // so the texts in the dialog boxes are translated # endif # include #endif @@ -84,7 +84,7 @@ # include #else -/* define these items to be able to generate prototypes without GTK */ +// define these items to be able to generate prototypes without GTK typedef int GtkWidget; # define gpointer int # define guint8 int @@ -118,20 +118,20 @@ static void recent_func_log_func( # if GTK_CHECK_VERSION(3,10,0) static const char * const menu_themed_names[] = { - /* 00 */ "document-new", /* sub. GTK_STOCK_NEW */ - /* 01 */ "document-open", /* sub. GTK_STOCK_OPEN */ - /* 02 */ "document-save", /* sub. GTK_STOCK_SAVE */ - /* 03 */ "edit-undo", /* sub. GTK_STOCK_UNDO */ - /* 04 */ "edit-redo", /* sub. GTK_STOCK_REDO */ - /* 05 */ "edit-cut", /* sub. GTK_STOCK_CUT */ - /* 06 */ "edit-copy", /* sub. GTK_STOCK_COPY */ - /* 07 */ "edit-paste", /* sub. GTK_STOCK_PASTE */ - /* 08 */ "document-print", /* sub. GTK_STOCK_PRINT */ - /* 09 */ "help-browser", /* sub. GTK_STOCK_HELP */ - /* 10 */ "edit-find", /* sub. GTK_STOCK_FIND */ + /* 00 */ "document-new", // sub. GTK_STOCK_NEW + /* 01 */ "document-open", // sub. GTK_STOCK_OPEN + /* 02 */ "document-save", // sub. GTK_STOCK_SAVE + /* 03 */ "edit-undo", // sub. GTK_STOCK_UNDO + /* 04 */ "edit-redo", // sub. GTK_STOCK_REDO + /* 05 */ "edit-cut", // sub. GTK_STOCK_CUT + /* 06 */ "edit-copy", // sub. GTK_STOCK_COPY + /* 07 */ "edit-paste", // sub. GTK_STOCK_PASTE + /* 08 */ "document-print", // sub. GTK_STOCK_PRINT + /* 09 */ "help-browser", // sub. GTK_STOCK_HELP + /* 10 */ "edit-find", // sub. GTK_STOCK_FIND # if GTK_CHECK_VERSION(3,14,0) - /* Use the file names in gui_gtk_res.xml, cutting off the extension. - * Similar changes follow. */ + // Use the file names in gui_gtk_res.xml, cutting off the extension. + // Similar changes follow. /* 11 */ "stock_vim_save_all", /* 12 */ "stock_vim_session_save", /* 13 */ "stock_vim_session_new", @@ -142,9 +142,9 @@ static const char * const menu_themed_na /* 13 */ "vim-session-new", /* 14 */ "vim-session-load", # endif - /* 15 */ "system-run", /* sub. GTK_STOCK_EXECUTE */ - /* 16 */ "edit-find-replace", /* sub. GTK_STOCK_FIND_AND_REPLACE */ - /* 17 */ "window-close", /* sub. GTK_STOCK_CLOSE, FIXME: fuzzy */ + /* 15 */ "system-run", // sub. GTK_STOCK_EXECUTE + /* 16 */ "edit-find-replace", // sub. GTK_STOCK_FIND_AND_REPLACE + /* 17 */ "window-close", // sub. GTK_STOCK_CLOSE, FIXME: fuzzy # if GTK_CHECK_VERSION(3,14,0) /* 18 */ "stock_vim_window_maximize", /* 19 */ "stock_vim_window_minimize", @@ -156,15 +156,15 @@ static const char * const menu_themed_na /* 20 */ "vim-window-split", /* 21 */ "vim-shell", # endif - /* 22 */ "go-previous", /* sub. GTK_STOCK_GO_BACK */ - /* 23 */ "go-next", /* sub. GTK_STOCK_GO_FORWARD */ + /* 22 */ "go-previous", // sub. GTK_STOCK_GO_BACK + /* 23 */ "go-next", // sub. GTK_STOCK_GO_FORWARD # if GTK_CHECK_VERSION(3,14,0) /* 24 */ "stock_vim_find_help", # else /* 24 */ "vim-find-help", # endif - /* 25 */ "gtk-convert", /* sub. GTK_STOCK_CONVERT */ - /* 26 */ "go-jump", /* sub. GTK_STOCK_JUMP_TO */ + /* 25 */ "gtk-convert", // sub. GTK_STOCK_CONVERT + /* 26 */ "go-jump", // sub. GTK_STOCK_JUMP_TO # if GTK_CHECK_VERSION(3,14,0) /* 27 */ "stock_vim_build_tags", /* 28 */ "stock_vim_window_split_vertical", @@ -176,9 +176,9 @@ static const char * const menu_themed_na /* 29 */ "vim-window-maximize-width", /* 30 */ "vim-window-minimize-width", # endif - /* 31 */ "application-exit", /* GTK_STOCK_QUIT */ + /* 31 */ "application-exit", // GTK_STOCK_QUIT }; -# else /* !GTK_CHECK_VERSION(3,10,0) */ +# else // !GTK_CHECK_VERSION(3,10,0) static const char * const menu_stock_ids[] = { /* 00 */ GTK_STOCK_NEW, @@ -198,7 +198,7 @@ static const char * const menu_stock_ids /* 14 */ "vim-session-load", /* 15 */ GTK_STOCK_EXECUTE, /* 16 */ GTK_STOCK_FIND_AND_REPLACE, - /* 17 */ GTK_STOCK_CLOSE, /* FIXME: fuzzy */ + /* 17 */ GTK_STOCK_CLOSE, // FIXME: fuzzy /* 18 */ "vim-window-maximize", /* 19 */ "vim-window-minimize", /* 20 */ "vim-window-split", @@ -214,7 +214,7 @@ static const char * const menu_stock_ids /* 30 */ "vim-window-minimize-width", /* 31 */ GTK_STOCK_QUIT }; -# endif /* !GTK_CHECK_VERSION(3,10,0) */ +# endif // !GTK_CHECK_VERSION(3,10,0) # ifdef USE_GRESOURCE # if !GTK_CHECK_VERSION(3,10,0) @@ -240,7 +240,7 @@ static IconNames stock_vim_icons[] = { { NULL, NULL } }; # endif -# endif /* USE_G_RESOURCE */ +# endif // USE_G_RESOURCE # ifndef USE_GRESOURCE static void @@ -316,7 +316,7 @@ load_menu_iconfile(char_u *name, GtkIcon pixel_size = 48; break; case GTK_ICON_SIZE_INVALID: - /* FALLTHROUGH */ + // FALLTHROUGH default: pixel_size = 0; break; @@ -337,7 +337,7 @@ load_menu_iconfile(char_u *name, GtkIcon image = gtk_image_new_from_icon_name("image-missing", icon_size); return image; -# else /* !GTK_CHECK_VERSION(3,10,0) */ +# else // !GTK_CHECK_VERSION(3,10,0) GtkIconSet *icon_set; GtkIconSource *icon_source; @@ -358,7 +358,7 @@ load_menu_iconfile(char_u *name, GtkIcon gtk_icon_set_unref(icon_set); return image; -# endif /* !GTK_CHECK_VERSION(3,10,0) */ +# endif // !GTK_CHECK_VERSION(3,10,0) } static GtkWidget * @@ -367,16 +367,16 @@ create_menu_icon(vimmenu_T *menu, GtkIco GtkWidget *image = NULL; char_u buf[MAXPATHL]; - /* First use a specified "icon=" argument. */ + // First use a specified "icon=" argument. if (menu->iconfile != NULL && lookup_menu_iconfile(menu->iconfile, buf)) image = load_menu_iconfile(buf, icon_size); - /* If not found and not builtin specified try using the menu name. */ + // If not found and not builtin specified try using the menu name. if (image == NULL && !menu->icon_builtin && lookup_menu_iconfile(menu->name, buf)) image = load_menu_iconfile(buf, icon_size); - /* Still not found? Then use a builtin icon, a blank one as fallback. */ + // Still not found? Then use a builtin icon, a blank one as fallback. if (image == NULL) { # if GTK_CHECK_VERSION(3,10,0) @@ -410,15 +410,15 @@ toolbar_button_focus_in_event(GtkWidget GdkEventFocus *event UNUSED, gpointer data UNUSED) { - /* When we're in a GtkPlug, we don't have window focus events, only widget - * focus. To emulate stand-alone gvim, if a button gets focus (e.g., - * into GtkPlug) immediately pass it to mainwin. */ + // When we're in a GtkPlug, we don't have window focus events, only widget + // focus. To emulate stand-alone gvim, if a button gets focus (e.g., + // into GtkPlug) immediately pass it to mainwin. if (gtk_socket_id != 0) gtk_widget_grab_focus(gui.drawarea); return TRUE; } -#endif /* FEAT_TOOLBAR */ +#endif // FEAT_TOOLBAR #if defined(FEAT_TOOLBAR) || defined(PROTO) @@ -450,7 +450,7 @@ gui_gtk_register_stock_icons(void) gtk_icon_factory_add_default(factory); g_object_unref(factory); -# else /* defined(USE_GRESOURCE) */ +# else // defined(USE_GRESOURCE) const char * const path_prefix = "/org/vim/gui/icon"; # if GTK_CHECK_VERSION(3,14,0) GdkScreen *screen = NULL; @@ -478,18 +478,18 @@ gui_gtk_register_stock_icons(void) gdk_pixbuf_get_height(pixbuf)); if (size > 16) { - /* An icon theme is supposed to provide fixed-size - * image files for each size, e.g., 16, 22, 24, ... - * Naturally, in contrast to GtkIconSet, GtkIconTheme - * won't prepare size variants for us out of a single - * fixed-size image. - * - * Currently, Vim provides 24x24 images only while the - * icon size on the menu and the toolbar is set to 16x16 - * by default. - * - * Resize them by ourselves until we have our own fully - * fledged icon theme. */ + // An icon theme is supposed to provide fixed-size + // image files for each size, e.g., 16, 22, 24, ... + // Naturally, in contrast to GtkIconSet, GtkIconTheme + // won't prepare size variants for us out of a single + // fixed-size image. + // + // Currently, Vim provides 24x24 images only while the + // icon size on the menu and the toolbar is set to 16x16 + // by default. + // + // Resize them by ourselves until we have our own fully + // fledged icon theme. GdkPixbuf *src = pixbuf; pixbuf = gdk_pixbuf_scale_simple(src, 16, 16, @@ -503,7 +503,7 @@ gui_gtk_register_stock_icons(void) g_object_unref(pixbuf); } } -# else /* !GTK_CHECK_VERSION(3,0.0) */ +# else // !GTK_CHECK_VERSION(3,0.0) GtkIconFactory * const factory = gtk_icon_factory_new(); IconNames *names; @@ -525,11 +525,11 @@ gui_gtk_register_stock_icons(void) gtk_icon_factory_add_default(factory); g_object_unref(factory); -# endif /* !GTK_CHECK_VERSION(3,0,0) */ -# endif /* defined(USE_GRESOURCE) */ +# endif // !GTK_CHECK_VERSION(3,0,0) +# endif // defined(USE_GRESOURCE) } -#endif /* FEAT_TOOLBAR */ +#endif // FEAT_TOOLBAR #if defined(FEAT_MENU) || defined(PROTO) @@ -597,9 +597,9 @@ menu_item_new(vimmenu_T *menu, GtkWidget char_u *text; int use_mnemonic; - /* It would be neat to have image menu items, but that would require major - * changes to Vim's menu system. Not to mention that all the translations - * had to be updated. */ + // It would be neat to have image menu items, but that would require major + // changes to Vim's menu system. Not to mention that all the translations + // had to be updated. menu->id = gtk_menu_item_new(); # if GTK_CHECK_VERSION(3,2,0) box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 20); @@ -653,7 +653,7 @@ gui_mch_add_menu(vimmenu_T *menu, int id menu_item_new(menu, parent_widget); # if !GTK_CHECK_VERSION(3,4,0) - /* since the tearoff should always appear first, increment idx */ + // since the tearoff should always appear first, increment idx if (parent != NULL && !menu_is_popup(parent->name)) ++idx; # endif @@ -722,8 +722,8 @@ gui_mch_add_menu_item(vimmenu_T *menu, i text = CONVERT_TO_UTF8(menu->dname); tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]); if (tooltip != NULL && !utf_valid_string(tooltip, NULL)) - /* Invalid text, can happen when 'encoding' is changed. Avoid - * a nasty GTK error message, skip the tooltip. */ + // Invalid text, can happen when 'encoding' is changed. Avoid + // a nasty GTK error message, skip the tooltip. CONVERT_TO_UTF8_FREE(tooltip); # if GTK_CHECK_VERSION(3,0,0) @@ -764,22 +764,22 @@ gui_mch_add_menu_item(vimmenu_T *menu, i } } else -# endif /* FEAT_TOOLBAR */ +# endif // FEAT_TOOLBAR { - /* No parent, must be a non-menubar menu */ + // No parent, must be a non-menubar menu if (parent == NULL || parent->submenu_id == NULL) return; # if !GTK_CHECK_VERSION(3,4,0) - /* Make place for the possible tearoff handle item. Not in the popup - * menu, it doesn't have a tearoff item. */ + // Make place for the possible tearoff handle item. Not in the popup + // menu, it doesn't have a tearoff item. if (!menu_is_popup(parent->name)) ++idx; # endif if (menu_is_separator(menu->name)) { - /* Separator: Just add it */ + // Separator: Just add it # if GTK_CHECK_VERSION(3,0,0) menu->id = gtk_separator_menu_item_new(); # else @@ -793,7 +793,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, i return; } - /* Add textual menu item. */ + // Add textual menu item. menu_item_new(menu, parent->submenu_id); gtk_widget_show(menu->id); gtk_menu_shell_insert(GTK_MENU_SHELL(parent->submenu_id), @@ -804,7 +804,7 @@ gui_mch_add_menu_item(vimmenu_T *menu, i G_CALLBACK(menu_item_activate), menu); } } -#endif /* FEAT_MENU */ +#endif // FEAT_MENU void @@ -859,7 +859,7 @@ recurse_tearoffs(vimmenu_T *menu, int va void gui_mch_toggle_tearoffs(int enable UNUSED) { - /* Do nothing */ + // Do nothing } # else void @@ -868,7 +868,7 @@ gui_mch_toggle_tearoffs(int enable) recurse_tearoffs(root_menu, enable); } # endif -#endif /* FEAT_MENU */ +#endif // FEAT_MENU #if defined(FEAT_TOOLBAR) static int @@ -885,7 +885,7 @@ get_menu_position(vimmenu_T *menu) return idx; } -#endif /* FEAT_TOOLBAR */ +#endif // FEAT_TOOLBAR #if defined(FEAT_TOOLBAR) || defined(PROTO) @@ -900,17 +900,17 @@ gui_mch_menu_set_tip(vimmenu_T *menu) tooltip = CONVERT_TO_UTF8(menu->strings[MENU_INDEX_TIP]); if (tooltip != NULL && utf_valid_string(tooltip, NULL)) # if GTK_CHECK_VERSION(3,0,0) - /* Only set the tooltip when it's valid utf-8. */ + // Only set the tooltip when it's valid utf-8. gtk_widget_set_tooltip_text(menu->id, (const gchar *)tooltip); # else - /* Only set the tooltip when it's valid utf-8. */ + // Only set the tooltip when it's valid utf-8. gtk_tooltips_set_tip(GTK_TOOLBAR(gui.toolbar)->tooltips, menu->id, (const char *)tooltip, NULL); # endif CONVERT_TO_UTF8_FREE(tooltip); } } -#endif /* FEAT_TOOLBAR */ +#endif // FEAT_TOOLBAR #if defined(FEAT_MENU) || defined(PROTO) @@ -920,13 +920,13 @@ gui_mch_menu_set_tip(vimmenu_T *menu) void gui_mch_destroy_menu(vimmenu_T *menu) { - /* Don't let gtk_container_remove automatically destroy menu->id. */ + // Don't let gtk_container_remove automatically destroy menu->id. if (menu->id != NULL) g_object_ref(menu->id); - /* Workaround for a spurious gtk warning in Ubuntu: "Trying to remove - * a child that doesn't believe we're its parent." - * Remove widget from gui.menubar before destroying it. */ + // Workaround for a spurious gtk warning in Ubuntu: "Trying to remove + // a child that doesn't believe we're its parent." + // Remove widget from gui.menubar before destroying it. if (menu->id != NULL && gui.menubar != NULL && gtk_widget_get_parent(menu->id) == gui.menubar) gtk_container_remove(GTK_CONTAINER(gui.menubar), menu->id); @@ -953,7 +953,7 @@ gui_mch_destroy_menu(vimmenu_T *menu) gtk_widget_destroy(menu->id); } else -# endif /* FEAT_TOOLBAR */ +# endif // FEAT_TOOLBAR { if (menu->submenu_id != NULL) gtk_widget_destroy(menu->submenu_id); @@ -967,7 +967,7 @@ gui_mch_destroy_menu(vimmenu_T *menu) menu->submenu_id = NULL; menu->id = NULL; } -#endif /* FEAT_MENU */ +#endif // FEAT_MENU /* @@ -1019,7 +1019,7 @@ adjustment_value_changed(GtkAdjustment * int dragging = FALSE; #ifdef FEAT_XIM - /* cancel any preediting */ + // cancel any preediting if (im_is_preediting()) xim_reset(); #endif @@ -1048,32 +1048,32 @@ adjustment_value_changed(GtkAdjustment * int width; int height; - /* vertical scrollbar: need to set "dragging" properly in case - * there are closed folds. */ + // vertical scrollbar: need to set "dragging" properly in case + // there are closed folds. gdk_window_get_pointer(sb->id->window, &x, &y, &state); gdk_window_get_size(sb->id->window, &width, &height); if (x >= 0 && x < width && y >= 0 && y < height) { if (y < width) { - /* up arrow: move one (closed fold) line up */ + // up arrow: move one (closed fold) line up dragging = FALSE; value = sb->wp->w_topline - 2; } else if (y > height - width) { - /* down arrow: move one (closed fold) line down */ + // down arrow: move one (closed fold) line down dragging = FALSE; value = sb->wp->w_topline; } } } } -#endif /* !GTK_CHECK_VERSION(3,0,0) */ +#endif // !GTK_CHECK_VERSION(3,0,0) gui_drag_scrollbar(sb, value, dragging); } -/* SBAR_VERT or SBAR_HORIZ */ +// SBAR_VERT or SBAR_HORIZ void gui_mch_create_scrollbar(scrollbar_T *sb, int orient) { @@ -1191,25 +1191,25 @@ gui_mch_browse(int saving UNUSED, title = CONVERT_TO_UTF8(title); - /* GTK has a bug, it only works with an absolute path. */ + // GTK has a bug, it only works with an absolute path. if (initdir == NULL || *initdir == NUL) mch_dirname(dirbuf, MAXPATHL); else if (vim_FullName(initdir, dirbuf, MAXPATHL - 2, FALSE) == FAIL) dirbuf[0] = NUL; - /* Always need a trailing slash for a directory. */ + // Always need a trailing slash for a directory. add_pathsep(dirbuf); - /* If our pointer is currently hidden, then we should show it. */ + // If our pointer is currently hidden, then we should show it. gui_mch_mousehide(FALSE); - /* Hack: The GTK file dialog warns when it can't access a new file, this - * makes it shut up. http://bugzilla.gnome.org/show_bug.cgi?id=664587 */ + // Hack: The GTK file dialog warns when it can't access a new file, this + // makes it shut up. http://bugzilla.gnome.org/show_bug.cgi?id=664587 log_handler = g_log_set_handler(domain, G_LOG_LEVEL_WARNING, recent_func_log_func, NULL); #ifdef USE_FILE_CHOOSER - /* We create the dialog each time, so that the button text can be "Open" - * or "Save" according to the action. */ + // We create the dialog each time, so that the button text can be "Open" + // or "Save" according to the action. fc = gtk_file_chooser_dialog_new((const gchar *)title, GTK_WINDOW(gui.mainwin), saving ? GTK_FILE_CHOOSER_ACTION_SAVE @@ -1278,11 +1278,11 @@ gui_mch_browse(int saving UNUSED, } gtk_widget_destroy(GTK_WIDGET(fc)); -#else /* !USE_FILE_CHOOSER */ +#else // !USE_FILE_CHOOSER if (gui.filedlg == NULL) { - GtkFileSelection *fs; /* shortcut */ + GtkFileSelection *fs; // shortcut gui.filedlg = gtk_file_selection_new((const gchar *)title); gtk_window_set_modal(GTK_WINDOW(gui.filedlg), TRUE); @@ -1296,7 +1296,7 @@ gui_mch_browse(int saving UNUSED, "clicked", GTK_SIGNAL_FUNC(browse_ok_cb), &gui); gtk_signal_connect(GTK_OBJECT(fs->cancel_button), "clicked", GTK_SIGNAL_FUNC(browse_cancel_cb), &gui); - /* gtk_signal_connect() doesn't work for destroy, it causes a hang */ + // gtk_signal_connect() doesn't work for destroy, it causes a hang gtk_signal_connect_object(GTK_OBJECT(gui.filedlg), "destroy", GTK_SIGNAL_FUNC(browse_destroy_cb), GTK_OBJECT(gui.filedlg)); @@ -1304,7 +1304,7 @@ gui_mch_browse(int saving UNUSED, else gtk_window_set_title(GTK_WINDOW(gui.filedlg), (const gchar *)title); - /* Concatenate "initdir" and "dflt". */ + // Concatenate "initdir" and "dflt". if (dflt != NULL && *dflt != NUL && STRLEN(dirbuf) + 2 + STRLEN(dflt) < MAXPATHL) STRCAT(dirbuf, dflt); @@ -1314,14 +1314,14 @@ gui_mch_browse(int saving UNUSED, gtk_widget_show(gui.filedlg); gtk_main(); -#endif /* !USE_FILE_CHOOSER */ +#endif // !USE_FILE_CHOOSER g_log_remove_handler(domain, log_handler); CONVERT_TO_UTF8_FREE(title); if (gui.browse_fname == NULL) return NULL; - /* shorten the file name if possible */ + // shorten the file name if possible return vim_strsave(shorten_fname1(gui.browse_fname)); } @@ -1337,10 +1337,10 @@ gui_mch_browsedir( char_u *title, char_u *initdir) { -# if defined(GTK_FILE_CHOOSER) /* Only in GTK 2.4 and later. */ +# if defined(GTK_FILE_CHOOSER) // Only in GTK 2.4 and later. char_u dirbuf[MAXPATHL]; char_u *p; - GtkWidget *dirdlg; /* file selection dialog */ + GtkWidget *dirdlg; // file selection dialog char_u *dirname = NULL; title = CONVERT_TO_UTF8(title); @@ -1360,22 +1360,22 @@ gui_mch_browsedir( CONVERT_TO_UTF8_FREE(title); - /* if our pointer is currently hidden, then we should show it. */ + // if our pointer is currently hidden, then we should show it. gui_mch_mousehide(FALSE); - /* GTK appears to insist on an absolute path. */ + // GTK appears to insist on an absolute path. if (initdir == NULL || *initdir == NUL || vim_FullName(initdir, dirbuf, MAXPATHL - 10, FALSE) == FAIL) mch_dirname(dirbuf, MAXPATHL - 10); - /* Always need a trailing slash for a directory. - * Also add a dummy file name, so that we get to the directory. */ + // Always need a trailing slash for a directory. + // Also add a dummy file name, so that we get to the directory. add_pathsep(dirbuf); STRCAT(dirbuf, "@zd(*&1|"); gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(dirdlg), (const gchar *)dirbuf); - /* Run the dialog. */ + // Run the dialog. if (gtk_dialog_run(GTK_DIALOG(dirdlg)) == GTK_RESPONSE_ACCEPT) dirname = (char_u *)gtk_file_chooser_get_filename( GTK_FILE_CHOOSER(dirdlg)); @@ -1383,19 +1383,19 @@ gui_mch_browsedir( if (dirname == NULL) return NULL; - /* shorten the file name if possible */ + // shorten the file name if possible p = vim_strsave(shorten_fname1(dirname)); g_free(dirname); return p; -# else /* !defined(GTK_FILE_CHOOSER) */ - /* For GTK 2.2 and earlier: fall back to ordinary file selector. */ +# else // !defined(GTK_FILE_CHOOSER) + // For GTK 2.2 and earlier: fall back to ordinary file selector. return gui_mch_browse(0, title, NULL, NULL, initdir, NULL); -# endif /* !defined(GTK_FILE_CHOOSER) */ +# endif // !defined(GTK_FILE_CHOOSER) } -#endif /* FEAT_BROWSE */ +#endif // FEAT_BROWSE #if defined(FEAT_GUI_DIALOG) || defined(PROTO) @@ -1470,7 +1470,7 @@ split_button_string(char_u *button_strin else MB_PTR_ADV(p); } - array[count] = NULL; /* currently not relied upon, but doesn't hurt */ + array[count] = NULL; // currently not relied upon, but doesn't hurt } *n_buttons = count; @@ -1546,22 +1546,22 @@ button_equal(const char *a, const char * dialog_add_buttons(GtkDialog *dialog, char_u *button_string) { char **ok; - char **ync; /* "yes no cancel" */ + char **ync; // "yes no cancel" char **buttons; int n_buttons = 0; int idx; - button_string = vim_strsave(button_string); /* must be writable */ + button_string = vim_strsave(button_string); // must be writable if (button_string == NULL) return; - /* Check 'v' flag in 'guioptions': vertical button placement. */ + // Check 'v' flag in 'guioptions': vertical button placement. if (vim_strchr(p_go, GO_VERTICAL) != NULL) { # if GTK_CHECK_VERSION(3,0,0) - /* Add GTK+ 3 code if necessary. */ - /* N.B. GTK+ 3 doesn't allow you to access vbox and action_area via - * the C API. */ + // Add GTK+ 3 code if necessary. + // N.B. GTK+ 3 doesn't allow you to access vbox and action_area via + // the C API. # else GtkWidget *vbutton_box; @@ -1569,7 +1569,7 @@ dialog_add_buttons(GtkDialog *dialog, ch gtk_widget_show(vbutton_box); gtk_box_pack_end(GTK_BOX(GTK_DIALOG(dialog)->vbox), vbutton_box, TRUE, FALSE, 0); - /* Overrule the "action_area" value, hopefully this works... */ + // Overrule the "action_area" value, hopefully this works... GTK_DIALOG(dialog)->action_area = vbutton_box; # endif } @@ -1604,7 +1604,7 @@ dialog_add_buttons(GtkDialog *dialog, ch * since anyone can create their own dialogs using Vim functions. * Thus we have to check for those too. */ - if (ok != NULL && ync != NULL) /* almost impossible to fail */ + if (ok != NULL && ync != NULL) // almost impossible to fail { # if GTK_CHECK_VERSION(3,10,0) if (button_equal(label, ok[0])) label = _("OK"); @@ -1649,9 +1649,9 @@ dialog_add_buttons(GtkDialog *dialog, ch */ typedef struct _DialogInfo { - int ignore_enter; /* no default button, ignore "Enter" */ - int noalt; /* accept accelerators without Alt */ - GtkDialog *dialog; /* Widget of the dialog */ + int ignore_enter; // no default button, ignore "Enter" + int noalt; // accept accelerators without Alt + GtkDialog *dialog; // Widget of the dialog } DialogInfo; static gboolean @@ -1659,14 +1659,14 @@ dialog_key_press_event_cb(GtkWidget *wid { DialogInfo *di = (DialogInfo *)data; - /* Ignore hitting Enter (or Space) when there is no default button. */ + // Ignore hitting Enter (or Space) when there is no default button. if (di->ignore_enter && (event->keyval == GDK_Return || event->keyval == ' ')) return TRUE; - else /* A different key was pressed, return to normal behavior */ + else // A different key was pressed, return to normal behavior di->ignore_enter = FALSE; - /* Close the dialog when hitting "Esc". */ + // Close the dialog when hitting "Esc". if (event->keyval == GDK_Escape) { gtk_dialog_response(di->dialog, GTK_RESPONSE_REJECT); @@ -1681,16 +1681,16 @@ dialog_key_press_event_cb(GtkWidget *wid gtk_window_get_mnemonic_modifier(GTK_WINDOW(widget))); } - return FALSE; /* continue emission */ + return FALSE; // continue emission } int -gui_mch_dialog(int type, /* type of dialog */ - char_u *title, /* title of dialog */ - char_u *message, /* message text */ - char_u *buttons, /* names of buttons */ - int def_but, /* default button */ - char_u *textfield, /* text for textfield or NULL */ +gui_mch_dialog(int type, // type of dialog + char_u *title, // title of dialog + char_u *message, // message text + char_u *buttons, // names of buttons + int def_but, // default button + char_u *textfield, // text for textfield or NULL int ex_cmd UNUSED) { GtkWidget *dialog; @@ -1710,7 +1710,7 @@ gui_mch_dialog(int type, /* type of entry = gtk_entry_new(); gtk_widget_show(entry); - /* Make Enter work like pressing OK. */ + // Make Enter work like pressing OK. gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); text = CONVERT_TO_UTF8(textfield); @@ -1748,8 +1748,8 @@ gui_mch_dialog(int type, /* type of else dialoginfo.noalt = TRUE; - /* Allow activation of mnemonic accelerators without pressing when - * there is no textfield. Handle pressing Esc. */ + // Allow activation of mnemonic accelerators without pressing when + // there is no textfield. Handle pressing Esc. g_signal_connect(G_OBJECT(dialog), "key-press-event", G_CALLBACK(&dialog_key_press_event_cb), &dialoginfo); @@ -1759,18 +1759,18 @@ gui_mch_dialog(int type, /* type of dialoginfo.ignore_enter = FALSE; } else - /* No default button, ignore pressing Enter. */ + // No default button, ignore pressing Enter. dialoginfo.ignore_enter = TRUE; - /* Show the mouse pointer if it's currently hidden. */ + // Show the mouse pointer if it's currently hidden. gui_mch_mousehide(FALSE); response = gtk_dialog_run(GTK_DIALOG(dialog)); - /* GTK_RESPONSE_NONE means the dialog was programmatically destroyed. */ + // GTK_RESPONSE_NONE means the dialog was programmatically destroyed. if (response != GTK_RESPONSE_NONE) { - if (response == GTK_RESPONSE_ACCEPT) /* Enter pressed */ + if (response == GTK_RESPONSE_ACCEPT) // Enter pressed response = def_but; if (textfield != NULL) { @@ -1787,7 +1787,7 @@ gui_mch_dialog(int type, /* type of return response > 0 ? response : 0; } -#endif /* FEAT_GUI_DIALOG */ +#endif // FEAT_GUI_DIALOG #if defined(FEAT_MENU) || defined(PROTO) @@ -1828,16 +1828,16 @@ gui_mch_show_popupmenu(vimmenu_T *menu) "vim-has-im-menu", GINT_TO_POINTER(TRUE)); } # endif -# endif /* FEAT_XIM */ +# endif // FEAT_XIM # if GTK_CHECK_VERSION(3,22,2) { GdkEventButton trigger; - /* A pseudo event to have gtk_menu_popup_at_pointer() work. Since the - * function calculates the popup menu position on the basis of the - * actual pointer position when it is invoked, the fields x, y, x_root - * and y_root are set to zero for convenience. */ + // A pseudo event to have gtk_menu_popup_at_pointer() work. Since the + // function calculates the popup menu position on the basis of the + // actual pointer position when it is invoked, the fields x, y, x_root + // and y_root are set to zero for convenience. trigger.type = GDK_BUTTON_PRESS; trigger.window = gtk_widget_get_window(gui.drawarea); trigger.send_event = FALSE; @@ -1862,8 +1862,8 @@ gui_mch_show_popupmenu(vimmenu_T *menu) #endif } -/* Ugly global variable to pass "mouse_pos" flag from gui_make_popup() to - * popup_menu_position_func(). */ +// Ugly global variable to pass "mouse_pos" flag from gui_make_popup() to +// popup_menu_position_func(). static int popup_mouse_pos; /* @@ -1892,7 +1892,7 @@ popup_menu_position_func(GtkMenu *menu U else if (curwin != NULL && gui.drawarea != NULL && gtk_widget_get_window(gui.drawarea) != NULL) { - /* Find the cursor position in the current window */ + // Find the cursor position in the current window *x += FILL_X(curwin->w_wincol + curwin->w_wcol + 1) + 1; *y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1; } @@ -1913,11 +1913,11 @@ gui_make_popup(char_u *path_name, int mo GdkWindow * const win = gtk_widget_get_window(gui.drawarea); GdkEventButton trigger; - /* A pseudo event to have gtk_menu_popup_at_*() functions work. Since - * the position where the menu pops up is automatically adjusted by - * the functions, none of the fields x, y, x_root and y_root has to be - * set to a specific value here; therefore, they are set to zero for - * convenience.*/ + // A pseudo event to have gtk_menu_popup_at_*() functions work. Since + // the position where the menu pops up is automatically adjusted by + // the functions, none of the fields x, y, x_root and y_root has to be + // set to a specific value here; therefore, they are set to zero for + // convenience. trigger.type = GDK_BUTTON_PRESS; trigger.window = win; trigger.send_event = FALSE; @@ -1961,7 +1961,7 @@ gui_make_popup(char_u *path_name, int mo } } -#endif /* FEAT_MENU */ +#endif // FEAT_MENU /* @@ -1970,16 +1970,16 @@ gui_make_popup(char_u *path_name, int mo typedef struct _SharedFindReplace { - GtkWidget *dialog; /* the main dialog widget */ - GtkWidget *wword; /* 'Whole word only' check button */ - GtkWidget *mcase; /* 'Match case' check button */ - GtkWidget *up; /* search direction 'Up' radio button */ - GtkWidget *down; /* search direction 'Down' radio button */ - GtkWidget *what; /* 'Find what' entry text widget */ - GtkWidget *with; /* 'Replace with' entry text widget */ - GtkWidget *find; /* 'Find Next' action button */ - GtkWidget *replace; /* 'Replace With' action button */ - GtkWidget *all; /* 'Replace All' action button */ + GtkWidget *dialog; // the main dialog widget + GtkWidget *wword; // 'Whole word only' check button + GtkWidget *mcase; // 'Match case' check button + GtkWidget *up; // search direction 'Up' radio button + GtkWidget *down; // search direction 'Down' radio button + GtkWidget *what; // 'Find what' entry text widget + GtkWidget *with; // 'Replace with' entry text widget + GtkWidget *find; // 'Find Next' action button + GtkWidget *replace; // 'Replace With' action button + GtkWidget *all; // 'Replace All' action button } SharedFindReplace; static SharedFindReplace find_widgets = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL}; @@ -1991,13 +1991,12 @@ find_key_press_event( GdkEventKey *event, SharedFindReplace *frdp) { - /* If the user is holding one of the key modifiers we will just bail out, - * thus preserving the possibility of normal focus traversal. - */ + // If the user is holding one of the key modifiers we will just bail out, + // thus preserving the possibility of normal focus traversal. if (event->state & (GDK_CONTROL_MASK | GDK_SHIFT_MASK)) return FALSE; - /* the Escape key synthesizes a cancellation action */ + // the Escape key synthesizes a cancellation action if (event->keyval == GDK_Escape) { gtk_widget_hide(frdp->dialog); @@ -2005,9 +2004,8 @@ find_key_press_event( return TRUE; } - /* It would be delightful if it where possible to do search history - * operations on the K_UP and K_DOWN keys here. - */ + // It would be delightful if it where possible to do search history + // operations on the K_UP and K_DOWN keys here. return FALSE; } @@ -2093,23 +2091,21 @@ entry_get_text_length(GtkEntry *entry) g_return_val_if_fail(GTK_IS_ENTRY(entry) == TRUE, 0); #if GTK_CHECK_VERSION(2,18,0) - /* 2.18 introduced a new object GtkEntryBuffer to handle text data for - * GtkEntry instead of letting each instance of the latter have its own - * storage for that. The code below is almost identical to the - * implementation of gtk_entry_get_text_length() for the versions >= 2.18. - */ + // 2.18 introduced a new object GtkEntryBuffer to handle text data for + // GtkEntry instead of letting each instance of the latter have its own + // storage for that. The code below is almost identical to the + // implementation of gtk_entry_get_text_length() for the versions >= 2.18. return gtk_entry_buffer_get_length(gtk_entry_get_buffer(entry)); #elif GTK_CHECK_VERSION(2,14,0) - /* 2.14 introduced a new function to avoid memory management bugs which can - * happen when gtk_entry_get_text() is used without due care and attention. - */ + // 2.14 introduced a new function to avoid memory management bugs which can + // happen when gtk_entry_get_text() is used without due care and attention. return gtk_entry_get_text_length(entry); #else - /* gtk_entry_get_text() returns the pointer to the storage allocated - * internally by the widget. Accordingly, use the one with great care: - * Don't free it nor modify the contents it points to; call the function - * every time you need the pointer since its value may have been changed - * by the widget. */ + // gtk_entry_get_text() returns the pointer to the storage allocated + // internally by the widget. Accordingly, use the one with great care: + // Don't free it nor modify the contents it points to; call the function + // every time you need the pointer since its value may have been changed + // by the widget. return g_utf8_strlen(gtk_entry_get_text(entry), -1); #endif } @@ -2117,7 +2113,7 @@ entry_get_text_length(GtkEntry *entry) static void find_replace_dialog_create(char_u *arg, int do_replace) { - GtkWidget *hbox; /* main top down box */ + GtkWidget *hbox; // main top down box GtkWidget *actionarea; GtkWidget *table; GtkWidget *tmp; @@ -2132,7 +2128,7 @@ find_replace_dialog_create(char_u *arg, frdp = (do_replace) ? (&repl_widgets) : (&find_widgets); - /* Get the search string to use. */ + // Get the search string to use. entry_text = get_find_dialog_text(arg, &wword, &mcase); if (entry_text != NULL && output_conv.vc_type != CONV_NONE) @@ -2157,9 +2153,9 @@ find_replace_dialog_create(char_u *arg, } gtk_window_present(GTK_WINDOW(frdp->dialog)); - /* For :promptfind dialog, always give keyboard focus to 'what' entry. - * For :promptrepl dialog, give it to 'with' entry if 'what' has an - * non-empty entry; otherwise, to 'what' entry. */ + // For :promptfind dialog, always give keyboard focus to 'what' entry. + // For :promptrepl dialog, give it to 'with' entry if 'what' has an + // non-empty entry; otherwise, to 'what' entry. gtk_widget_grab_focus(frdp->what); if (do_replace && entry_get_text_length(GTK_ENTRY(frdp->what)) > 0) gtk_widget_grab_focus(frdp->with); @@ -2170,7 +2166,7 @@ find_replace_dialog_create(char_u *arg, frdp->dialog = gtk_dialog_new(); #if GTK_CHECK_VERSION(3,0,0) - /* Nothing equivalent to gtk_dialog_set_has_separator() in GTK+ 3. */ + // Nothing equivalent to gtk_dialog_set_has_separator() in GTK+ 3. #else gtk_dialog_set_has_separator(GTK_DIALOG(frdp->dialog), FALSE); #endif @@ -2323,7 +2319,7 @@ find_replace_dialog_create(char_u *arg, GINT_TO_POINTER(FRD_FINDNEXT)); } - /* whole word only button */ + // whole word only button frdp->wword = gtk_check_button_new_with_label(CONV(_("Match whole word only"))); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->wword), (gboolean)wword); @@ -2342,7 +2338,7 @@ find_replace_dialog_create(char_u *arg, GTK_FILL, GTK_EXPAND, 2, 2); #endif - /* match case button */ + // match case button frdp->mcase = gtk_check_button_new_with_label(CONV(_("Match case"))); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(frdp->mcase), (gboolean)mcase); @@ -2385,7 +2381,7 @@ find_replace_dialog_create(char_u *arg, gtk_container_set_border_width(GTK_CONTAINER(vbox), 0); gtk_container_add(GTK_CONTAINER(tmp), vbox); - /* 'Up' and 'Down' buttons */ + // 'Up' and 'Down' buttons frdp->up = gtk_radio_button_new_with_label(NULL, CONV(_("Up"))); gtk_box_pack_start(GTK_BOX(vbox), frdp->up, TRUE, TRUE, 0); frdp->down = gtk_radio_button_new_with_label( @@ -2395,7 +2391,7 @@ find_replace_dialog_create(char_u *arg, gtk_container_set_border_width(GTK_CONTAINER(vbox), 2); gtk_box_pack_start(GTK_BOX(vbox), frdp->down, TRUE, TRUE, 0); - /* vbox to hold the action buttons */ + // vbox to hold the action buttons #if GTK_CHECK_VERSION(3,2,0) actionarea = gtk_button_box_new(GTK_ORIENTATION_VERTICAL); #else @@ -2404,7 +2400,7 @@ find_replace_dialog_create(char_u *arg, gtk_container_set_border_width(GTK_CONTAINER(actionarea), 2); gtk_box_pack_end(GTK_BOX(hbox), actionarea, FALSE, FALSE, 0); - /* 'Find Next' button */ + // 'Find Next' button #if GTK_CHECK_VERSION(3,10,0) frdp->find = create_image_button(NULL, _("Find Next")); #else @@ -2423,7 +2419,7 @@ find_replace_dialog_create(char_u *arg, if (do_replace) { - /* 'Replace' button */ + // 'Replace' button #if GTK_CHECK_VERSION(3,10,0) frdp->replace = create_image_button(NULL, _("Replace")); #else @@ -2436,7 +2432,7 @@ find_replace_dialog_create(char_u *arg, G_CALLBACK(find_replace_cb), GINT_TO_POINTER(FRD_REPLACE)); - /* 'Replace All' button */ + // 'Replace All' button #if GTK_CHECK_VERSION(3,10,0) frdp->all = create_image_button(NULL, _("Replace All")); #else @@ -2450,7 +2446,7 @@ find_replace_dialog_create(char_u *arg, GINT_TO_POINTER(FRD_REPLACEALL)); } - /* 'Cancel' button */ + // 'Cancel' button #if GTK_CHECK_VERSION(3,10,0) tmp = gtk_button_new_with_mnemonic(_("_Close")); #else @@ -2472,7 +2468,7 @@ find_replace_dialog_create(char_u *arg, #endif gtk_box_pack_end(GTK_BOX(hbox), tmp, FALSE, FALSE, 10); - /* Suppress automatic show of the unused action area */ + // Suppress automatic show of the unused action area #if GTK_CHECK_VERSION(3,0,0) # if !GTK_CHECK_VERSION(3,12,0) gtk_widget_hide(gtk_dialog_get_action_area(GTK_DIALOG(frdp->dialog))); @@ -2514,9 +2510,9 @@ find_replace_cb(GtkWidget *widget UNUSED gboolean direction_down; SharedFindReplace *sfr; - flags = (int)(long)data; /* avoid a lint warning here */ + flags = (int)(long)data; // avoid a lint warning here - /* Get the search/replace strings from the dialog */ + // Get the search/replace strings from the dialog if (flags == FRD_FINDNEXT) { repl_text = NULL; @@ -2543,7 +2539,9 @@ find_replace_cb(GtkWidget *widget UNUSED CONVERT_FROM_UTF8_FREE(find_text); } -/* our usual callback function */ +/* + * our usual callback function + */ static void entry_activate_cb(GtkWidget *widget UNUSED, gpointer data) { @@ -2568,7 +2566,7 @@ entry_changed_cb(GtkWidget * entry, GtkW entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); if (!entry_text) - return; /* shouldn't happen */ + return; // shouldn't happen nonempty = (entry_text[0] != '\0'); @@ -2589,8 +2587,8 @@ entry_changed_cb(GtkWidget * entry, GtkW void ex_helpfind(exarg_T *eap UNUSED) { - /* This will fail when menus are not loaded. Well, it's only for - * backwards compatibility anyway. */ + // This will fail when menus are not loaded. Well, it's only for + // backwards compatibility anyway. do_cmdline_cmd((char_u *)"emenu ToolBar.FindHelp"); } @@ -2601,7 +2599,7 @@ recent_func_log_func(const gchar *log_do const gchar *message UNUSED, gpointer user_data UNUSED) { - /* We just want to suppress the warnings. */ - /* http://bugzilla.gnome.org/show_bug.cgi?id=664587 */ + // We just want to suppress the warnings. + // http://bugzilla.gnome.org/show_bug.cgi?id=664587 } #endif diff --git a/src/gui_gtk_f.c b/src/gui_gtk_f.c --- a/src/gui_gtk_f.c +++ b/src/gui_gtk_f.c @@ -26,8 +26,8 @@ */ #include "vim.h" -#include /* without this it compiles, but gives errors at - runtime! */ +#include // without this it compiles, but gives errors at + // runtime! #include "gui_gtk_f.h" #if !GTK_CHECK_VERSION(3,0,0) # include @@ -44,8 +44,8 @@ struct _GtkFormChild { GtkWidget *widget; GdkWindow *window; - gint x; /* relative subwidget x position */ - gint y; /* relative subwidget y position */ + gint x; // relative subwidget x position + gint y; // relative subwidget y position gint mapped; }; @@ -101,8 +101,7 @@ static void gtk_form_child_unmap(GtkWidg static GtkWidgetClass *parent_class = NULL; #endif -/* Public interface - */ +// Public interface GtkWidget * gtk_form_new(void) @@ -128,7 +127,7 @@ gtk_form_put(GtkForm *form, g_return_if_fail(GTK_IS_FORM(form)); - /* LINTED: avoid warning: conversion to 'unsigned long' */ + // LINTED: avoid warning: conversion to 'unsigned long' child = g_new(GtkFormChild, 1); if (child == NULL) return; @@ -147,11 +146,10 @@ gtk_form_put(GtkForm *form, form->children = g_list_append(form->children, child); - /* child->window must be created and attached to the widget _before_ - * it has been realized, or else things will break with GTK2. Note - * that gtk_widget_set_parent() realizes the widget if it's visible - * and its parent is mapped. - */ + // child->window must be created and attached to the widget _before_ + // it has been realized, or else things will break with GTK2. Note + // that gtk_widget_set_parent() realizes the widget if it's visible + // and its parent is mapped. if (gtk_widget_get_realized(GTK_WIDGET(form))) gtk_form_attach_child_window(form, child); @@ -212,8 +210,7 @@ gtk_form_thaw(GtkForm *form) } } -/* Basic Object handling procedures - */ +// Basic Object handling procedures #if GTK_CHECK_VERSION(3,0,0) G_DEFINE_TYPE(GtkForm, gtk_form, GTK_TYPE_CONTAINER) #else @@ -237,7 +234,7 @@ gtk_form_get_type(void) } return form_type; } -#endif /* !GTK_CHECK_VERSION(3,0,0) */ +#endif // !GTK_CHECK_VERSION(3,0,0) static void gtk_form_class_init(GtkFormClass *klass) @@ -364,14 +361,13 @@ gtk_form_realize(GtkWidget *widget) } -/* After reading the documentation at - * http://developer.gnome.org/doc/API/2.0/gtk/gtk-changes-2-0.html - * I think it should be possible to remove this function when compiling - * against gtk-2.0. It doesn't seem to cause problems, though. - * - * Well, I reckon at least the gdk_window_show(form->bin_window) - * is necessary. GtkForm is anything but a usual container widget. - */ +// After reading the documentation at +// http://developer.gnome.org/doc/API/2.0/gtk/gtk-changes-2-0.html +// I think it should be possible to remove this function when compiling +// against gtk-2.0. It doesn't seem to cause problems, though. +// +// Well, I reckon at least the gdk_window_show(form->bin_window) +// is necessary. GtkForm is anything but a usual container widget. static void gtk_form_map(GtkWidget *widget) { @@ -480,7 +476,7 @@ gtk_form_get_preferred_height(GtkWidget *minimal_height = requisition.height; *natural_height = requisition.height; } -#endif /* GTK_CHECK_VERSION(3,0,0) */ +#endif // GTK_CHECK_VERSION(3,0,0) static void gtk_form_size_allocate(GtkWidget *widget, GtkAllocation *allocation) @@ -559,16 +555,16 @@ gtk_form_draw(GtkWidget *widget, cairo_t if (!gtk_widget_get_has_window(formchild->widget) && gtk_cairo_should_draw_window(cr, formchild->window)) { - /* To get gtk_widget_draw() to work, it is required to call - * gtk_widget_size_allocate() in advance with a well-posed - * allocation for a given child widget in order to set a - * certain private GtkWidget variable, called - * widget->priv->alloc_need, to the proper value; otherwise, - * gtk_widget_draw() fails and the relevant scrollbar won't - * appear on the screen. - * - * Calling gtk_form_position_child() like this is one of ways - * to make sure of that. */ + // To get gtk_widget_draw() to work, it is required to call + // gtk_widget_size_allocate() in advance with a well-posed + // allocation for a given child widget in order to set a + // certain private GtkWidget variable, called + // widget->priv->alloc_need, to the proper value; otherwise, + // gtk_widget_draw() fails and the relevant scrollbar won't + // appear on the screen. + // + // Calling gtk_form_position_child() like this is one of ways + // to make sure of that. gtk_form_position_child(form, formchild, TRUE); gtk_form_render_background(formchild->widget, cr); @@ -577,7 +573,7 @@ gtk_form_draw(GtkWidget *widget, cairo_t return GTK_WIDGET_CLASS(gtk_form_parent_class)->draw(widget, cr); } -#else /* !GTK_CHECK_VERSION(3,0,0) */ +#else // !GTK_CHECK_VERSION(3,0,0) static gint gtk_form_expose(GtkWidget *widget, GdkEventExpose *event) { @@ -598,16 +594,15 @@ gtk_form_expose(GtkWidget *widget, GdkEv return FALSE; } -#endif /* !GTK_CHECK_VERSION(3,0,0) */ +#endif // !GTK_CHECK_VERSION(3,0,0) -/* Container method - */ +// Container method static void gtk_form_remove(GtkContainer *container, GtkWidget *widget) { GList *tmp_list; GtkForm *form; - GtkFormChild *child = NULL; /* init for gcc */ + GtkFormChild *child = NULL; // init for gcc g_return_if_fail(GTK_IS_FORM(container)); @@ -634,9 +629,8 @@ gtk_form_remove(GtkContainer *container, g_signal_handlers_disconnect_by_func(G_OBJECT(child->widget), FUNC2GENERIC(>k_form_child_unmap), child); - /* FIXME: This will cause problems for reparenting NO_WINDOW - * widgets out of a GtkForm - */ + // FIXME: This will cause problems for reparenting NO_WINDOW + // widgets out of a GtkForm gdk_window_set_user_data(child->window, NULL); gdk_window_destroy(child->window); } @@ -676,14 +670,13 @@ gtk_form_forall(GtkContainer *container, } } -/* Operations on children - */ +// Operations on children static void gtk_form_attach_child_window(GtkForm *form, GtkFormChild *child) { if (child->window != NULL) - return; /* been there, done that */ + return; // been there, done that if (!gtk_widget_get_has_window(child->widget)) { diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c --- a/src/gui_gtk_x11.c +++ b/src/gui_gtk_x11.c @@ -31,7 +31,7 @@ #endif #ifdef FEAT_GUI_GNOME -/* Gnome redefines _() and N_(). Grrr... */ +// Gnome redefines _() and N_(). Grrr... # ifdef _ # undef _ # endif @@ -48,16 +48,16 @@ # undef bind_textdomain_codeset # endif # if defined(FEAT_GETTEXT) && !defined(ENABLE_NLS) -# define ENABLE_NLS /* so the texts in the dialog boxes are translated */ +# define ENABLE_NLS // so the texts in the dialog boxes are translated # endif # include # include "version.h" -/* missing prototype in bonobo-dock-item.h */ +// missing prototype in bonobo-dock-item.h extern void bonobo_dock_item_set_behavior(BonoboDockItem *dock_item, BonoboDockItemBehavior beh); #endif #if !defined(FEAT_GUI_GTK) && defined(PROTO) -/* When generating prototypes we don't want syntax errors. */ +// When generating prototypes we don't want syntax errors. # define GdkAtom int # define GdkEventExpose int # define GdkEventFocus int @@ -105,7 +105,7 @@ extern void bonobo_dock_item_set_behavio #define GET_X_ATOM(atom) gdk_x11_atom_to_xatom_for_display( \ gtk_widget_get_display(gui.mainwin), atom) -/* Selection type distinguishers */ +// Selection type distinguishers enum { TARGET_TYPE_NONE, @@ -177,8 +177,8 @@ static GdkAtom save_yourself_atom = GDK_ */ static GdkAtom html_atom = GDK_NONE; static GdkAtom utf8_string_atom = GDK_NONE; -static GdkAtom vim_atom = GDK_NONE; /* Vim's own special selection format */ -static GdkAtom vimenc_atom = GDK_NONE; /* Vim's extended selection format */ +static GdkAtom vim_atom = GDK_NONE; // Vim's own special selection format +static GdkAtom vimenc_atom = GDK_NONE; // Vim's extended selection format /* * Keycodes recognized by vim. @@ -218,7 +218,7 @@ const special_keys[] = {GDK_F19, 'F', '9'}, {GDK_F20, 'F', 'A'}, {GDK_F21, 'F', 'B'}, - {GDK_Pause, 'F', 'B'}, /* Pause == F21 according to netbeans.txt */ + {GDK_Pause, 'F', 'B'}, // Pause == F21 according to netbeans.txt {GDK_F22, 'F', 'C'}, {GDK_F23, 'F', 'D'}, {GDK_F24, 'F', 'E'}, @@ -249,7 +249,7 @@ const special_keys[] = {GDK_Prior, 'k', 'P'}, {GDK_Next, 'k', 'N'}, {GDK_Print, '%', '9'}, - /* Keypad keys: */ + // Keypad keys: {GDK_KP_Left, 'k', 'l'}, {GDK_KP_Right, 'k', 'r'}, {GDK_KP_Up, 'k', 'u'}, @@ -258,8 +258,8 @@ const special_keys[] = {GDK_KP_Delete, KS_EXTRA, (char_u)KE_KDEL}, {GDK_KP_Home, 'K', '1'}, {GDK_KP_End, 'K', '4'}, - {GDK_KP_Prior, 'K', '3'}, /* page up */ - {GDK_KP_Next, 'K', '5'}, /* page down */ + {GDK_KP_Prior, 'K', '3'}, // page up + {GDK_KP_Next, 'K', '5'}, // page down {GDK_KP_Add, 'K', '6'}, {GDK_KP_Subtract, 'K', '7'}, @@ -279,7 +279,7 @@ const special_keys[] = {GDK_KP_8, 'K', 'K'}, {GDK_KP_9, 'K', 'L'}, - /* End of list marker: */ + // End of list marker: {0, 0, 0} }; @@ -295,14 +295,14 @@ const special_keys[] = #define ARG_ICONIC 7 #define ARG_ROLE 8 #define ARG_NETBEANS 9 -#define ARG_XRM 10 /* ignored */ -#define ARG_MENUFONT 11 /* ignored */ +#define ARG_XRM 10 // ignored +#define ARG_MENUFONT 11 // ignored #define ARG_INDEX_MASK 0x00ff -#define ARG_HAS_VALUE 0x0100 /* a value is expected after the argument */ -#define ARG_NEEDS_GUI 0x0200 /* need to initialize the GUI for this */ -#define ARG_FOR_GTK 0x0400 /* argument is handled by GTK+ or GNOME */ -#define ARG_COMPAT_LONG 0x0800 /* accept -foo but substitute with --foo */ -#define ARG_KEEP 0x1000 /* don't remove argument from argv[] */ +#define ARG_HAS_VALUE 0x0100 // a value is expected after the argument +#define ARG_NEEDS_GUI 0x0200 // need to initialize the GUI for this +#define ARG_FOR_GTK 0x0400 // argument is handled by GTK+ or GNOME +#define ARG_COMPAT_LONG 0x0800 // accept -foo but substitute with --foo +#define ARG_KEEP 0x1000 // don't remove argument from argv[] /* * This table holds all the X GUI command line options allowed. This includes @@ -320,7 +320,7 @@ cmdline_option_T; static const cmdline_option_T cmdline_options[] = { - /* We handle these options ourselves */ + // We handle these options ourselves {"-fn", ARG_FONT|ARG_HAS_VALUE}, {"-font", ARG_FONT|ARG_HAS_VALUE}, {"-geom", ARG_GEOMETRY|ARG_HAS_VALUE}, @@ -336,12 +336,12 @@ static const cmdline_option_T cmdline_op {"-iconic", ARG_ICONIC}, {"--role", ARG_ROLE|ARG_HAS_VALUE}, #ifdef FEAT_NETBEANS_INTG - {"-nb", ARG_NETBEANS}, /* non-standard value format */ - {"-xrm", ARG_XRM|ARG_HAS_VALUE}, /* not implemented */ - {"-mf", ARG_MENUFONT|ARG_HAS_VALUE}, /* not implemented */ - {"-menufont", ARG_MENUFONT|ARG_HAS_VALUE}, /* not implemented */ + {"-nb", ARG_NETBEANS}, // non-standard value format + {"-xrm", ARG_XRM|ARG_HAS_VALUE}, // not implemented + {"-mf", ARG_MENUFONT|ARG_HAS_VALUE}, // not implemented + {"-menufont", ARG_MENUFONT|ARG_HAS_VALUE}, // not implemented #endif - /* Arguments handled by GTK (and GNOME) internally. */ + // Arguments handled by GTK (and GNOME) internally. {"--g-fatal-warnings", ARG_FOR_GTK}, {"--gdk-debug", ARG_FOR_GTK|ARG_HAS_VALUE}, {"--gdk-no-debug", ARG_FOR_GTK|ARG_HAS_VALUE}, @@ -369,7 +369,7 @@ static const cmdline_option_T cmdline_op {"-?", ARG_FOR_GTK|ARG_NEEDS_GUI}, {"--help", ARG_FOR_GTK|ARG_NEEDS_GUI|ARG_KEEP}, {"--usage", ARG_FOR_GTK|ARG_NEEDS_GUI}, -# if 0 /* conflicts with Vim's own --version argument */ +# if 0 // conflicts with Vim's own --version argument {"--version", ARG_FOR_GTK|ARG_NEEDS_GUI}, # endif {"--disable-crash-dialog", ARG_FOR_GTK}, @@ -441,14 +441,14 @@ gui_mch_prepare(int *argc, char **argv) while (i < *argc) { - /* Don't waste CPU cycles on non-option arguments. */ + // Don't waste CPU cycles on non-option arguments. if (argv[i][0] != '-' && argv[i][0] != '+') { ++i; continue; } - /* Look for argv[i] in cmdline_options[] table. */ + // Look for argv[i] in cmdline_options[] table. for (option = &cmdline_options[0]; option->name != NULL; ++option) { len = strlen(option->name); @@ -457,11 +457,11 @@ gui_mch_prepare(int *argc, char **argv) { if (argv[i][len] == '\0') break; - /* allow --foo=bar style */ + // allow --foo=bar style if (argv[i][len] == '=' && (option->flags & ARG_HAS_VALUE)) break; #ifdef FEAT_NETBEANS_INTG - /* darn, -nb has non-standard syntax */ + // darn, -nb has non-standard syntax if (vim_strchr((char_u *)":=", argv[i][len]) != NULL && (option->flags & ARG_INDEX_MASK) == ARG_NETBEANS) break; @@ -470,13 +470,13 @@ gui_mch_prepare(int *argc, char **argv) else if ((option->flags & ARG_COMPAT_LONG) && strcmp(argv[i], option->name + 1) == 0) { - /* Replace the standard X arguments "-name" and "-display" - * with their GNU-style long option counterparts. */ + // Replace the standard X arguments "-name" and "-display" + // with their GNU-style long option counterparts. argv[i] = (char *)option->name; break; } } - if (option->name == NULL) /* no match */ + if (option->name == NULL) // no match { ++i; continue; @@ -484,16 +484,16 @@ gui_mch_prepare(int *argc, char **argv) if (option->flags & ARG_FOR_GTK) { - /* Move the argument into gui_argv, which - * will later be passed to gtk_init_check() */ + // Move the argument into gui_argv, which + // will later be passed to gtk_init_check() gui_argv[gui_argc++] = argv[i]; } else { char *value = NULL; - /* Extract the option's value if there is one. - * Accept both "--foo bar" and "--foo=bar" style. */ + // Extract the option's value if there is one. + // Accept both "--foo bar" and "--foo=bar" style. if (option->flags & ARG_HAS_VALUE) { if (argv[i][len] == '=') @@ -502,7 +502,7 @@ gui_mch_prepare(int *argc, char **argv) value = argv[i + 1]; } - /* Check for options handled by Vim itself */ + // Check for options handled by Vim itself switch (option->flags & ARG_INDEX_MASK) { case ARG_REVERSE: @@ -528,11 +528,11 @@ gui_mch_prepare(int *argc, char **argv) found_iconic_arg = TRUE; break; case ARG_ROLE: - role_argument = value; /* used later in gui_mch_open() */ + role_argument = value; // used later in gui_mch_open() break; #ifdef FEAT_NETBEANS_INTG case ARG_NETBEANS: - gui.dofork = FALSE; /* don't fork() when starting GUI */ + gui.dofork = FALSE; // don't fork() when starting GUI netbeansArg = argv[i]; break; #endif @@ -541,9 +541,9 @@ gui_mch_prepare(int *argc, char **argv) } } - /* These arguments make gnome_program_init() print a message and exit. - * Must start the GUI for this, otherwise ":gui" will exit later! - * Only when the GUI can start. */ + // These arguments make gnome_program_init() print a message and exit. + // Must start the GUI for this, otherwise ":gui" will exit later! + // Only when the GUI can start. if ((option->flags & ARG_NEEDS_GUI) && gui_mch_early_init_check(FALSE) == OK) gui.starting = TRUE; @@ -552,12 +552,12 @@ gui_mch_prepare(int *argc, char **argv) ++i; else { - /* Remove the flag from the argument vector. */ + // Remove the flag from the argument vector. if (--*argc > i) { int n_strip = 1; - /* Move the argument's value as well, if there is one. */ + // Move the argument's value as well, if there is one. if ((option->flags & ARG_HAS_VALUE) && argv[i][len] != '=' && strcmp(argv[i + 1], "--") != 0) @@ -612,7 +612,7 @@ visibility_event(GtkWidget *widget UNUSE gui.visibility != GDK_VISIBILITY_UNOBSCURED); return FALSE; } -#endif /* !GTK_CHECK_VERSION(3,0,0) */ +#endif // !GTK_CHECK_VERSION(3,0,0) /* * Redraw the corresponding portions of the screen. @@ -626,7 +626,7 @@ static gboolean gui_gtk_is_blink_on(void static void gui_gtk3_redraw(int x, int y, int width, int height) { - /* Range checks are left to gui_redraw_block() */ + // Range checks are left to gui_redraw_block() gui_redraw_block(Y_2_ROW(y), X_2_COL(x), Y_2_ROW(y + height - 1), X_2_COL(x + width - 1), GUI_MON_NOCLEAR); @@ -663,16 +663,16 @@ draw_event(GtkWidget *widget UNUSED, cairo_t *cr, gpointer user_data UNUSED) { - /* Skip this when the GUI isn't set up yet, will redraw later. */ + // Skip this when the GUI isn't set up yet, will redraw later. if (gui.starting) return FALSE; - out_flush(); /* make sure all output has been processed */ - /* for GTK+ 3, may induce other draw events. */ + out_flush(); // make sure all output has been processed + // for GTK+ 3, may induce other draw events. cairo_set_source_surface(cr, gui.surface, 0, 0); - /* Draw the window without the cursor. */ + // Draw the window without the cursor. gui.by_signal = TRUE; { cairo_rectangle_list_t *list = NULL; @@ -682,8 +682,8 @@ draw_event(GtkWidget *widget UNUSED, { int i; - /* First clear all the blocks and then redraw them. Just in case - * some blocks overlap. */ + // First clear all the blocks and then redraw them. Just in case + // some blocks overlap. for (i = 0; i < list->num_rectangles; i++) { const cairo_rectangle_t rect = list->rectangles[i]; @@ -720,27 +720,27 @@ draw_event(GtkWidget *widget UNUSED, } gui.by_signal = FALSE; - /* Add the cursor to the window if necessary.*/ + // Add the cursor to the window if necessary. if (gui_gtk3_should_draw_cursor() && blink_mode) gui_gtk3_update_cursor(cr); return FALSE; } -#else /* !GTK_CHECK_VERSION(3,0,0) */ +#else // !GTK_CHECK_VERSION(3,0,0) static gint expose_event(GtkWidget *widget UNUSED, GdkEventExpose *event, gpointer data UNUSED) { - /* Skip this when the GUI isn't set up yet, will redraw later. */ + // Skip this when the GUI isn't set up yet, will redraw later. if (gui.starting) return FALSE; - out_flush(); /* make sure all output has been processed */ + out_flush(); // make sure all output has been processed gui_redraw(event->area.x, event->area.y, event->area.width, event->area.height); - /* Clear the border areas if needed */ + // Clear the border areas if needed if (event->area.x < FILL_X(0)) gdk_window_clear_area(gui.drawarea->window, 0, 0, FILL_X(0), 0); if (event->area.y < FILL_Y(0)) @@ -753,7 +753,7 @@ expose_event(GtkWidget *widget UNUSED, return FALSE; } -#endif /* !GTK_CHECK_VERSION(3,0,0) */ +#endif // !GTK_CHECK_VERSION(3,0,0) #ifdef FEAT_CLIENTSERVER /* @@ -771,7 +771,7 @@ property_event(GtkWidget *widget, { XEvent xev; - /* Translate to XLib */ + // Translate to XLib xev.xproperty.type = PropertyNotify; xev.xproperty.atom = commProperty; xev.xproperty.window = commWindow; @@ -781,7 +781,7 @@ property_event(GtkWidget *widget, } return FALSE; } -#endif /* defined(FEAT_CLIENTSERVER) */ +#endif // defined(FEAT_CLIENTSERVER) /* * Handle changes to the "Xft/DPI" setting @@ -826,9 +826,8 @@ timeout_remove(guint timer) } -/**************************************************************************** - * Focus handlers: - */ +///////////////////////////////////////////////////////////////////////////// +// Focus handlers: /* @@ -931,7 +930,7 @@ blink_cb(gpointer data UNUSED) } gui_mch_flush(); - return FALSE; /* don't happen again */ + return FALSE; // don't happen again } /* @@ -946,7 +945,7 @@ gui_mch_start_blink(void) timeout_remove(blink_timer); blink_timer = 0; } - /* Only switch blinking on if none of the times is zero */ + // Only switch blinking on if none of the times is zero if (blink_waittime && blink_ontime && blink_offtime && gui.in_focus) { blink_timer = timeout_add(blink_waittime, blink_cb, NULL); @@ -964,7 +963,7 @@ enter_notify_event(GtkWidget *widget UNU if (blink_state == BLINK_NONE) gui_mch_start_blink(); - /* make sure keyboard input goes there */ + // make sure keyboard input goes there if (gtk_socket_id == 0 || !gtk_widget_has_focus(gui.drawarea)) gtk_widget_grab_focus(gui.drawarea); @@ -992,8 +991,8 @@ focus_in_event(GtkWidget *widget, if (blink_state == BLINK_NONE) gui_mch_start_blink(); - /* make sure keyboard input goes to the draw area (if this is focus for a - * window) */ + // make sure keyboard input goes to the draw area (if this is focus for a + // window) if (widget != gui.drawarea) gtk_widget_grab_focus(gui.drawarea); @@ -1032,13 +1031,13 @@ keyval_to_string(unsigned int keyval, un uc = gdk_keyval_to_unicode(keyval); if (uc != 0) { - /* Check for CTRL-foo */ + // Check for CTRL-foo if ((state & GDK_CONTROL_MASK) && uc >= 0x20 && uc < 0x80) { - /* These mappings look arbitrary at the first glance, but in fact - * resemble quite exactly the behaviour of the GTK+ 1.2 GUI on my - * machine. The only difference is BS vs. DEL for CTRL-8 (makes - * more sense and is consistent with usual terminal behaviour). */ + // These mappings look arbitrary at the first glance, but in fact + // resemble quite exactly the behaviour of the GTK+ 1.2 GUI on my + // machine. The only difference is BS vs. DEL for CTRL-8 (makes + // more sense and is consistent with usual terminal behaviour). if (uc >= '@') string[0] = uc & 0x1F; else if (uc == '2') @@ -1055,16 +1054,16 @@ keyval_to_string(unsigned int keyval, un } else { - /* Translate a normal key to UTF-8. This doesn't work for dead - * keys of course, you _have_ to use an input method for that. */ + // Translate a normal key to UTF-8. This doesn't work for dead + // keys of course, you _have_ to use an input method for that. len = utf_char2bytes((int)uc, string); } } else { - /* Translate keys which are represented by ASCII control codes in Vim. - * There are only a few of those; most control keys are translated to - * special terminal-like control sequences. */ + // Translate keys which are represented by ASCII control codes in Vim. + // There are only a few of those; most control keys are translated to + // special terminal-like control sequences. len = 1; switch (keyval) { @@ -1134,8 +1133,8 @@ key_press_event(GtkWidget *widget UNUSED GdkEventKey *event, gpointer data UNUSED) { - /* For GTK+ 2 we know for sure how large the string might get. - * (That is, up to 6 bytes + NUL + CSI escapes + safety measure.) */ + // For GTK+ 2 we know for sure how large the string might get. + // (That is, up to 6 bytes + NUL + CSI escapes + safety measure.) char_u string[32], string2[32]; guint key_sym; int len; @@ -1172,8 +1171,8 @@ key_press_event(GtkWidget *widget UNUSED { len = keyval_to_string(key_sym, state, string2); - /* Careful: convert_input() doesn't handle the NUL character. - * No need to convert pure ASCII anyway, thus the len > 1 check. */ + // Careful: convert_input() doesn't handle the NUL character. + // No need to convert pure ASCII anyway, thus the len > 1 check. if (len > 1 && input_conv.vc_type != CONV_NONE) len = convert_input(string2, len, sizeof(string2)); @@ -1184,7 +1183,7 @@ key_press_event(GtkWidget *widget UNUSED *d++ = s[i]; if (d[-1] == CSI && d + 2 < string + sizeof(string)) { - /* Turn CSI into K_CSI. */ + // Turn CSI into K_CSI. *d++ = KS_EXTRA; *d++ = (int)KE_CSI; } @@ -1192,7 +1191,7 @@ key_press_event(GtkWidget *widget UNUSED len = d - string; } - /* Shift-Tab results in Left_Tab, but we want */ + // Shift-Tab results in Left_Tab, but we want if (key_sym == GDK_ISO_Left_Tab) { key_sym = GDK_Tab; @@ -1200,24 +1199,24 @@ key_press_event(GtkWidget *widget UNUSED } #ifdef FEAT_MENU - /* If there is a menu and 'wak' is "yes", or 'wak' is "menu" and the key - * is a menu shortcut, we ignore everything with the ALT modifier. */ + // If there is a menu and 'wak' is "yes", or 'wak' is "menu" and the key + // is a menu shortcut, we ignore everything with the ALT modifier. if ((state & GDK_MOD1_MASK) && gui.menu_is_active && (*p_wak == 'y' || (*p_wak == 'm' && len == 1 && gui_is_menu_shortcut(string[0])))) - /* For GTK2 we return false to signify that we haven't handled the - * keypress, so that gtk will handle the mnemonic or accelerator. */ + // For GTK2 we return false to signify that we haven't handled the + // keypress, so that gtk will handle the mnemonic or accelerator. return FALSE; #endif - /* Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character - * that already has the 8th bit set. - * Don't do this for , that should become K_S_TAB with ALT. - * Don't do this for double-byte encodings, it turns the char into a lead - * byte. */ + // Check for Alt/Meta key (Mod1Mask), but not for a BS, DEL or character + // that already has the 8th bit set. + // Don't do this for , that should become K_S_TAB with ALT. + // Don't do this for double-byte encodings, it turns the char into a lead + // byte. if (len == 1 && ((state & GDK_MOD1_MASK) #if GTK_CHECK_VERSION(2,10,0) @@ -1231,8 +1230,8 @@ key_press_event(GtkWidget *widget UNUSED ) { string[0] |= 0x80; - state &= ~GDK_MOD1_MASK; /* don't use it again */ - if (enc_utf8) /* convert to utf-8 */ + state &= ~GDK_MOD1_MASK; // don't use it again + if (enc_utf8) // convert to utf-8 { string[1] = string[0] & 0xbf; string[0] = ((unsigned)string[0] >> 6) + 0xc0; @@ -1247,8 +1246,8 @@ key_press_event(GtkWidget *widget UNUSED } } - /* Check for special keys. Also do this when len == 1 (key has an ASCII - * value) to detect backspace, delete and keypad keys. */ + // Check for special keys. Also do this when len == 1 (key has an ASCII + // value) to detect backspace, delete and keypad keys. if (len == 0 || len == 1) { for (i = 0; special_keys[i].key_sym != 0; i++) @@ -1264,11 +1263,11 @@ key_press_event(GtkWidget *widget UNUSED } } - if (len == 0) /* Unrecognized key */ + if (len == 0) // Unrecognized key return TRUE; - /* Special keys (and a few others) may have modifiers. Also when using a - * double-byte encoding (can't set the 8th bit). */ + // Special keys (and a few others) may have modifiers. Also when using a + // double-byte encoding (can't set the 8th bit). if (len == -3 || key_sym == GDK_space || key_sym == GDK_Tab || key_sym == GDK_Return || key_sym == GDK_Linefeed || key_sym == GDK_Escape || key_sym == GDK_KP_Tab @@ -1324,7 +1323,7 @@ key_press_event(GtkWidget *widget UNUSED add_to_input_buf(string, len); - /* blank out the pointer if necessary */ + // blank out the pointer if necessary if (p_mh) gui_mch_mousehide(TRUE); @@ -1356,12 +1355,11 @@ key_release_event(GtkWidget *widget UNUS #endif -/**************************************************************************** - * Selection handlers: - */ - -/* Remember when clip_lose_selection was called from here, we must not call - * gtk_selection_owner_set() then. */ +///////////////////////////////////////////////////////////////////////////// +// Selection handlers: + +// Remember when clip_lose_selection was called from here, we must not call +// gtk_selection_owner_set() then. static int in_selection_clear_event = FALSE; static gint @@ -1379,9 +1377,9 @@ selection_clear_event(GtkWidget *widget return TRUE; } -#define RS_NONE 0 /* selection_received_cb() not called yet */ -#define RS_OK 1 /* selection_received_cb() called and OK */ -#define RS_FAIL 2 /* selection_received_cb() called and failed */ +#define RS_NONE 0 // selection_received_cb() not called yet +#define RS_OK 1 // selection_received_cb() called and OK +#define RS_FAIL 2 // selection_received_cb() called and failed static int received_selection = RS_NONE; static void @@ -1408,7 +1406,7 @@ selection_received_cb(GtkWidget *widget if (text == NULL || len <= 0) { received_selection = RS_FAIL; - /* clip_free_selection(cbd); ??? */ + // clip_free_selection(cbd); ??? return; } @@ -1430,8 +1428,8 @@ selection_received_cb(GtkWidget *widget text += STRLEN(text) + 1; len -= text - enc; - /* If the encoding of the text is different from 'encoding', attempt - * converting it. */ + // If the encoding of the text is different from 'encoding', attempt + // converting it. conv.vc_type = CONV_NONE; convert_setup(&conv, enc, p_enc); if (conv.vc_type != CONV_NONE) @@ -1443,8 +1441,8 @@ selection_received_cb(GtkWidget *widget } } - /* gtk_selection_data_get_text() handles all the nasty details - * and targets and encodings etc. This rocks so hard. */ + // gtk_selection_data_get_text() handles all the nasty details + // and targets and encodings etc. This rocks so hard. else { tmpbuf_utf8 = gtk_selection_data_get_text(data); @@ -1464,7 +1462,7 @@ selection_received_cb(GtkWidget *widget { vimconv_T conv; - /* UTF-16, we get this for HTML */ + // UTF-16, we get this for HTML conv.vc_type = CONV_NONE; convert_setup_ext(&conv, (char_u *)"utf-16le", FALSE, p_enc, TRUE); @@ -1480,7 +1478,7 @@ selection_received_cb(GtkWidget *widget } } - /* Chop off any trailing NUL bytes. OpenOffice sends these. */ + // Chop off any trailing NUL bytes. OpenOffice sends these. while (len > 0 && text[len - 1] == NUL) --len; @@ -1516,7 +1514,7 @@ selection_get_cb(GtkWidget *widget U cbd = &clip_star; if (!cbd->owned) - return; /* Shouldn't ever happen */ + return; // Shouldn't ever happen if (info != (guint)TARGET_STRING && (!clip_html || info != (guint)TARGET_HTML) @@ -1527,15 +1525,15 @@ selection_get_cb(GtkWidget *widget U && info != (guint)TARGET_TEXT) return; - /* get the selection from the '*'/'+' register */ + // get the selection from the '*'/'+' register clip_get_selection(cbd); motion_type = clip_convert_selection(&string, &tmplen, cbd); if (motion_type < 0 || string == NULL) return; - /* Due to int arguments we can't handle more than G_MAXINT. Also - * reserve one extra byte for NUL or the motion type; just in case. - * (Not that pasting 2G of text is ever going to work, but... ;-) */ + // Due to int arguments we can't handle more than G_MAXINT. Also + // reserve one extra byte for NUL or the motion type; just in case. + // (Not that pasting 2G of text is ever going to work, but... ;-) length = MIN(tmplen, (long_u)(G_MAXINT - 1)); if (info == (guint)TARGET_VIM) @@ -1546,7 +1544,7 @@ selection_get_cb(GtkWidget *widget U tmpbuf[0] = motion_type; mch_memmove(tmpbuf + 1, string, (size_t)length); } - /* For our own format, the first byte contains the motion type */ + // For our own format, the first byte contains the motion type ++length; vim_free(string); string = tmpbuf; @@ -1557,7 +1555,7 @@ selection_get_cb(GtkWidget *widget U { vimconv_T conv; - /* Since we get utf-16, we probably should set it as well. */ + // Since we get utf-16, we probably should set it as well. conv.vc_type = CONV_NONE; convert_setup_ext(&conv, p_enc, TRUE, (char_u *)"utf-16le", FALSE); if (conv.vc_type != CONV_NONE) @@ -1568,7 +1566,7 @@ selection_get_cb(GtkWidget *widget U string = tmpbuf; } - /* Prepend the BOM: "fffe" */ + // Prepend the BOM: "fffe" if (string != NULL) { tmpbuf = alloc(length + 2); @@ -1583,10 +1581,10 @@ selection_get_cb(GtkWidget *widget U } #if !GTK_CHECK_VERSION(3,0,0) - /* Looks redundant even for GTK2 because these values are - * overwritten by gtk_selection_data_set() that follows. */ + // Looks redundant even for GTK2 because these values are + // overwritten by gtk_selection_data_set() that follows. selection_data->type = selection_data->target; - selection_data->format = 16; /* 16 bits per char */ + selection_data->format = 16; // 16 bits per char #endif gtk_selection_data_set(selection_data, html_atom, 16, string, length); @@ -1598,7 +1596,7 @@ selection_get_cb(GtkWidget *widget U { int l = STRLEN(p_enc); - /* contents: motion_type 'encoding' NUL text */ + // contents: motion_type 'encoding' NUL text tmpbuf = alloc(length + l + 2); if (tmpbuf != NULL) { @@ -1612,8 +1610,8 @@ selection_get_cb(GtkWidget *widget U type = vimenc_atom; } - /* gtk_selection_data_set_text() handles everything for us. This is - * so easy and simple and cool, it'd be insane not to use it. */ + // gtk_selection_data_set_text() handles everything for us. This is + // so easy and simple and cool, it'd be insane not to use it. else { if (output_conv.vc_type != CONV_NONE) @@ -1624,7 +1622,7 @@ selection_get_cb(GtkWidget *widget U return; string = tmpbuf; } - /* Validate the string to avoid runtime warnings */ + // Validate the string to avoid runtime warnings if (g_utf8_validate((const char *)string, (gssize)length, NULL)) { gtk_selection_data_set_text(selection_data, @@ -1637,10 +1635,10 @@ selection_get_cb(GtkWidget *widget U if (string != NULL) { #if !GTK_CHECK_VERSION(3,0,0) - /* Looks redundant even for GTK2 because these values are - * overwritten by gtk_selection_data_set() that follows. */ + // Looks redundant even for GTK2 because these values are + // overwritten by gtk_selection_data_set() that follows. selection_data->type = selection_data->target; - selection_data->format = 8; /* 8 bits per char */ + selection_data->format = 8; // 8 bits per char #endif gtk_selection_data_set(selection_data, type, 8, string, length); vim_free(string); @@ -1657,7 +1655,7 @@ gui_mch_early_init_check(int give_messag { char_u *p; - /* Guess that when $DISPLAY isn't set the GUI can't start. */ + // Guess that when $DISPLAY isn't set the GUI can't start. p = mch_getenv((char_u *)"DISPLAY"); if (p == NULL || *p == NUL) { @@ -1682,16 +1680,16 @@ gui_mch_init_check(void) if (!res_registered) { - /* Call this function in the GUI process; otherwise, the resources - * won't be available. Don't call it twice. */ + // Call this function in the GUI process; otherwise, the resources + // won't be available. Don't call it twice. res_registered = TRUE; gui_gtk_register_resource(); } #endif #if GTK_CHECK_VERSION(3,10,0) - /* Vim currently assumes that Gtk means X11, so it cannot use native Gtk - * support for other backends such as Wayland. */ + // Vim currently assumes that Gtk means X11, so it cannot use native Gtk + // support for other backends such as Wayland. gdk_set_allowed_backends ("x11"); #endif @@ -1700,12 +1698,12 @@ gui_mch_init_check(void) using_gnome = 1; #endif - /* This defaults to argv[0], but we want it to match the name of the - * shipped gvim.desktop so that Vim's windows can be associated with this - * file. */ + // This defaults to argv[0], but we want it to match the name of the + // shipped gvim.desktop so that Vim's windows can be associated with this + // file. g_set_prgname("gvim"); - /* Don't use gtk_init() or gnome_init(), it exits on failure. */ + // Don't use gtk_init() or gnome_init(), it exits on failure. if (!gtk_init_check(&gui_argc, &gui_argv)) { gui.dying = TRUE; @@ -1716,9 +1714,8 @@ gui_mch_init_check(void) return OK; } -/**************************************************************************** - * Mouse handling callbacks - */ +///////////////////////////////////////////////////////////////////////////// +// Mouse handling callbacks static guint mouse_click_timer = 0; @@ -1730,11 +1727,11 @@ static int mouse_timed_out = TRUE; static timeout_cb_type mouse_click_timer_cb(gpointer data) { - /* we don't use this information currently */ + // we don't use this information currently int *timed_out = (int *) data; *timed_out = TRUE; - return FALSE; /* don't happen again */ + return FALSE; // don't happen again } static guint motion_repeat_timer = 0; @@ -1753,21 +1750,21 @@ process_motion_notify(int x, int y, GdkM GDK_BUTTON5_MASK)) ? MOUSE_DRAG : ' '; - /* If our pointer is currently hidden, then we should show it. */ + // If our pointer is currently hidden, then we should show it. gui_mch_mousehide(FALSE); - /* Just moving the rodent above the drawing area without any button - * being pressed. */ + // Just moving the rodent above the drawing area without any button + // being pressed. if (button != MOUSE_DRAG) { gui_mouse_moved(x, y); return; } - /* translate modifier coding between the main engine and GTK */ + // translate modifier coding between the main engine and GTK vim_modifiers = modifiers_gdk2mouse(state); - /* inform the editor engine about the occurrence of this event */ + // inform the editor engine about the occurrence of this event gui_send_mouse_event(button, x, y, FALSE, vim_modifiers); /* @@ -1785,26 +1782,24 @@ process_motion_notify(int x, int y, GdkM int offshoot; int delay = 10; - /* Calculate the maximal distance of the cursor from the drawing area. - * (offshoot can't become negative here!). - */ + // Calculate the maximal distance of the cursor from the drawing area. + // (offshoot can't become negative here!). dx = x < 0 ? -x : x - allocation.width; dy = y < 0 ? -y : y - allocation.height; offshoot = dx > dy ? dx : dy; - /* Make a linearly decaying timer delay with a threshold of 5 at a - * distance of 127 pixels from the main window. - * - * One could think endlessly about the most ergonomic variant here. - * For example it could make sense to calculate the distance from the - * drags start instead... - * - * Maybe a parabolic interpolation would suite us better here too... - */ + // Make a linearly decaying timer delay with a threshold of 5 at a + // distance of 127 pixels from the main window. + // + // One could think endlessly about the most ergonomic variant here. + // For example it could make sense to calculate the distance from the + // drags start instead... + // + // Maybe a parabolic interpolation would suite us better here too... if (offshoot > 127) { - /* 5 appears to be somehow near to my perceptual limits :-). */ + // 5 appears to be somehow near to my perceptual limits :-). delay = 5; } else @@ -1812,7 +1807,7 @@ process_motion_notify(int x, int y, GdkM delay = (130 * (127 - offshoot)) / 127 + 5; } - /* shoot again */ + // shoot again if (!motion_repeat_timer) motion_repeat_timer = timeout_add(delay, motion_repeat_timer_cb, NULL); @@ -1855,7 +1850,7 @@ gui_gtk_window_at_position(GtkWidget *wi return gdk_device_get_window_at_position(dev, x, y); } # endif -#else /* !GTK_CHECK_VERSION(3,0,0) */ +#else // !GTK_CHECK_VERSION(3,0,0) # define gui_gtk_get_pointer(wid, x, y, s) \ gdk_window_get_pointer((wid)->window, x, y, s) # define gui_gtk_window_at_position(wid, x, y) gdk_window_at_pointer(x, y) @@ -1881,8 +1876,8 @@ motion_repeat_timer_cb(gpointer data UNU return FALSE; } - /* If there already is a mouse click in the input buffer, wait another - * time (otherwise we would create a backlog of clicks) */ + // If there already is a mouse click in the input buffer, wait another + // time (otherwise we would create a backlog of clicks) if (vim_used_in_input_buf() > 10) return TRUE; @@ -1900,8 +1895,8 @@ motion_repeat_timer_cb(gpointer data UNU motion_repeat_offset = !motion_repeat_offset; process_motion_notify(x, y, state); - /* Don't happen again. We will get reinstalled in the synthetic event - * if needed -- thus repeating should still work. */ + // Don't happen again. We will get reinstalled in the synthetic event + // if needed -- thus repeating should still work. return FALSE; } @@ -1925,7 +1920,7 @@ motion_notify_event(GtkWidget *widget, (GdkModifierType)event->state); } - return TRUE; /* handled */ + return TRUE; // handled } @@ -1946,7 +1941,7 @@ button_press_event(GtkWidget *widget, gui.event_time = event->time; - /* Make sure we have focus now we've been selected */ + // Make sure we have focus now we've been selected if (gtk_socket_id != 0 && !gtk_widget_has_focus(widget)) gtk_widget_grab_focus(widget); @@ -1960,7 +1955,7 @@ button_press_event(GtkWidget *widget, x = event->x; y = event->y; - /* Handle multiple clicks */ + // Handle multiple clicks if (!mouse_timed_out && mouse_click_timer) { timeout_remove(mouse_click_timer); @@ -1974,19 +1969,19 @@ button_press_event(GtkWidget *widget, switch (event->button) { - /* Keep in sync with gui_x11.c. - * Buttons 4-7 are handled in scroll_event() */ + // Keep in sync with gui_x11.c. + // Buttons 4-7 are handled in scroll_event() case 1: button = MOUSE_LEFT; break; case 2: button = MOUSE_MIDDLE; break; case 3: button = MOUSE_RIGHT; break; case 8: button = MOUSE_X1; break; case 9: button = MOUSE_X2; break; default: - return FALSE; /* Unknown button */ + return FALSE; // Unknown button } #ifdef FEAT_XIM - /* cancel any preediting */ + // cancel any preediting if (im_is_preediting()) xim_reset(); #endif @@ -2026,12 +2021,12 @@ scroll_event(GtkWidget *widget, case GDK_SCROLL_RIGHT: button = MOUSE_6; break; - default: /* This shouldn't happen */ + default: // This shouldn't happen return FALSE; } # ifdef FEAT_XIM - /* cancel any preediting */ + // cancel any preediting if (im_is_preediting()) xim_reset(); # endif @@ -2055,9 +2050,9 @@ button_release_event(GtkWidget *widget U gui.event_time = event->time; - /* Remove any motion "machine gun" timers used for automatic further - extension of allocation areas if outside of the applications window - area .*/ + // Remove any motion "machine gun" timers used for automatic further + // extension of allocation areas if outside of the applications window + // area . if (motion_repeat_timer) { timeout_remove(motion_repeat_timer); @@ -2076,9 +2071,8 @@ button_release_event(GtkWidget *widget U #ifdef FEAT_DND -/**************************************************************************** - * Drag aNd Drop support handlers. - */ +///////////////////////////////////////////////////////////////////////////// +// Drag aNd Drop support handlers. /* * Count how many items there may be and separate them with a NUL. @@ -2113,7 +2107,7 @@ count_and_decode_uri_list(char_u *out, c } if (p > out && p[-1] != NUL) { - *p = NUL; /* last item didn't have \r or \n */ + *p = NUL; // last item didn't have \r or \n ++count; } return count; @@ -2183,7 +2177,7 @@ drag_handle_uri_list(GdkDragContext *con { int_u modifiers; - gtk_drag_finish(context, TRUE, FALSE, time_); /* accept */ + gtk_drag_finish(context, TRUE, FALSE, time_); // accept modifiers = modifiers_gdk2mouse(state); @@ -2216,7 +2210,7 @@ drag_handle_text(GdkDragContext *con } dnd_yank_drag_data(text, (long)len); - gtk_drag_finish(context, TRUE, FALSE, time_); /* accept */ + gtk_drag_finish(context, TRUE, FALSE, time_); // accept vim_free(tmpbuf); dropkey[2] = modifiers_gdk2vim(state); @@ -2242,7 +2236,7 @@ drag_data_received_cb(GtkWidget *widget { GdkModifierType state; - /* Guard against trash */ + // Guard against trash const guchar * const data_data = gtk_selection_data_get_data(data); const gint data_length = gtk_selection_data_get_length(data); const gint data_format = gtk_selection_data_get_format(data); @@ -2256,18 +2250,18 @@ drag_data_received_cb(GtkWidget *widget return; } - /* Get the current modifier state for proper distinguishment between - * different operations later. */ + // Get the current modifier state for proper distinguishment between + // different operations later. gui_gtk_get_pointer(widget, NULL, NULL, &state); - /* Not sure about the role of "text/plain" here... */ + // Not sure about the role of "text/plain" here... if (info == (guint)TARGET_TEXT_URI_LIST) drag_handle_uri_list(context, data, time_, state, x, y); else drag_handle_text(context, data, time_, state); } -#endif /* FEAT_DND */ +#endif // FEAT_DND #if defined(USE_GNOME_SESSION) @@ -2301,7 +2295,7 @@ sm_client_check_changed_any(GnomeClient exiting = FALSE; cmdmod = save_cmdmod; - setcursor(); /* position the cursor */ + setcursor(); // position the cursor out_flush(); /* * If the user hit the [Cancel] button the whole shutdown @@ -2329,26 +2323,26 @@ sm_client_save_yourself(GnomeClient unsigned int len; gboolean success; - /* Always request an interaction if possible. check_changed_any() - * won't actually show a dialog unless any buffers have been modified. - * There doesn't seem to be an obvious way to check that without - * automatically firing the dialog. Anyway, it works just fine. */ + // Always request an interaction if possible. check_changed_any() + // won't actually show a dialog unless any buffers have been modified. + // There doesn't seem to be an obvious way to check that without + // automatically firing the dialog. Anyway, it works just fine. if (interact_style == GNOME_INTERACT_ANY) gnome_client_request_interaction(client, GNOME_DIALOG_NORMAL, &sm_client_check_changed_any, NULL); out_flush(); - ml_sync_all(FALSE, FALSE); /* preserve all swap files */ - - /* The path is unique for each session save. We do neither know nor care - * which session script will actually be used later. This decision is in - * the domain of the session manager. */ + ml_sync_all(FALSE, FALSE); // preserve all swap files + + // The path is unique for each session save. We do neither know nor care + // which session script will actually be used later. This decision is in + // the domain of the session manager. session_file = gnome_config_get_real_path( gnome_client_get_config_prefix(client)); len = strlen(session_file); if (len > 0 && session_file[len-1] == G_DIR_SEPARATOR) - --len; /* get rid of the superfluous trailing '/' */ + --len; // get rid of the superfluous trailing '/' session_file = g_renew(char, session_file, len + sizeof(suffix)); memcpy(session_file + len, suffix, sizeof(suffix)); @@ -2360,10 +2354,10 @@ sm_client_save_yourself(GnomeClient const char *argv[8]; int i; - /* Tell the session manager how to wipe out the stored session data. - * This isn't as dangerous as it looks, don't worry :) session_file - * is a unique absolute filename. Usually it'll be something like - * `/home/user/.gnome2/vim-XXXXXX-session.vim'. */ + // Tell the session manager how to wipe out the stored session data. + // This isn't as dangerous as it looks, don't worry :) session_file + // is a unique absolute filename. Usually it'll be something like + // `/home/user/.gnome2/vim-XXXXXX-session.vim'. i = 0; argv[i++] = "rm"; argv[i++] = session_file; @@ -2371,11 +2365,11 @@ sm_client_save_yourself(GnomeClient gnome_client_set_discard_command(client, i, (char **)argv); - /* Tell the session manager how to restore the just saved session. - * This is easily done thanks to Vim's -S option. Pass the -f flag - * since there's no need to fork -- it might even cause confusion. - * Also pass the window role to give the WM something to match on. - * The role is set in gui_mch_open(), thus should _never_ be NULL. */ + // Tell the session manager how to restore the just saved session. + // This is easily done thanks to Vim's -S option. Pass the -f flag + // since there's no need to fork -- it might even cause confusion. + // Also pass the window role to give the WM something to match on. + // The role is set in gui_mch_open(), thus should _never_ be NULL. i = 0; argv[i++] = restart_command; argv[i++] = "-f"; @@ -2403,7 +2397,7 @@ sm_client_save_yourself(GnomeClient static void sm_client_die(GnomeClient *client UNUSED, gpointer data UNUSED) { - /* Don't write messages to the GUI anymore */ + // Don't write messages to the GUI anymore full_screen = FALSE; vim_strncpy(IObuff, (char_u *) @@ -2424,8 +2418,8 @@ setup_save_yourself(void) if (client != NULL) { - /* Must use the deprecated gtk_signal_connect() for compatibility - * with GNOME 1. Arrgh, zombies! */ + // Must use the deprecated gtk_signal_connect() for compatibility + // with GNOME 1. Arrgh, zombies! gtk_signal_connect(GTK_OBJECT(client), "save_yourself", GTK_SIGNAL_FUNC(&sm_client_save_yourself), NULL); gtk_signal_connect(GTK_OBJECT(client), "die", @@ -2447,17 +2441,17 @@ local_xsmp_handle_requests( { if (condition == G_IO_IN) { - /* Do stuff; maybe close connection */ + // Do stuff; maybe close connection if (xsmp_handle_requests() == FAIL) g_io_channel_unref((GIOChannel *)data); return TRUE; } - /* Error */ + // Error g_io_channel_unref((GIOChannel *)data); xsmp_close(); return TRUE; } -# endif /* USE_XSMP */ +# endif // USE_XSMP /* * Setup the WM_PROTOCOLS to indicate we want the WM_SAVE_YOURSELF event. @@ -2485,9 +2479,9 @@ setup_save_yourself(void) else # endif { - /* Fall back to old method */ - - /* first get the existing value */ + // Fall back to old method + + // first get the existing value GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin); if (XGetWMProtocols(GDK_WINDOW_XDISPLAY(mainwin_win), @@ -2500,14 +2494,14 @@ setup_save_yourself(void) save_yourself_xatom = GET_X_ATOM(save_yourself_atom); - /* check if WM_SAVE_YOURSELF isn't there yet */ + // check if WM_SAVE_YOURSELF isn't there yet for (i = 0; i < count; ++i) if (existing_atoms[i] == save_yourself_xatom) break; if (i == count) { - /* allocate an Atoms array which is one item longer */ + // allocate an Atoms array which is one item longer new_atoms = ALLOC_MULT(Atom, count + 1); if (new_atoms != NULL) { @@ -2553,7 +2547,7 @@ global_event_filter(GdkXEvent *xev, == GET_X_ATOM(save_yourself_atom)) { out_flush(); - ml_sync_all(FALSE, FALSE); /* preserve all swap files */ + ml_sync_all(FALSE, FALSE); // preserve all swap files /* * Set the window's WM_COMMAND property, to let the window manager * know we are done saving ourselves. We don't want to be @@ -2576,12 +2570,12 @@ global_event_filter(GdkXEvent *xev, static void mainwin_realize(GtkWidget *widget UNUSED, gpointer data UNUSED) { -/* If you get an error message here, you still need to unpack the runtime - * archive! */ +// If you get an error message here, you still need to unpack the runtime +// archive! #ifdef magick # undef magick #endif - /* A bit hackish, but avoids casting later and allows optimization */ + // A bit hackish, but avoids casting later and allows optimization # define static static const #define magick vim32x32 #include "../runtime/vim32x32.xpm" @@ -2596,7 +2590,7 @@ mainwin_realize(GtkWidget *widget UNUSED GdkWindow * const mainwin_win = gtk_widget_get_window(gui.mainwin); - /* When started with "--echo-wid" argument, write window ID on stdout. */ + // When started with "--echo-wid" argument, write window ID on stdout. if (echo_wid_arg) { printf("WID: %ld\n", (long)GDK_WINDOW_XID(mainwin_win)); @@ -2621,12 +2615,12 @@ mainwin_realize(GtkWidget *widget UNUSED } #if !defined(USE_GNOME_SESSION) - /* Register a handler for WM_SAVE_YOURSELF with GDK's low-level X I/F */ + // Register a handler for WM_SAVE_YOURSELF with GDK's low-level X I/F gdk_window_add_filter(NULL, &global_event_filter, NULL); #endif - /* Setup to indicate to the window manager that we want to catch the - * WM_SAVE_YOURSELF event. For GNOME, this connects to the session - * manager instead. */ + // Setup to indicate to the window manager that we want to catch the + // WM_SAVE_YOURSELF event. For GNOME, this connects to the session + // manager instead. #if defined(USE_GNOME_SESSION) if (using_gnome) #endif @@ -2635,7 +2629,7 @@ mainwin_realize(GtkWidget *widget UNUSED #ifdef FEAT_CLIENTSERVER if (serverName == NULL && serverDelayedStartName != NULL) { - /* This is a :gui command in a plain vim with no previous server */ + // This is a :gui command in a plain vim with no previous server commWindow = GDK_WINDOW_XID(mainwin_win); (void)serverRegisterName(GDK_WINDOW_XDISPLAY(mainwin_win), @@ -2684,8 +2678,8 @@ create_blank_pointer(void) root_window = gtk_widget_get_root_window(gui.mainwin); #endif - /* Create a pseudo blank pointer, which is in fact one pixel by one pixel - * in size. */ + // Create a pseudo blank pointer, which is in fact one pixel by one pixel + // in size. #if GTK_CHECK_VERSION(3,0,0) { cairo_surface_t *surf; @@ -2792,7 +2786,7 @@ drawarea_realize_cb(GtkWidget *widget, g if (gui.pointer_hidden) gdk_window_set_cursor(gtk_widget_get_window(widget), gui.blank_pointer); - /* get the actual size of the scrollbars, if they are realized */ + // get the actual size of the scrollbars, if they are realized sbar = firstwin->w_scrollbars[SBAR_LEFT].id; if (!sbar || (!gui.which_scrollbars[SBAR_LEFT] && firstwin->w_scrollbars[SBAR_RIGHT].id)) @@ -2812,7 +2806,7 @@ drawarea_realize_cb(GtkWidget *widget, g static void drawarea_unrealize_cb(GtkWidget *widget UNUSED, gpointer data UNUSED) { - /* Don't write messages to the GUI anymore */ + // Don't write messages to the GUI anymore full_screen = FALSE; #ifdef FEAT_XIM @@ -2877,30 +2871,30 @@ drawarea_configure_event_cb(GtkWidget && event->width >= 1 && event->height >= 1, TRUE); # if GTK_CHECK_VERSION(3,22,2) && !GTK_CHECK_VERSION(3,22,4) - /* As of 3.22.2, GdkWindows have started distributing configure events to - * their "native" children (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=12579fe71b3b8f79eb9c1b80e429443bcc437dd0). - * - * As can be seen from the implementation of move_native_children() and - * configure_native_child() in gdkwindow.c, those functions actually - * propagate configure events to every child, failing to distinguish - * "native" one from non-native one. - * - * Naturally, configure events propagated to here like that are fallacious - * and, as a matter of fact, they trigger a geometric collapse of - * gui.drawarea in fullscreen and maximized modes. - * - * To filter out such nuisance events, we are making use of the fact that - * the field send_event of such GdkEventConfigures is set to FALSE in - * configure_native_child(). - * - * Obviously, this is a terrible hack making GVim depend on GTK's - * implementation details. Therefore, watch out any relevant internal - * changes happening in GTK in the feature (sigh). - */ - /* Follow-up - * After a few weeks later, the GdkWindow change mentioned above was - * reverted (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=f70039cb9603a02d2369fec4038abf40a1711155). - * The corresponding official release is 3.22.4. */ + // As of 3.22.2, GdkWindows have started distributing configure events to + // their "native" children (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=12579fe71b3b8f79eb9c1b80e429443bcc437dd0). + // + // As can be seen from the implementation of move_native_children() and + // configure_native_child() in gdkwindow.c, those functions actually + // propagate configure events to every child, failing to distinguish + // "native" one from non-native one. + // + // Naturally, configure events propagated to here like that are fallacious + // and, as a matter of fact, they trigger a geometric collapse of + // gui.drawarea in fullscreen and maximized modes. + // + // To filter out such nuisance events, we are making use of the fact that + // the field send_event of such GdkEventConfigures is set to FALSE in + // configure_native_child(). + // + // Obviously, this is a terrible hack making GVim depend on GTK's + // implementation details. Therefore, watch out any relevant internal + // changes happening in GTK in the feature (sigh). + // + // Follow-up + // After a few weeks later, the GdkWindow change mentioned above was + // reverted (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=f70039cb9603a02d2369fec4038abf40a1711155). + // The corresponding official release is 3.22.4. if (event->send_event == FALSE) return TRUE; # endif @@ -2953,8 +2947,8 @@ get_item_dimensions(GtkWidget *widget, G parent = gtk_widget_get_parent(widget); if (G_TYPE_FROM_INSTANCE(parent) == BONOBO_TYPE_DOCK_ITEM) { - /* Only menu & toolbar are dock items. Could tabline be? - * Seem to be only the 2 defined in GNOME */ + // Only menu & toolbar are dock items. Could tabline be? + // Seem to be only the 2 defined in GNOME widget = parent; dockitem = BONOBO_DOCK_ITEM(widget); @@ -2993,7 +2987,7 @@ get_menu_tool_width(void) { int width = 0; -#ifdef FEAT_GUI_GNOME /* these are never vertical without GNOME */ +#ifdef FEAT_GUI_GNOME // these are never vertical without GNOME # ifdef FEAT_MENU width += get_item_dimensions(gui.menubar, GTK_ORIENTATION_VERTICAL); # endif @@ -3028,12 +3022,11 @@ get_menu_tool_height(void) return height; } -/* This controls whether we can set the real window hints at - * start-up when in a GtkPlug. - * 0 = normal processing (default) - * 1 = init. hints set, no-one's tried to reset since last check - * 2 = init. hints set, attempt made to change hints - */ +// This controls whether we can set the real window hints at +// start-up when in a GtkPlug. +// 0 = normal processing (default) +// 1 = init. hints set, no-one's tried to reset since last check +// 2 = init. hints set, attempt made to change hints static int init_window_hints_state = 0; static void @@ -3051,19 +3044,18 @@ update_window_manager_hints(int force_wi int min_width; int min_height; - /* At start-up, don't try to set the hints until the initial - * values have been used (those that dictate our initial size) - * Let forced (i.e., correct) values through always. - */ + // At start-up, don't try to set the hints until the initial + // values have been used (those that dictate our initial size) + // Let forced (i.e., correct) values through always. if (!(force_width && force_height) && init_window_hints_state > 0) { - /* Don't do it! */ + // Don't do it! init_window_hints_state = 2; return; } - /* This also needs to be done when the main window isn't there yet, - * otherwise the hints don't work. */ + // This also needs to be done when the main window isn't there yet, + // otherwise the hints don't work. width = gui_get_base_width(); height = gui_get_base_height(); # ifdef FEAT_MENU @@ -3072,12 +3064,11 @@ update_window_manager_hints(int force_wi width += get_menu_tool_width(); height += get_menu_tool_height(); - /* GtkSockets use GtkPlug's [gui,mainwin] min-size hints to determine - * their actual widget size. When we set our size ourselves (e.g., - * 'set columns=' or init. -geom) we briefly set the min. to the size - * we wish to be instead of the legitimate minimum so that we actually - * resize correctly. - */ + // GtkSockets use GtkPlug's [gui,mainwin] min-size hints to determine + // their actual widget size. When we set our size ourselves (e.g., + // 'set columns=' or init. -geom) we briefly set the min. to the size + // we wish to be instead of the legitimate minimum so that we actually + // resize correctly. if (force_width && force_height) { min_width = force_width; @@ -3089,7 +3080,7 @@ update_window_manager_hints(int force_wi min_height = height + MIN_LINES * gui.char_height; } - /* Avoid an expose event when the size didn't change. */ + // Avoid an expose event when the size didn't change. if (width != old_width || height != old_height || min_width != old_min_width @@ -3108,9 +3099,9 @@ update_window_manager_hints(int force_wi geometry.min_height = min_height; geometry_mask = GDK_HINT_BASE_SIZE|GDK_HINT_RESIZE_INC |GDK_HINT_MIN_SIZE; - /* Using gui.formwin as geometry widget doesn't work as expected - * with GTK+ 2 -- dunno why. Presumably all the resizing hacks - * in Vim confuse GTK+. */ + // Using gui.formwin as geometry widget doesn't work as expected + // with GTK+ 2 -- dunno why. Presumably all the resizing hacks + // in Vim confuse GTK+. gtk_window_set_geometry_hints(GTK_WINDOW(gui.mainwin), gui.mainwin, &geometry, geometry_mask); old_width = width; @@ -3133,7 +3124,7 @@ gui_mch_set_dark_theme(int dark) g_object_set(gtk_settings, "gtk-application-prefer-dark-theme", (gboolean)dark, NULL); # endif } -#endif /* FEAT_GUI_DARKTHEME */ +#endif // FEAT_GUI_DARKTHEME #ifdef FEAT_TOOLBAR @@ -3160,7 +3151,7 @@ icon_size_changed_foreach(GtkWidget *wid gtk_image_set_from_icon_name(image, icon_name, icon_size); } # else - /* User-defined icons are stored in a GtkIconSet */ + // User-defined icons are stored in a GtkIconSet if (gtk_image_get_storage_type(image) == GTK_IMAGE_ICON_SET) { GtkIconSet *icon_set; @@ -3220,7 +3211,7 @@ set_toolbar_style(GtkToolbar *toolbar) if (size == GTK_ICON_SIZE_INVALID) { - /* Let global user preferences decide the icon size. */ + // Let global user preferences decide the icon size. gtk_toolbar_unset_icon_size(toolbar); size = gtk_toolbar_get_icon_size(toolbar); } @@ -3233,7 +3224,7 @@ set_toolbar_style(GtkToolbar *toolbar) gtk_toolbar_set_icon_size(toolbar, size); } -#endif /* FEAT_TOOLBAR */ +#endif // FEAT_TOOLBAR #if defined(FEAT_GUI_TABLINE) || defined(PROTO) static int ignore_tabline_evt = FALSE; @@ -3241,7 +3232,7 @@ static GtkWidget *tabline_menu; # if !GTK_CHECK_VERSION(3,0,0) static GtkTooltips *tabline_tooltip; # endif -static int clicked_page; /* page clicked in tab line */ +static int clicked_page; // page clicked in tab line /* * Handle selecting an item in the tab line popup menu. @@ -3249,7 +3240,7 @@ static int clicked_page; /* page cli static void tabline_menu_handler(GtkMenuItem *item UNUSED, gpointer user_data) { - /* Add the string cmd into input buffer */ + // Add the string cmd into input buffer send_tabline_menu_event(clicked_page, (int)(long)user_data); } @@ -3289,7 +3280,7 @@ create_tabline_menu(void) static gboolean on_tabline_menu(GtkWidget *widget, GdkEvent *event) { - /* Was this button press event ? */ + // Was this button press event ? if (event->type == GDK_BUTTON_PRESS) { GdkEventButton *bevent = (GdkEventButton *)event; @@ -3298,8 +3289,8 @@ on_tabline_menu(GtkWidget *widget, GdkEv GtkWidget *tabwidget; GdkWindow *tabwin; - /* When ignoring events return TRUE so that the selected page doesn't - * change. */ + // When ignoring events return TRUE so that the selected page doesn't + // change. if (hold_gui_events # ifdef FEAT_CMDWIN || cmdwin_type != 0 @@ -3313,7 +3304,7 @@ on_tabline_menu(GtkWidget *widget, GdkEv clicked_page = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(tabwidget), "tab_num")); - /* If the event was generated for 3rd button popup the menu. */ + // If the event was generated for 3rd button popup the menu. if (bevent->button == 3) { # if GTK_CHECK_VERSION(3,22,2) @@ -3322,21 +3313,21 @@ on_tabline_menu(GtkWidget *widget, GdkEv gtk_menu_popup(GTK_MENU(widget), NULL, NULL, NULL, NULL, bevent->button, bevent->time); # endif - /* We handled the event. */ + // We handled the event. return TRUE; } else if (bevent->button == 1) { if (clicked_page == 0) { - /* Click after all tabs moves to next tab page. When "x" is - * small guess it's the left button. */ + // Click after all tabs moves to next tab page. When "x" is + // small guess it's the left button. send_tabline_event(x < 50 ? -1 : 0); } } } - /* We didn't handle the event. */ + // We didn't handle the event. return FALSE; } @@ -3386,7 +3377,7 @@ gui_mch_show_tabline(int showit) if (!showit != !gtk_notebook_get_show_tabs(GTK_NOTEBOOK(gui.tabline))) { - /* Note: this may cause a resize event */ + // Note: this may cause a resize event gtk_notebook_set_show_tabs(GTK_NOTEBOOK(gui.tabline), showit); update_window_manager_hints(0, 0); if (showit) @@ -3426,7 +3417,7 @@ gui_mch_update_tabline(void) ignore_tabline_evt = TRUE; - /* Add a label for each tab page. They all contain the same text area. */ + // Add a label for each tab page. They all contain the same text area. for (tp = first_tabpage; tp != NULL; tp = tp->tp_next, ++nr) { if (tp == curtab) @@ -3437,7 +3428,7 @@ gui_mch_update_tabline(void) page = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gui.tabline), nr); if (page == NULL) { - /* Add notebook page */ + // Add notebook page # if GTK_CHECK_VERSION(3,2,0) page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_set_homogeneous(GTK_BOX(page), FALSE); @@ -3484,14 +3475,14 @@ gui_mch_update_tabline(void) CONVERT_TO_UTF8_FREE(labeltext); } - /* Remove any old labels. */ + // Remove any old labels. while (gtk_notebook_get_nth_page(GTK_NOTEBOOK(gui.tabline), nr) != NULL) gtk_notebook_remove_page(GTK_NOTEBOOK(gui.tabline), nr); if (gtk_notebook_get_current_page(GTK_NOTEBOOK(gui.tabline)) != curtabidx) gtk_notebook_set_current_page(GTK_NOTEBOOK(gui.tabline), curtabidx); - /* Make sure everything is in place before drawing text. */ + // Make sure everything is in place before drawing text. gui_mch_update(); ignore_tabline_evt = FALSE; @@ -3512,7 +3503,7 @@ gui_mch_set_curtab(int nr) ignore_tabline_evt = FALSE; } -#endif /* FEAT_GUI_TABLINE */ +#endif // FEAT_GUI_TABLINE /* * Add selection targets for PRIMARY and CLIPBOARD selections. @@ -3526,9 +3517,9 @@ gui_gtk_set_selection_targets(void) for (i = 0; i < (int)N_SELECTION_TARGETS; ++i) { - /* OpenOffice tries to use TARGET_HTML and fails when we don't - * return something, instead of trying another target. Therefore only - * offer TARGET_HTML when it works. */ + // OpenOffice tries to use TARGET_HTML and fails when we don't + // return something, instead of trying another target. Therefore only + // offer TARGET_HTML when it works. if (!clip_html && selection_targets[i].info == TARGET_HTML) n_targets--; else @@ -3580,9 +3571,9 @@ gui_mch_init(void) GtkWidget *vbox; #ifdef FEAT_GUI_GNOME - /* Initialize the GNOME libraries. gnome_program_init()/gnome_init() - * exits on failure, but that's a non-issue because we already called - * gtk_init_check() in gui_mch_init_check(). */ + // Initialize the GNOME libraries. gnome_program_init()/gnome_init() + // exits on failure, but that's a non-issue because we already called + // gtk_init_check() in gui_mch_init_check(). if (using_gnome) { gnome_program_init(VIMPACKAGE, VIM_VERSION_SHORT, @@ -3591,8 +3582,8 @@ gui_mch_init(void) { char *p = setlocale(LC_NUMERIC, NULL); - /* Make sure strtod() uses a decimal point, not a comma. Gnome - * init may change it. */ + // Make sure strtod() uses a decimal point, not a comma. Gnome + // init may change it. if (p == NULL || strcmp(p, "C") != 0) setlocale(LC_NUMERIC, "C"); } @@ -3602,7 +3593,7 @@ gui_mch_init(void) VIM_CLEAR(gui_argv); #if GLIB_CHECK_VERSION(2,1,3) - /* Set the human-readable application name */ + // Set the human-readable application name g_set_application_name("Vim"); #endif /* @@ -3615,15 +3606,15 @@ gui_mch_init(void) #ifdef FEAT_TOOLBAR gui_gtk_register_stock_icons(); #endif - /* FIXME: Need to install the classic icons and a gtkrc.classic file. - * The hard part is deciding install locations and the Makefile magic. */ + // FIXME: Need to install the classic icons and a gtkrc.classic file. + // The hard part is deciding install locations and the Makefile magic. #if !GTK_CHECK_VERSION(3,0,0) # if 0 gtk_rc_parse("gtkrc"); # endif #endif - /* Initialize values */ + // Initialize values gui.border_width = 2; gui.scrollbar_width = SB_DEFAULT_WIDTH; gui.scrollbar_height = SB_DEFAULT_WIDTH; @@ -3632,19 +3623,19 @@ gui_mch_init(void) gui.bgcolor = g_new(GdkRGBA, 1); gui.spcolor = g_new(GdkRGBA, 1); #else - /* LINTED: avoid warning: conversion to 'unsigned long' */ + // LINTED: avoid warning: conversion to 'unsigned long' gui.fgcolor = g_new0(GdkColor, 1); - /* LINTED: avoid warning: conversion to 'unsigned long' */ + // LINTED: avoid warning: conversion to 'unsigned long' gui.bgcolor = g_new0(GdkColor, 1); - /* LINTED: avoid warning: conversion to 'unsigned long' */ + // LINTED: avoid warning: conversion to 'unsigned long' gui.spcolor = g_new0(GdkColor, 1); #endif - /* Initialise atoms */ + // Initialise atoms html_atom = gdk_atom_intern("text/html", FALSE); utf8_string_atom = gdk_atom_intern("UTF8_STRING", FALSE); - /* Set default foreground and background colors. */ + // Set default foreground and background colors. gui.norm_pixel = gui.def_norm_pixel; gui.back_pixel = gui.def_back_pixel; @@ -3652,7 +3643,7 @@ gui_mch_init(void) { GtkWidget *plug; - /* Use GtkSocket from another app. */ + // Use GtkSocket from another app. plug = gtk_plug_new_for_display(gdk_display_get_default(), gtk_socket_id); if (plug != NULL && gtk_plug_get_socket_window(GTK_PLUG(plug)) != NULL) @@ -3663,7 +3654,7 @@ gui_mch_init(void) { g_warning("Connection to GTK+ socket (ID %u) failed", (unsigned int)gtk_socket_id); - /* Pretend we never wanted it if it failed (get own window) */ + // Pretend we never wanted it if it failed (get own window) gtk_socket_id = 0; } } @@ -3675,7 +3666,7 @@ gui_mch_init(void) { gui.mainwin = gnome_app_new("Vim", NULL); # ifdef USE_XSMP - /* Use the GNOME save-yourself functionality now. */ + // Use the GNOME save-yourself functionality now. xsmp_close(); # endif } @@ -3686,7 +3677,7 @@ gui_mch_init(void) gtk_widget_set_name(gui.mainwin, "vim-main-window"); - /* Create the PangoContext used for drawing all text. */ + // Create the PangoContext used for drawing all text. gui.text_context = gtk_widget_create_pango_context(gui.mainwin); pango_context_set_base_dir(gui.text_context, PANGO_DIRECTION_LTR); @@ -3705,7 +3696,7 @@ gui_mch_init(void) gui.accel_group = gtk_accel_group_new(); gtk_window_add_accel_group(GTK_WINDOW(gui.mainwin), gui.accel_group); - /* A vertical box holds the menubar, toolbar and main text window. */ + // A vertical box holds the menubar, toolbar and main text window. #if GTK_CHECK_VERSION(3,2,0) vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_set_homogeneous(GTK_BOX(vbox), FALSE); @@ -3717,7 +3708,7 @@ gui_mch_init(void) if (using_gnome) { # if defined(FEAT_MENU) - /* automagically restore menubar/toolbar placement */ + // automagically restore menubar/toolbar placement gnome_app_enable_layout_config(GNOME_APP(gui.mainwin), TRUE); # endif gnome_app_set_contents(GNOME_APP(gui.mainwin), vbox); @@ -3736,7 +3727,7 @@ gui_mch_init(void) gui.menubar = gtk_menu_bar_new(); gtk_widget_set_name(gui.menubar, "vim-menubar"); - /* Avoid that GTK takes away from us. */ + // Avoid that GTK takes away from us. { GtkSettings *gtk_settings; @@ -3753,31 +3744,31 @@ gui_mch_init(void) gnome_app_set_menus(GNOME_APP(gui.mainwin), GTK_MENU_BAR(gui.menubar)); dockitem = gnome_app_get_dock_item_by_name(GNOME_APP(gui.mainwin), GNOME_APP_MENUBAR_NAME); - /* We don't want the menu to float. */ + // We don't want the menu to float. bonobo_dock_item_set_behavior(dockitem, bonobo_dock_item_get_behavior(dockitem) | BONOBO_DOCK_ITEM_BEH_NEVER_FLOATING); gui.menubar_h = GTK_WIDGET(dockitem); } else -# endif /* FEAT_GUI_GNOME */ - { - /* Always show the menubar, otherwise doesn't work. It may be - * disabled in gui_init() later. */ +# endif // FEAT_GUI_GNOME + { + // Always show the menubar, otherwise doesn't work. It may be + // disabled in gui_init() later. gtk_widget_show(gui.menubar); gtk_box_pack_start(GTK_BOX(vbox), gui.menubar, FALSE, FALSE, 0); } -#endif /* FEAT_MENU */ +#endif // FEAT_MENU #ifdef FEAT_TOOLBAR /* * Create the toolbar and handle */ - /* some aesthetics on the toolbar */ + // some aesthetics on the toolbar # ifdef USE_GTK3 - /* TODO: Add GTK+ 3 code here using GtkCssProvider if necessary. */ - /* N.B. Since the default value of GtkToolbar::button-relief is - * GTK_RELIEF_NONE, there's no need to specify that, probably. */ + // TODO: Add GTK+ 3 code here using GtkCssProvider if necessary. + // N.B. Since the default value of GtkToolbar::button-relief is + // GTK_RELIEF_NONE, there's no need to specify that, probably. # else gtk_rc_parse_string( "style \"vim-toolbar-style\" {\n" @@ -3798,22 +3789,22 @@ gui_mch_init(void) dockitem = gnome_app_get_dock_item_by_name(GNOME_APP(gui.mainwin), GNOME_APP_TOOLBAR_NAME); gui.toolbar_h = GTK_WIDGET(dockitem); - /* When the toolbar is floating it gets stuck. So long as that isn't - * fixed let's disallow floating. */ + // When the toolbar is floating it gets stuck. So long as that isn't + // fixed let's disallow floating. bonobo_dock_item_set_behavior(dockitem, bonobo_dock_item_get_behavior(dockitem) | BONOBO_DOCK_ITEM_BEH_NEVER_FLOATING); gtk_container_set_border_width(GTK_CONTAINER(gui.toolbar), 0); } else -# endif /* FEAT_GUI_GNOME */ +# endif // FEAT_GUI_GNOME { if (vim_strchr(p_go, GO_TOOLBAR) != NULL && (toolbar_flags & (TOOLBAR_TEXT | TOOLBAR_ICONS))) gtk_widget_show(gui.toolbar); gtk_box_pack_start(GTK_BOX(vbox), gui.toolbar, FALSE, FALSE, 0); } -#endif /* FEAT_TOOLBAR */ +#endif // FEAT_TOOLBAR #ifdef FEAT_GUI_TABLINE /* @@ -3838,7 +3829,7 @@ gui_mch_init(void) { GtkWidget *page, *label, *event_box; - /* Add the first tab. */ + // Add the first tab. # if GTK_CHECK_VERSION(3,2,0) page = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0); gtk_box_set_homogeneous(GTK_BOX(page), FALSE); @@ -3869,11 +3860,11 @@ gui_mch_init(void) G_CALLBACK(on_tab_reordered), NULL); # endif - /* Create a popup menu for the tab line and connect it. */ + // Create a popup menu for the tab line and connect it. tabline_menu = create_tabline_menu(); g_signal_connect_swapped(G_OBJECT(gui.tabline), "button-press-event", G_CALLBACK(on_tabline_menu), G_OBJECT(tabline_menu)); -#endif /* FEAT_GUI_TABLINE */ +#endif // FEAT_GUI_TABLINE gui.formwin = gtk_form_new(); gtk_container_set_border_width(GTK_CONTAINER(gui.formwin), 0); @@ -3890,7 +3881,7 @@ gui_mch_init(void) gui.by_signal = FALSE; #endif - /* Determine which events we will filter. */ + // Determine which events we will filter. gtk_widget_set_events(gui.drawarea, GDK_EXPOSURE_MASK | GDK_ENTER_NOTIFY_MASK | @@ -3908,15 +3899,15 @@ gui_mch_init(void) gtk_widget_show(gui.formwin); gtk_box_pack_start(GTK_BOX(vbox), gui.formwin, TRUE, TRUE, 0); - /* For GtkSockets, key-presses must go to the focus widget (drawarea) - * and not the window. */ + // For GtkSockets, key-presses must go to the focus widget (drawarea) + // and not the window. g_signal_connect((gtk_socket_id == 0) ? G_OBJECT(gui.mainwin) : G_OBJECT(gui.drawarea), "key-press-event", G_CALLBACK(key_press_event), NULL); #if defined(FEAT_XIM) || GTK_CHECK_VERSION(3,0,0) - /* Also forward key release events for the benefit of GTK+ 2 input - * modules. Try CTRL-SHIFT-xdigits to enter a Unicode code point. */ + // Also forward key release events for the benefit of GTK+ 2 input + // modules. Try CTRL-SHIFT-xdigits to enter a Unicode code point. g_signal_connect((gtk_socket_id == 0) ? G_OBJECT(gui.mainwin) : G_OBJECT(gui.drawarea), "key-release-event", @@ -3948,7 +3939,7 @@ gui_mch_init(void) #endif if (gtk_socket_id != 0) - /* make sure keyboard input can go to the drawarea */ + // make sure keyboard input can go to the drawarea gtk_widget_set_can_focus(gui.drawarea, TRUE); /* @@ -3986,10 +3977,9 @@ gui_mch_init(void) G_CALLBACK(enter_notify_event), NULL); } - /* Real windows can get focus ... GtkPlug, being a mere container can't, - * only its widgets. Arguably, this could be common code and we not use - * the window focus at all, but let's be safe. - */ + // Real windows can get focus ... GtkPlug, being a mere container can't, + // only its widgets. Arguably, this could be common code and we not use + // the window focus at all, but let's be safe. if (gtk_socket_id == 0) { g_signal_connect(G_OBJECT(gui.mainwin), "focus-out-event", @@ -4008,7 +3998,7 @@ gui_mch_init(void) G_CALLBACK(focus_out_event), NULL); g_signal_connect(G_OBJECT(gui.tabline), "focus-in-event", G_CALLBACK(focus_in_event), NULL); -#endif /* FEAT_GUI_TABLINE */ +#endif // FEAT_GUI_TABLINE } g_signal_connect(G_OBJECT(gui.drawarea), "motion-notify-event", @@ -4033,7 +4023,7 @@ gui_mch_init(void) g_signal_connect(G_OBJECT(gui.drawarea), "selection-get", G_CALLBACK(selection_get_cb), NULL); - /* Pretend we don't have input focus, we will get an event if we do. */ + // Pretend we don't have input focus, we will get an event if we do. gui.in_focus = FALSE; // Handle changes to the "Xft/DPI" setting. @@ -4086,7 +4076,7 @@ set_cairo_source_rgba_from_color(cairo_t const GdkRGBA rgba = color_to_rgba(color); cairo_set_source_rgba(cr, rgba.red, rgba.green, rgba.blue, rgba.alpha); } -#endif /* GTK_CHECK_VERSION(3,0,0) */ +#endif // GTK_CHECK_VERSION(3,0,0) /* * Called when the foreground or background color has been changed. @@ -4120,7 +4110,7 @@ gui_mch_new_colors(void) g_free(css); g_object_unref(provider); -#elif GTK_CHECK_VERSION(3,4,0) /* !GTK_CHECK_VERSION(3,22,2) */ +#elif GTK_CHECK_VERSION(3,4,0) // !GTK_CHECK_VERSION(3,22,2) GdkRGBA rgba; rgba = color_to_rgba(gui.back_pixel); @@ -4135,12 +4125,12 @@ gui_mch_new_colors(void) else gdk_window_set_background_rgba(da_win, &rgba); } -#else /* !GTK_CHECK_VERSION(3,4,0) */ +#else // !GTK_CHECK_VERSION(3,4,0) GdkColor color = { 0, 0, 0, 0 }; color.pixel = gui.back_pixel; gdk_window_set_background(da_win, &color); -#endif /* !GTK_CHECK_VERSION(3,22,2) */ +#endif // !GTK_CHECK_VERSION(3,22,2) } } @@ -4155,35 +4145,34 @@ form_configure_event(GtkWidget *widget U int usable_height = event->height; #if GTK_CHECK_VERSION(3,22,2) && !GTK_CHECK_VERSION(3,22,4) - /* As of 3.22.2, GdkWindows have started distributing configure events to - * their "native" children (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=12579fe71b3b8f79eb9c1b80e429443bcc437dd0). - * - * As can be seen from the implementation of move_native_children() and - * configure_native_child() in gdkwindow.c, those functions actually - * propagate configure events to every child, failing to distinguish - * "native" one from non-native one. - * - * Naturally, configure events propagated to here like that are fallacious - * and, as a matter of fact, they trigger a geometric collapse of - * gui.formwin. - * - * To filter out such fallacious events, check if the given event is the - * one that was sent out to the right place. Ignore it if not. - */ - /* Follow-up - * After a few weeks later, the GdkWindow change mentioned above was - * reverted (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=f70039cb9603a02d2369fec4038abf40a1711155). - * The corresponding official release is 3.22.4. */ + // As of 3.22.2, GdkWindows have started distributing configure events to + // their "native" children (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=12579fe71b3b8f79eb9c1b80e429443bcc437dd0). + // + // As can be seen from the implementation of move_native_children() and + // configure_native_child() in gdkwindow.c, those functions actually + // propagate configure events to every child, failing to distinguish + // "native" one from non-native one. + // + // Naturally, configure events propagated to here like that are fallacious + // and, as a matter of fact, they trigger a geometric collapse of + // gui.formwin. + // + // To filter out such fallacious events, check if the given event is the + // one that was sent out to the right place. Ignore it if not. + // + // Follow-up + // After a few weeks later, the GdkWindow change mentioned above was + // reverted (https://git.gnome.org/browse/gtk+/commit/?h=gtk-3-22&id=f70039cb9603a02d2369fec4038abf40a1711155). + // The corresponding official release is 3.22.4. if (event->window != gtk_widget_get_window(gui.formwin)) return TRUE; #endif - /* When in a GtkPlug, we can't guarantee valid heights (as a round - * no. of char-heights), so we have to manually sanitise them. - * Widths seem to sort themselves out, don't ask me why. - */ + // When in a GtkPlug, we can't guarantee valid heights (as a round + // no. of char-heights), so we have to manually sanitise them. + // Widths seem to sort themselves out, don't ask me why. if (gtk_socket_id != 0) - usable_height -= (gui.char_height - (gui.char_height/2)); /* sic. */ + usable_height -= (gui.char_height - (gui.char_height/2)); // sic. gtk_form_freeze(GTK_FORM(gui.formwin)); gui_resize_shell(event->width, usable_height); @@ -4200,13 +4189,13 @@ form_configure_event(GtkWidget *widget U static void mainwin_destroy_cb(GObject *object UNUSED, gpointer data UNUSED) { - /* Don't write messages to the GUI anymore */ + // Don't write messages to the GUI anymore full_screen = FALSE; gui.mainwin = NULL; gui.drawarea = NULL; - if (!exiting) /* only do anything if the destroy was unexpected */ + if (!exiting) // only do anything if the destroy was unexpected { vim_strncpy(IObuff, (char_u *)_("Vim: Main window unexpectedly destroyed\n"), @@ -4236,13 +4225,13 @@ check_startup_plug_hints(gpointer data U { if (init_window_hints_state == 1) { - /* Safe to use normal hints now */ + // Safe to use normal hints now init_window_hints_state = 0; update_window_manager_hints(0, 0); - return FALSE; /* stop timer */ - } - - /* Keep on trying */ + return FALSE; // stop timer + } + + // Keep on trying init_window_hints_state = 1; return TRUE; } @@ -4271,7 +4260,7 @@ gui_mch_open(void) { char *role; - /* Invent a unique-enough ID string for the role */ + // Invent a unique-enough ID string for the role role = g_strdup_printf("vim-%u-%u-%u", (unsigned)mch_get_pid(), (unsigned)g_random_int(), @@ -4284,7 +4273,7 @@ gui_mch_open(void) if (gui_win_x != -1 && gui_win_y != -1) gtk_window_move(GTK_WINDOW(gui.mainwin), gui_win_x, gui_win_y); - /* Determine user specified geometry, if present. */ + // Determine user specified geometry, if present. if (gui.geom != NULL) { int mask; @@ -4324,11 +4313,10 @@ gui_mch_open(void) } VIM_CLEAR(gui.geom); - /* From now until everyone's stopped trying to set the window hints - * to their correct minimum values, stop them being set as we need - * them to remain at our required size for the parent GtkSocket to - * give us the right initial size. - */ + // From now until everyone's stopped trying to set the window hints + // to their correct minimum values, stop them being set as we need + // them to remain at our required size for the parent GtkSocket to + // give us the right initial size. if (gtk_socket_id != 0 && (mask & WidthValue || mask & HeightValue)) { update_window_manager_hints(pixel_width, pixel_height); @@ -4339,8 +4327,8 @@ gui_mch_open(void) pixel_width = (guint)(gui_get_base_width() + Columns * gui.char_width); pixel_height = (guint)(gui_get_base_height() + Rows * gui.char_height); - /* For GTK2 changing the size of the form widget doesn't cause window - * resizing. */ + // For GTK2 changing the size of the form widget doesn't cause window + // resizing. if (gtk_socket_id == 0) gtk_window_resize(GTK_WINDOW(gui.mainwin), pixel_width, pixel_height); update_window_manager_hints(0, 0); @@ -4366,16 +4354,16 @@ gui_mch_open(void) gui.def_back_pixel = bg_pixel; } - /* Get the colors from the "Normal" and "Menu" group (set in syntax.c or - * in a vimrc file) */ + // Get the colors from the "Normal" and "Menu" group (set in syntax.c or + // in a vimrc file) set_normal_colors(); - /* Check that none of the colors are the same as the background color */ + // Check that none of the colors are the same as the background color gui_check_colors(); - /* Get the colors for the highlight groups (gui_check_colors() might have - * changed them). */ - highlight_gui_started(); /* re-init colors and fonts */ + // Get the colors for the highlight groups (gui_check_colors() might have + // changed them). + highlight_gui_started(); // re-init colors and fonts g_signal_connect(G_OBJECT(gui.mainwin), "destroy", G_CALLBACK(mainwin_destroy_cb), NULL); @@ -4394,15 +4382,15 @@ gui_mch_open(void) G_CALLBACK(form_configure_event), NULL); #ifdef FEAT_DND - /* Set up for receiving DND items. */ + // Set up for receiving DND items. gui_gtk_set_dnd_targets(); g_signal_connect(G_OBJECT(gui.drawarea), "drag-data-received", G_CALLBACK(drag_data_received_cb), NULL); #endif - /* With GTK+ 2, we need to iconify the window before calling show() - * to avoid mapping the window for a short time. */ + // With GTK+ 2, we need to iconify the window before calling show() + // to avoid mapping the window for a short time. if (found_iconic_arg && gtk_socket_id == 0) gui_mch_iconify(); @@ -4510,10 +4498,10 @@ force_shell_resize_idle(gpointer data) } resize_idle_installed = FALSE; - return FALSE; /* don't call me again */ + return FALSE; // don't call me again } # endif -#endif /* !GTK_CHECK_VERSION(3,0,0) */ +#endif // !GTK_CHECK_VERSION(3,0,0) /* * Return TRUE if the main window is maximized. @@ -4561,16 +4549,16 @@ gui_mch_set_shellsize(int width, int hei int base_width UNUSED, int base_height UNUSED, int direction UNUSED) { - /* give GTK+ a chance to put all widget's into place */ + // give GTK+ a chance to put all widget's into place gui_mch_update(); - /* this will cause the proper resizement to happen too */ + // this will cause the proper resizement to happen too if (gtk_socket_id == 0) update_window_manager_hints(0, 0); - /* With GTK+ 2, changing the size of the form widget doesn't resize - * the window. So let's do it the other way around and resize the - * main window instead. */ + // With GTK+ 2, changing the size of the form widget doesn't resize + // the window. So let's do it the other way around and resize the + // main window instead. width += get_menu_tool_width(); height += get_menu_tool_height(); @@ -4588,7 +4576,7 @@ gui_mch_set_shellsize(int width, int hei resize_idle_installed = TRUE; } # endif -# endif /* !GTK_CHECK_VERSION(3,0,0) */ +# endif // !GTK_CHECK_VERSION(3,0,0) /* * Wait until all events are processed to prevent a crash because the * real size of the drawing area doesn't reflect Vim's internal ideas. @@ -4643,8 +4631,8 @@ gui_mch_get_screen_dimensions(int *scree gui_gtk_get_screen_geom_of_win(gui.mainwin, &x, &y, screen_w, screen_h); - /* Subtract 'guiheadroom' from the height to allow some room for the - * window manager (task list and window title bar). */ + // Subtract 'guiheadroom' from the height to allow some room for the + // window manager (task list and window title bar). *screen_h -= p_ghr; /* @@ -4669,7 +4657,7 @@ gui_mch_settitle(char_u *title, char_u * if (output_conv.vc_type != CONV_NONE) vim_free(title); } -#endif /* FEAT_TITLE */ +#endif // FEAT_TITLE #if defined(FEAT_MENU) || defined(PROTO) void @@ -4684,7 +4672,7 @@ gui_mch_enable_menu(int showit) # endif widget = gui.menubar; - /* Do not disable the menu while starting up, otherwise F10 doesn't work. */ + // Do not disable the menu while starting up, otherwise F10 doesn't work. if (!showit != !gtk_widget_get_visible(widget) && !gui.starting) { if (showit) @@ -4695,7 +4683,7 @@ gui_mch_enable_menu(int showit) update_window_manager_hints(0, 0); } } -#endif /* FEAT_MENU */ +#endif // FEAT_MENU #if defined(FEAT_TOOLBAR) || defined(PROTO) void @@ -4726,7 +4714,7 @@ gui_mch_show_toolbar(int showit) update_window_manager_hints(0, 0); } } -#endif /* FEAT_TOOLBAR */ +#endif // FEAT_TOOLBAR /* * Check if a given font is a CJK font. This is done in a very crude manner. It @@ -4790,11 +4778,11 @@ gui_mch_adjust_charheight(void) gui.char_height = (ascent + descent + PANGO_SCALE - 1) / PANGO_SCALE + p_linespace; - /* LINTED: avoid warning: bitwise operation on signed value */ + // LINTED: avoid warning: bitwise operation on signed value gui.char_ascent = PANGO_PIXELS(ascent + p_linespace * PANGO_SCALE / 2); - /* A not-positive value of char_height may crash Vim. Only happens - * if 'linespace' is negative (which does make sense sometimes). */ + // A not-positive value of char_height may crash Vim. Only happens + // if 'linespace' is negative (which does make sense sometimes). gui.char_ascent = MAX(gui.char_ascent, 0); gui.char_height = MAX(gui.char_height, gui.char_ascent + 1); @@ -4802,7 +4790,7 @@ gui_mch_adjust_charheight(void) } #if GTK_CHECK_VERSION(3,0,0) -/* Callback function used in gui_mch_font_dialog() */ +// Callback function used in gui_mch_font_dialog() static gboolean font_filter(const PangoFontFamily *family, const PangoFontFace *face UNUSED, @@ -4847,8 +4835,8 @@ gui_mch_font_dialog(char_u *oldval) else oldname = oldval; - /* Annoying bug in GTK (or Pango): if the font name does not include a - * size, zero is used. Use default point size ten. */ + // Annoying bug in GTK (or Pango): if the font name does not include a + // size, zero is used. Use default point size ten. if (!vim_isdigit(oldname[STRLEN(oldname) - 1])) { char_u *p = vim_strnsave(oldname, STRLEN(oldname) + 3); @@ -4898,8 +4886,8 @@ gui_mch_font_dialog(char_u *oldval) { char_u *p; - /* Apparently some font names include a comma, need to escape - * that, because in 'guifont' it separates names. */ + // Apparently some font names include a comma, need to escape + // that, because in 'guifont' it separates names. p = vim_strsave_escaped((char_u *)name, (char_u *)","); g_free(name); if (p != NULL && input_conv.vc_type != CONV_NONE) @@ -4985,8 +4973,8 @@ ascii_glyph_table_init(void) gui.ascii_glyphs = NULL; gui.ascii_font = NULL; - /* For safety, fill in question marks for the control characters. - * Put a space between characters to avoid shaping. */ + // For safety, fill in question marks for the control characters. + // Put a space between characters to avoid shaping. for (i = 0; i < 128; ++i) { if (i >= 32 && i < 127) @@ -5000,7 +4988,7 @@ ascii_glyph_table_init(void) item_list = pango_itemize(gui.text_context, (const char *)ascii_chars, 0, sizeof(ascii_chars), attr_list, NULL); - if (item_list != NULL && item_list->next == NULL) /* play safe */ + if (item_list != NULL && item_list->next == NULL) // play safe { PangoItem *item; int width; @@ -5008,7 +4996,7 @@ ascii_glyph_table_init(void) item = (PangoItem *)item_list->data; width = gui.char_width * PANGO_SCALE; - /* Remember the shape engine used for ASCII. */ + // Remember the shape engine used for ASCII. default_shape_engine = item->analysis.shape_engine; gui.ascii_font = item->analysis.font; @@ -5047,8 +5035,8 @@ gui_mch_init_font(char_u *font_name, int PangoLayout *layout; int width; - /* If font_name is NULL, this means to use the default, which should - * be present on all proper Pango/fontconfig installations. */ + // If font_name is NULL, this means to use the default, which should + // be present on all proper Pango/fontconfig installations. if (font_name == NULL) font_name = (char_u *)DEFAULT_FONT; @@ -5088,30 +5076,30 @@ gui_mch_init_font(char_u *font_name, int { int cjk_width; - /* Measure the text extent of U+4E00 and U+4E8C */ + // Measure the text extent of U+4E00 and U+4E8C pango_layout_set_text(layout, "\344\270\200\344\272\214", -1); pango_layout_get_size(layout, &cjk_width, NULL); - if (width == cjk_width) /* Xft not patched */ + if (width == cjk_width) // Xft not patched width /= 2; } g_object_unref(layout); gui.char_width = (width / 2 + PANGO_SCALE - 1) / PANGO_SCALE; - /* A zero width may cause a crash. Happens for semi-invalid fontsets. */ + // A zero width may cause a crash. Happens for semi-invalid fontsets. if (gui.char_width <= 0) gui.char_width = 8; gui_mch_adjust_charheight(); - /* Set the fontname, which will be used for information purposes */ + // Set the fontname, which will be used for information purposes hl_set_font_name(font_name); get_styled_font_variants(); ascii_glyph_table_init(); - /* Avoid unnecessary overhead if 'guifontwide' is equal to 'guifont'. */ + // Avoid unnecessary overhead if 'guifontwide' is equal to 'guifont'. if (gui.wide_font != NULL && pango_font_description_equal(gui.norm_font, gui.wide_font)) { @@ -5121,13 +5109,13 @@ gui_mch_init_font(char_u *font_name, int if (gui_mch_maximized()) { - /* Update lines and columns in accordance with the new font, keep the - * window maximized. */ + // Update lines and columns in accordance with the new font, keep the + // window maximized. gui_mch_newfont(); } else { - /* Preserve the logical dimensions of the screen. */ + // Preserve the logical dimensions of the screen. update_window_manager_hints(0, 0); } @@ -5143,7 +5131,7 @@ gui_mch_get_font(char_u *name, int repor { PangoFontDescription *font; - /* can't do this when GUI is not running */ + // can't do this when GUI is not running if (!gui.in_use || name == NULL) return NULL; @@ -5167,7 +5155,7 @@ gui_mch_get_font(char_u *name, int repor { PangoFont *real_font; - /* pango_context_load_font() bails out if no font size is set */ + // pango_context_load_font() bails out if no font size is set if (pango_font_description_get_size(font) <= 0) pango_font_description_set_size(font, 10 * PANGO_SCALE); @@ -5235,7 +5223,7 @@ gui_mch_get_color(char_u *name) { guicolor_T color = INVALCOLOR; - if (!gui.in_use) /* can't do this when GUI not running */ + if (!gui.in_use) // can't do this when GUI not running return color; if (name != NULL) @@ -5345,7 +5333,7 @@ apply_wide_font_attr(char_u *s, int len, if (uc >= 0x80 && utf_char2cells(uc) == 2) start = p; } - else if (uc < 0x80 /* optimization shortcut */ + else if (uc < 0x80 // optimization shortcut || (utf_char2cells(uc) != 2 && !utf_iscomposing(uc))) { INSERT_PANGO_ATTR(pango_attr_font_desc_new(gui.wide_font), @@ -5366,9 +5354,9 @@ count_cluster_cells(char_u *s, PangoItem int *last_glyph_rbearing) { char_u *p; - int next; /* glyph start index of next cluster */ - int start, end; /* string segment of current cluster */ - int width; /* real cluster width in Pango units */ + int next; // glyph start index of next cluster + int start, end; // string segment of current cluster + int width; // real cluster width in Pango units int uc; int cellcount = 0; @@ -5456,8 +5444,8 @@ setup_zero_width_cluster(PangoItem *item - (gui.char_height - p_linespace) * PANGO_SCALE; } else - /* If the accent width is smaller than the cluster width, position it - * in the middle. */ + // If the accent width is smaller than the cluster width, position it + // in the middle. glyph->geometry.x_offset = -width + MAX(0, width - ink_rect.width) / 2; } @@ -5512,7 +5500,7 @@ draw_glyph_string(int row, int col, int glyphs); #endif - /* redraw the contents with an offset of 1 to emulate bold */ + // redraw the contents with an offset of 1 to emulate bold if ((flags & DRAW_BOLD) && !gui.font_can_bold) #if GTK_CHECK_VERSION(3,0,0) { @@ -5548,7 +5536,7 @@ draw_under(int flags, int row, int col, static const int val[8] = {1, 0, 0, 0, 1, 2, 2, 2 }; int y = FILL_Y(row + 1) - 1; - /* Undercurl: draw curl at the bottom of the character cell. */ + // Undercurl: draw curl at the bottom of the character cell. if (flags & DRAW_UNDERC) { #if GTK_CHECK_VERSION(3,0,0) @@ -5574,7 +5562,7 @@ draw_under(int flags, int row, int col, #endif } - /* Draw a strikethrough line */ + // Draw a strikethrough line if (flags & DRAW_STRIKE) { #if GTK_CHECK_VERSION(3,0,0) @@ -5595,11 +5583,11 @@ draw_under(int flags, int row, int col, #endif } - /* Underline: draw a line at the bottom of the character cell. */ + // Underline: draw a line at the bottom of the character cell. if (flags & DRAW_UNDERL) { - /* When p_linespace is 0, overwrite the bottom row of pixels. - * Otherwise put the line just below the character. */ + // When p_linespace is 0, overwrite the bottom row of pixels. + // Otherwise put the line just below the character. if (p_linespace > 1) y -= p_linespace - 1; #if GTK_CHECK_VERSION(3,0,0) @@ -5622,11 +5610,11 @@ draw_under(int flags, int row, int col, int gui_gtk2_draw_string(int row, int col, char_u *s, int len, int flags) { - GdkRectangle area; /* area for clip mask */ - PangoGlyphString *glyphs; /* glyphs of current item */ - int column_offset = 0; /* column offset in cells */ + GdkRectangle area; // area for clip mask + PangoGlyphString *glyphs; // glyphs of current item + int column_offset = 0; // column offset in cells int i; - char_u *conv_buf = NULL; /* result of UTF-8 conversion */ + char_u *conv_buf = NULL; // result of UTF-8 conversion char_u *new_conv_buf; int convlen; char_u *sp, *bp; @@ -5650,9 +5638,9 @@ gui_gtk2_draw_string(int row, int col, c conv_buf = string_convert(&output_conv, s, &convlen); g_return_val_if_fail(conv_buf != NULL, len); - /* Correct for differences in char width: some chars are - * double-wide in 'encoding' but single-wide in utf-8. Add a space to - * compensate for that. */ + // Correct for differences in char width: some chars are + // double-wide in 'encoding' but single-wide in utf-8. Add a space to + // compensate for that. for (sp = s, bp = conv_buf; sp < s + len && bp < conv_buf + convlen; ) { plen = utf_ptr2len(bp); @@ -5737,26 +5725,26 @@ not_ascii: GList *item_list; int cluster_width; int last_glyph_rbearing; - int cells = 0; /* cells occupied by current cluster */ - - /* Safety check: pango crashes when invoked with invalid utf-8 - * characters. */ + int cells = 0; // cells occupied by current cluster + + // Safety check: pango crashes when invoked with invalid utf-8 + // characters. if (!utf_valid_string(s, s + len)) { column_offset = len; goto skipitall; } - /* original width of the current cluster */ + // original width of the current cluster cluster_width = PANGO_SCALE * gui.char_width; - /* right bearing of the last non-composing glyph */ + // right bearing of the last non-composing glyph last_glyph_rbearing = PANGO_SCALE * gui.char_width; attr_list = pango_attr_list_new(); - /* If 'guifontwide' is set then use that for double-width characters. - * Otherwise just go with 'guifont' and let Pango do its thing. */ + // If 'guifontwide' is set then use that for double-width characters. + // Otherwise just go with 'guifont' and let Pango do its thing. if (gui.wide_font != NULL) apply_wide_font_attr(s, len, attr_list); @@ -5778,7 +5766,7 @@ not_ascii: while (item_list != NULL) { PangoItem *item; - int item_cells = 0; /* item length in cells */ + int item_cells = 0; // item length in cells item = (PangoItem *)item_list->data; item_list = g_list_delete_link(item_list, item_list); @@ -5796,8 +5784,8 @@ not_ascii: */ item->analysis.level = (item->analysis.level + 1) & (~1U); - /* HACK: Overrule the shape engine, we don't want shaping to be - * done, because drawing the cursor would change the display. */ + // HACK: Overrule the shape engine, we don't want shaping to be + // done, because drawing the cursor would change the display. item->analysis.shape_engine = default_shape_engine; #ifdef HAVE_PANGO_SHAPE_FULL @@ -5841,10 +5829,10 @@ not_ascii: } else { - /* If there are only combining characters in the - * cluster, we cannot just change the width of the - * previous glyph since there is none. Therefore - * some guesswork is needed. */ + // If there are only combining characters in the + // cluster, we cannot just change the width of the + // previous glyph since there is none. Therefore + // some guesswork is needed. setup_zero_width_cluster(item, glyph, cells, cluster_width, last_glyph_rbearing); @@ -5857,16 +5845,16 @@ not_ascii: { int width; - /* There is a previous glyph, so we deal with combining - * characters the canonical way. - * In some circumstances Pango uses a positive x_offset, - * then use the width of the previous glyph for this one - * and set the previous width to zero. - * Otherwise we get a negative x_offset, Pango has already - * positioned the combining char, keep the widths as they - * are. - * For both adjust the x_offset to position the glyph in - * the middle. */ + // There is a previous glyph, so we deal with combining + // characters the canonical way. + // In some circumstances Pango uses a positive x_offset, + // then use the width of the previous glyph for this one + // and set the previous width to zero. + // Otherwise we get a negative x_offset, Pango has already + // positioned the combining char, keep the widths as they + // are. + // For both adjust the x_offset to position the glyph in + // the middle. if (glyph->geometry.x_offset >= 0) { glyphs->glyphs[i].geometry.width = @@ -5877,13 +5865,13 @@ not_ascii: glyph->geometry.x_offset += MAX(0, width - cluster_width) / 2; } - else /* i == 0 "cannot happen" */ + else // i == 0 "cannot happen" { glyph->geometry.width = 0; } } - /*** Aaaaand action! ***/ + //// Aaaaand action! ** #if GTK_CHECK_VERSION(3,0,0) draw_glyph_string(row, col + column_offset, item_cells, flags, item->analysis.font, glyphs, @@ -5902,7 +5890,7 @@ not_ascii: } skipitall: - /* Draw underline and undercurl. */ + // Draw underline and undercurl. #if GTK_CHECK_VERSION(3,0,0) draw_under(flags, row, col, column_offset, cr); #else @@ -5990,7 +5978,7 @@ gui_mch_beep(void) gui_mch_flash(int msec) { #if GTK_CHECK_VERSION(3,0,0) - /* TODO Replace GdkGC with Cairo */ + // TODO Replace GdkGC with Cairo (void)msec; #else GdkGCValues values; @@ -6023,7 +6011,7 @@ gui_mch_flash(int msec) FILL_Y((int)Rows) + gui.border_offset); gui_mch_flush(); - ui_delay((long)msec, TRUE); /* wait so many msec */ + ui_delay((long)msec, TRUE); // wait so many msec gdk_draw_rectangle(gui.drawarea->window, invert_gc, TRUE, @@ -6051,7 +6039,7 @@ gui_mch_invert_rectangle(int r, int c, i # if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1,9,2) cairo_set_operator(cr, CAIRO_OPERATOR_DIFFERENCE); # else - /* Give an implementation for older cairo versions if necessary. */ + // Give an implementation for older cairo versions if necessary. # endif gdk_cairo_rectangle(cr, &rect); cairo_fill(cr); @@ -6173,7 +6161,7 @@ gui_mch_draw_part_cursor(int w, int h, g gui.fgcolor->alpha); cairo_rectangle(cr, # ifdef FEAT_RIGHTLEFT - /* vertical line should be on the right of current point */ + // vertical line should be on the right of current point CURSOR_BAR_RIGHT ? FILL_X(gui.col + 1) - w : # endif FILL_X(gui.col), FILL_Y(gui.row) + gui.char_height - h, @@ -6181,18 +6169,18 @@ gui_mch_draw_part_cursor(int w, int h, g cairo_fill(cr); cairo_destroy(cr); } -#else /* !GTK_CHECK_VERSION(3,0,0) */ +#else // !GTK_CHECK_VERSION(3,0,0) gdk_gc_set_foreground(gui.text_gc, gui.fgcolor); gdk_draw_rectangle(gui.drawarea->window, gui.text_gc, TRUE, # ifdef FEAT_RIGHTLEFT - /* vertical line should be on the right of current point */ + // vertical line should be on the right of current point CURSOR_BAR_RIGHT ? FILL_X(gui.col + 1) - w : # endif FILL_X(gui.col), FILL_Y(gui.row) + gui.char_height - h, w, h); -#endif /* !GTK_CHECK_VERSION(3,0,0) */ +#endif // !GTK_CHECK_VERSION(3,0,0) } @@ -6214,22 +6202,22 @@ input_timer_cb(gpointer data) { int *timed_out = (int *) data; - /* Just inform the caller about the occurrence of it */ + // Just inform the caller about the occurrence of it *timed_out = TRUE; - return FALSE; /* don't happen again */ + return FALSE; // don't happen again } #ifdef FEAT_JOB_CHANNEL static timeout_cb_type channel_poll_cb(gpointer data UNUSED) { - /* Using an event handler for a channel that may be disconnected does - * not work, it hangs. Instead poll for messages. */ + // Using an event handler for a channel that may be disconnected does + // not work, it hangs. Instead poll for messages. channel_handle_events(TRUE); parse_queued_messages(); - return TRUE; /* repeat */ + return TRUE; // repeat } #endif @@ -6264,8 +6252,8 @@ gui_mch_wait_for_chars(long wtime) timer = 0; #ifdef FEAT_JOB_CHANNEL - /* If there is a channel with the keep_open flag we need to poll for input - * on them. */ + // If there is a channel with the keep_open flag we need to poll for input + // on them. if (channel_any_keep_open()) channel_timer = timeout_add(20, channel_poll_cb, NULL); #endif @@ -6274,7 +6262,7 @@ gui_mch_wait_for_chars(long wtime) do { - /* Stop or start blinking when focus changes */ + // Stop or start blinking when focus changes if (gui.in_focus != focus) { if (gui.in_focus) @@ -6291,7 +6279,7 @@ gui_mch_wait_for_chars(long wtime) parse_queued_messages(); # ifdef FEAT_TIMERS if (did_add_timer) - /* Need to recompute the waiting time. */ + // Need to recompute the waiting time. goto theend; # endif #endif @@ -6304,7 +6292,7 @@ gui_mch_wait_for_chars(long wtime) if (!input_available()) g_main_context_iteration(NULL, TRUE); - /* Got char, return immediately */ + // Got char, return immediately if (input_available()) { retval = OK; @@ -6329,12 +6317,12 @@ theend: } -/**************************************************************************** - * Output drawing routines. - ****************************************************************************/ - - -/* Flush any output to the screen */ +///////////////////////////////////////////////////////////////////////////// +// Output drawing routines. +// + + +// Flush any output to the screen void gui_mch_flush(void) { @@ -6373,8 +6361,8 @@ gui_mch_clear_block(int row1arg, int col #if GTK_CHECK_VERSION(3,0,0) { - /* Add one pixel to the far right column in case a double-stroked - * bold glyph may sit there. */ + // Add one pixel to the far right column in case a double-stroked + // bold glyph may sit there. const GdkRectangle rect = { FILL_X(col1), FILL_Y(row1), (col2 - col1 + 1) * gui.char_width + (col2 == Columns - 1), @@ -6398,17 +6386,17 @@ gui_mch_clear_block(int row1arg, int col if (!gui.by_signal) gdk_window_invalidate_rect(win, &rect, FALSE); } -#else /* !GTK_CHECK_VERSION(3,0,0) */ +#else // !GTK_CHECK_VERSION(3,0,0) gdk_gc_set_foreground(gui.text_gc, &color); - /* Clear one extra pixel at the far right, for when bold characters have - * spilled over to the window border. */ + // Clear one extra pixel at the far right, for when bold characters have + // spilled over to the window border. gdk_draw_rectangle(gui.drawarea->window, gui.text_gc, TRUE, FILL_X(col1), FILL_Y(row1), (col2 - col1 + 1) * gui.char_width + (col2 == Columns - 1), (row2 - row1 + 1) * gui.char_height); -#endif /* !GTK_CHECK_VERSION(3,0,0) */ +#endif // !GTK_CHECK_VERSION(3,0,0) } #if GTK_CHECK_VERSION(3,0,0) @@ -6459,19 +6447,19 @@ check_copy_area(void) if (gui.visibility != GDK_VISIBILITY_PARTIAL) return; - /* Avoid redrawing the cursor while scrolling or it'll end up where - * we don't want it to be. I'm not sure if it's correct to call - * gui_dont_update_cursor() at this point but it works as a quick - * fix for now. */ + // Avoid redrawing the cursor while scrolling or it'll end up where + // we don't want it to be. I'm not sure if it's correct to call + // gui_dont_update_cursor() at this point but it works as a quick + // fix for now. gui_dont_update_cursor(TRUE); do { - /* Wait to check whether the scroll worked or not. */ + // Wait to check whether the scroll worked or not. event = gdk_event_get_graphics_expose(gui.drawarea->window); if (event == NULL) - break; /* received NoExpose event */ + break; // received NoExpose event gui_redraw(event->expose.area.x, event->expose.area.y, event->expose.area.width, event->expose.area.height); @@ -6479,11 +6467,11 @@ check_copy_area(void) expose_count = event->expose.count; gdk_event_free(event); } - while (expose_count > 0); /* more events follow */ + while (expose_count > 0); // more events follow gui_can_update_cursor(); } -#endif /* !GTK_CHECK_VERSION(3,0,0) */ +#endif // !GTK_CHECK_VERSION(3,0,0) #if GTK_CHECK_VERSION(3,0,0) static void @@ -6533,12 +6521,12 @@ gui_mch_delete_lines(int row, int num_li gui.char_width * ncols + 1, gui.char_height * nrows); #else if (gui.visibility == GDK_VISIBILITY_FULLY_OBSCURED) - return; /* Can't see the window */ + return; // Can't see the window gdk_gc_set_foreground(gui.text_gc, gui.fgcolor); gdk_gc_set_background(gui.text_gc, gui.bgcolor); - /* copy one extra pixel, for when bold has spilled over */ + // copy one extra pixel, for when bold has spilled over gdk_window_copy_area(gui.drawarea->window, gui.text_gc, FILL_X(gui.scroll_region_left), FILL_Y(row), gui.drawarea->window, @@ -6552,7 +6540,7 @@ gui_mch_delete_lines(int row, int num_li gui.scroll_region_left, gui.scroll_region_bot, gui.scroll_region_right); check_copy_area(); -#endif /* !GTK_CHECK_VERSION(3,0,0) */ +#endif // !GTK_CHECK_VERSION(3,0,0) } /* @@ -6583,12 +6571,12 @@ gui_mch_insert_lines(int row, int num_li gui.char_width * ncols + 1, gui.char_height * nrows); #else if (gui.visibility == GDK_VISIBILITY_FULLY_OBSCURED) - return; /* Can't see the window */ + return; // Can't see the window gdk_gc_set_foreground(gui.text_gc, gui.fgcolor); gdk_gc_set_background(gui.text_gc, gui.bgcolor); - /* copy one extra pixel, for when bold has spilled over */ + // copy one extra pixel, for when bold has spilled over gdk_window_copy_area(gui.drawarea->window, gui.text_gc, FILL_X(gui.scroll_region_left), FILL_Y(row + num_lines), gui.drawarea->window, @@ -6600,7 +6588,7 @@ gui_mch_insert_lines(int row, int num_li gui_clear_block(row, gui.scroll_region_left, row + num_lines - 1, gui.scroll_region_right); check_copy_area(); -#endif /* !GTK_CHECK_VERSION(3,0,0) */ +#endif // !GTK_CHECK_VERSION(3,0,0) } /* @@ -6624,18 +6612,18 @@ clip_mch_request_selection(Clipboard_T * cbd->gtk_sel_atom, target, (guint32)GDK_CURRENT_TIME); - /* Hack: Wait up to three seconds for the selection. A hang was - * noticed here when using the netrw plugin combined with ":gui" - * during the FocusGained event. */ + // Hack: Wait up to three seconds for the selection. A hang was + // noticed here when using the netrw plugin combined with ":gui" + // during the FocusGained event. start = time(NULL); while (received_selection == RS_NONE && time(NULL) < start + 3) - g_main_context_iteration(NULL, TRUE); /* wait for selection_received_cb */ + g_main_context_iteration(NULL, TRUE); // wait for selection_received_cb if (received_selection != RS_FAIL) return; } - /* Final fallback position - use the X CUT_BUFFER0 store */ + // Final fallback position - use the X CUT_BUFFER0 store yank_cut_buffer0(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.mainwin)), cbd); } @@ -6699,7 +6687,7 @@ gui_mch_menu_grey(vimmenu_T *menu, int g grey = TRUE; gui_mch_menu_hidden(menu, FALSE); - /* Be clever about bitfields versus true booleans here! */ + // Be clever about bitfields versus true booleans here! if (!gtk_widget_get_sensitive(menu->id) == !grey) { gtk_widget_set_sensitive(menu->id, !grey); @@ -6740,10 +6728,10 @@ gui_mch_menu_hidden(vimmenu_T *menu, int void gui_mch_draw_menubar(void) { - /* just make sure that the visual changes get effect immediately */ + // just make sure that the visual changes get effect immediately gui_mch_update(); } -#endif /* FEAT_MENU */ +#endif // FEAT_MENU /* * Scrollbar stuff. @@ -6792,9 +6780,9 @@ gui_mch_getmouse(int *x, int *y) void gui_mch_setmouse(int x, int y) { - /* Sorry for the Xlib call, but we can't avoid it, since there is no - * internal GDK mechanism present to accomplish this. (and for good - * reason...) */ + // Sorry for the Xlib call, but we can't avoid it, since there is no + // internal GDK mechanism present to accomplish this. (and for good + // reason...) XWarpPointer(GDK_WINDOW_XDISPLAY(gtk_widget_get_window(gui.drawarea)), (Window)0, GDK_WINDOW_XID(gtk_widget_get_window(gui.drawarea)), 0, 0, 0U, 0U, x, y); @@ -6802,8 +6790,8 @@ gui_mch_setmouse(int x, int y) #ifdef FEAT_MOUSESHAPE -/* The last set mouse pointer shape is remembered, to be used when it goes - * from hidden to not hidden. */ +// The last set mouse pointer shape is remembered, to be used when it goes +// from hidden to not hidden. static int last_shape = 0; #endif @@ -6835,27 +6823,27 @@ gui_mch_mousehide(int hide) #if defined(FEAT_MOUSESHAPE) || defined(PROTO) -/* Table for shape IDs. Keep in sync with the mshape_names[] table in - * misc2.c! */ +// Table for shape IDs. Keep in sync with the mshape_names[] table in +// misc2.c! static const int mshape_ids[] = { - GDK_LEFT_PTR, /* arrow */ - GDK_CURSOR_IS_PIXMAP, /* blank */ - GDK_XTERM, /* beam */ - GDK_SB_V_DOUBLE_ARROW, /* updown */ - GDK_SIZING, /* udsizing */ - GDK_SB_H_DOUBLE_ARROW, /* leftright */ - GDK_SIZING, /* lrsizing */ - GDK_WATCH, /* busy */ - GDK_X_CURSOR, /* no */ - GDK_CROSSHAIR, /* crosshair */ - GDK_HAND1, /* hand1 */ - GDK_HAND2, /* hand2 */ - GDK_PENCIL, /* pencil */ - GDK_QUESTION_ARROW, /* question */ - GDK_RIGHT_PTR, /* right-arrow */ - GDK_CENTER_PTR, /* up-arrow */ - GDK_LEFT_PTR /* last one */ + GDK_LEFT_PTR, // arrow + GDK_CURSOR_IS_PIXMAP, // blank + GDK_XTERM, // beam + GDK_SB_V_DOUBLE_ARROW, // updown + GDK_SIZING, // udsizing + GDK_SB_H_DOUBLE_ARROW, // leftright + GDK_SIZING, // lrsizing + GDK_WATCH, // busy + GDK_X_CURSOR, // no + GDK_CROSSHAIR, // crosshair + GDK_HAND1, // hand1 + GDK_HAND2, // hand2 + GDK_PENCIL, // pencil + GDK_QUESTION_ARROW, // question + GDK_RIGHT_PTR, // right-arrow + GDK_CENTER_PTR, // up-arrow + GDK_LEFT_PTR // last one }; void @@ -6878,7 +6866,7 @@ mch_set_mouse_shape(int shape) if (id >= GDK_LAST_CURSOR) id = GDK_LEFT_PTR; else - id &= ~1; /* they are always even (why?) */ + id &= ~1; // they are always even (why?) } else if (shape < (int)(sizeof(mshape_ids) / sizeof(int))) id = mshape_ids[shape]; @@ -6890,13 +6878,13 @@ mch_set_mouse_shape(int shape) # if GTK_CHECK_VERSION(3,0,0) g_object_unref(G_OBJECT(c)); # else - gdk_cursor_destroy(c); /* Unref, actually. Bloody GTK+ 1. */ + gdk_cursor_destroy(c); // Unref, actually. Bloody GTK+ 1. # endif } if (shape != MSHAPE_HIDE) last_shape = shape; } -#endif /* FEAT_MOUSESHAPE */ +#endif // FEAT_MOUSESHAPE #if defined(FEAT_SIGN_ICONS) || defined(PROTO) @@ -6945,15 +6933,15 @@ gui_mch_drawsign(int row, int col, int t int w = width; int h = height; - /* Keep the original aspect ratio */ + // Keep the original aspect ratio aspect = (double)height / (double)width; width = (double)SIGN_WIDTH * SIGN_ASPECT / aspect; width = MIN(width, SIGN_WIDTH); if (((double)(MAX(height, SIGN_HEIGHT)) / (double)(MIN(height, SIGN_HEIGHT))) < 1.15) { - /* Change the aspect ratio by at most 15% to fill the - * available space completely. */ + // Change the aspect ratio by at most 15% to fill the + // available space completely. height = (double)SIGN_HEIGHT * SIGN_ASPECT / aspect; height = MIN(height, SIGN_HEIGHT); } @@ -6962,24 +6950,24 @@ gui_mch_drawsign(int row, int col, int t if (w == width && h == height) { - /* no change in dimensions; don't decrease reference counter - * (below) */ + // no change in dimensions; don't decrease reference counter + // (below) need_scale = FALSE; } else { - /* This doesn't seem to be worth caching, and doing so would - * complicate the code quite a bit. */ + // This doesn't seem to be worth caching, and doing so would + // complicate the code quite a bit. sign = gdk_pixbuf_scale_simple(sign, width, height, GDK_INTERP_BILINEAR); if (sign == NULL) - return; /* out of memory */ + return; // out of memory } } - /* The origin is the upper-left corner of the pixmap. Therefore - * these offset may become negative if the pixmap is smaller than - * the 2x1 cells reserved for the sign icon. */ + // The origin is the upper-left corner of the pixmap. Therefore + // these offset may become negative if the pixmap is smaller than + // the 2x1 cells reserved for the sign icon. xoffset = (width - SIGN_WIDTH) / 2; yoffset = (height - SIGN_HEIGHT) / 2; @@ -7027,7 +7015,7 @@ gui_mch_drawsign(int row, int col, int t FILL_X(col), FILL_Y(col), width, height); } -# else /* !GTK_CHECK_VERSION(3,0,0) */ +# else // !GTK_CHECK_VERSION(3,0,0) gdk_gc_set_foreground(gui.text_gc, gui.bgcolor); gdk_draw_rectangle(gui.drawarea->window, @@ -7050,7 +7038,7 @@ gui_mch_drawsign(int row, int col, int t 127, GDK_RGB_DITHER_NORMAL, 0, 0); -# endif /* !GTK_CHECK_VERSION(3,0,0) */ +# endif // !GTK_CHECK_VERSION(3,0,0) if (need_scale) g_object_unref(sign); } @@ -7077,8 +7065,8 @@ gui_mch_register_sign(char_u *signfile) if (message != NULL) { - /* The error message is already translated and will be more - * descriptive than anything we could possibly do ourselves. */ + // The error message is already translated and will be more + // descriptive than anything we could possibly do ourselves. semsg("E255: %s", message); if (input_conv.vc_type != CONV_NONE) @@ -7097,4 +7085,4 @@ gui_mch_destroy_sign(void *sign) g_object_unref(sign); } -#endif /* FEAT_SIGN_ICONS */ +#endif // FEAT_SIGN_ICONS diff --git a/src/version.c b/src/version.c --- a/src/version.c +++ b/src/version.c @@ -743,6 +743,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 2380, +/**/ 2379, /**/ 2378,