diff options
author | Bram Moolenaar <Bram@vim.org> | 2019-12-01 22:11:18 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2019-12-01 22:11:18 +0100 |
commit | 306139005c31ea7e6f892dd119beba3c94dcb982 (patch) | |
tree | 8b256dbe178f2b314831b64b17d67560e2a54043 /src/gui.c | |
parent | 217e1b8359447f5550dcb0d1ee43380a90c253c5 (diff) |
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.c | 989 |
1 files changed, 494 insertions, 495 deletions
@@ -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, |