summaryrefslogtreecommitdiff
path: root/src/gui.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-12-01 22:11:18 +0100
committerBram Moolenaar <Bram@vim.org>2019-12-01 22:11:18 +0100
commit306139005c31ea7e6f892dd119beba3c94dcb982 (patch)
tree8b256dbe178f2b314831b64b17d67560e2a54043 /src/gui.c
parent217e1b8359447f5550dcb0d1ee43380a90c253c5 (diff)
downloadvim-git-306139005c31ea7e6f892dd119beba3c94dcb982.tar.gz
patch 8.1.2380: using old C style commentsv8.1.2380
Problem: Using old C style comments. Solution: Use // comments where appropriate.
Diffstat (limited to 'src/gui.c')
-rw-r--r--src/gui.c989
1 files changed, 494 insertions, 495 deletions
diff --git a/src/gui.c b/src/gui.c
index 3e5eff5d8..0a7f346db 100644
--- 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 <sys/wait.h>
# 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 fontset UNUSED)
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 fontset UNUSED)
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 fontset UNUSED)
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 UNUSED)
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 pixel_height)
{
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! */
+ // Other Ctrl character: shouldn't happen!
- --len; /* Skip this char */
+ --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_change_cnt)
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 UNUSED)
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 UNUSED)
#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 UNUSED)
#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 UNUSED)
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 UNUSED)
#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 UNUSED)
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 UNUSED)
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, int type, win_T *wp)
{
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 value, int still_dragging)
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 value, int still_dragging)
{
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 value, int still_dragging)
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 value, int still_dragging)
}
#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 value, int still_dragging)
}
}
# 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 value, int still_dragging)
}
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 value, int still_dragging)
))))
{
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 compute_longest_lnum)
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 compute_longest_lnum)
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 */
+ return; // still in the same old window, or none at all
- /* Ignore position in the tab pages line. */
+ // 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 "\<text\>" and remove. */
+ // Recognize "\<text\>" 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(&regmatch, 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]))
{