comparison src/ex_cmds.c @ 735:ace020011f68

updated for version 7.0221
author vimboss
date Sat, 11 Mar 2006 21:36:59 +0000
parents 0a9371c70540
children 605c8fbb13dd
comparison
equal deleted inserted replaced
734:5220ea46cb9a 735:ace020011f68
5173 #endif 5173 #endif
5174 5174
5175 #if (defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)) || defined(PROTO) 5175 #if (defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)) || defined(PROTO)
5176 /* 5176 /*
5177 * Set up for a tagpreview. 5177 * Set up for a tagpreview.
5178 * Return TRUE when it was created.
5178 */ 5179 */
5179 void 5180 int
5180 prepare_tagpreview() 5181 prepare_tagpreview()
5181 { 5182 {
5182 win_T *wp; 5183 win_T *wp;
5183 5184
5184 # ifdef FEAT_GUI 5185 # ifdef FEAT_GUI
5200 /* 5201 /*
5201 * There is no preview window open yet. Create one. 5202 * There is no preview window open yet. Create one.
5202 */ 5203 */
5203 if (win_split(g_do_tagpreview > 0 ? g_do_tagpreview : 0, 0) 5204 if (win_split(g_do_tagpreview > 0 ? g_do_tagpreview : 0, 0)
5204 == FAIL) 5205 == FAIL)
5205 return; 5206 return FALSE;
5206 curwin->w_p_pvw = TRUE; 5207 curwin->w_p_pvw = TRUE;
5207 curwin->w_p_wfh = TRUE; 5208 curwin->w_p_wfh = TRUE;
5208 # ifdef FEAT_SCROLLBIND 5209 # ifdef FEAT_SCROLLBIND
5209 curwin->w_p_scb = FALSE; /* don't take over 'scrollbind' */ 5210 curwin->w_p_scb = FALSE; /* don't take over 'scrollbind' */
5210 # endif 5211 # endif
5212 curwin->w_p_diff = FALSE; /* no 'diff' */ 5213 curwin->w_p_diff = FALSE; /* no 'diff' */
5213 # endif 5214 # endif
5214 # ifdef FEAT_FOLDING 5215 # ifdef FEAT_FOLDING
5215 curwin->w_p_fdc = 0; /* no 'foldcolumn' */ 5216 curwin->w_p_fdc = 0; /* no 'foldcolumn' */
5216 # endif 5217 # endif
5217 } 5218 return TRUE;
5218 } 5219 }
5220 }
5221 return FALSE;
5219 } 5222 }
5220 5223
5221 #endif 5224 #endif
5222 5225
5223 5226
6835 void 6838 void
6836 ex_drop(eap) 6839 ex_drop(eap)
6837 exarg_T *eap; 6840 exarg_T *eap;
6838 { 6841 {
6839 int split = FALSE; 6842 int split = FALSE;
6840 int incurwin = FALSE;
6841 char_u *arg;
6842 char_u *first = NULL;
6843 win_T *wp; 6843 win_T *wp;
6844 buf_T *buf; 6844 buf_T *buf;
6845 # ifdef FEAT_WINDOWS
6846 tabpage_T *tp;
6847 # endif
6845 6848
6846 /* 6849 /*
6847 * Check if the first argument is already being edited in a window. If 6850 * Check if the first argument is already being edited in a window. If
6848 * so, jump to that window. 6851 * so, jump to that window.
6849 * We would actually need to check all arguments, but that's complicated 6852 * We would actually need to check all arguments, but that's complicated
6850 * and mostly only one file is dropped. 6853 * and mostly only one file is dropped.
6851 * This also ignores wildcards, since it is very unlikely the user is 6854 * This also ignores wildcards, since it is very unlikely the user is
6852 * editing a file name with a wildcard character. 6855 * editing a file name with a wildcard character.
6853 */ 6856 */
6854 arg = vim_strsave(eap->arg); 6857 set_arglist(eap->arg);
6855 if (arg != NULL) 6858
6856 {
6857 /* Get the first argument, remove quotes, make it a full path. */
6858 first = fix_fname(arg);
6859 if (first != NULL)
6860 {
6861 buf = buflist_findname(first);
6862 FOR_ALL_WINDOWS(wp)
6863 {
6864 if (wp->w_buffer == buf)
6865 {
6866 incurwin = TRUE;
6867 # ifdef FEAT_WINDOWS 6859 # ifdef FEAT_WINDOWS
6868 win_enter(wp, TRUE); 6860 if (cmdmod.tab)
6869 break; 6861 {
6862 /* ":tab drop file ...": open a tab for each argument that isn't
6863 * edited in a window yet. It's like ":tab all" but without closing
6864 * windows or tabs. */
6865 ex_all(eap);
6866 }
6867 else
6870 # endif 6868 # endif
6871 } 6869 {
6872 } 6870 /* ":drop file ...": Edit the first argument. Jump to an existing
6873 vim_free(first); 6871 * window if possible, edit in current window if the current buffer
6874 6872 * can be abandoned, otherwise open a new window. */
6875 if (incurwin) 6873 buf = buflist_findnr(ARGLIST[0].ae_fnum);
6876 { 6874
6877 /* Already editing the file. Redefine the argument list. */ 6875 FOR_ALL_TAB_WINDOWS(tp, wp)
6878 set_arglist(eap->arg); 6876 {
6877 if (wp->w_buffer == buf)
6878 {
6879 # ifdef FEAT_WINDOWS
6880 goto_tabpage_tp(tp);
6881 win_enter(wp, TRUE);
6882 # ifdef FEAT_GUI_TABLINE
6883 if (gui_use_tabline())
6884 gui_mch_set_curtab(tabpage_index(curtab));
6885 # endif
6886 # endif
6879 curwin->w_arg_idx = 0; 6887 curwin->w_arg_idx = 0;
6880 vim_free(arg);
6881 return; 6888 return;
6882 } 6889 }
6883 } 6890 }
6884 vim_free(arg); 6891
6885 } 6892 /*
6886 6893 * Check whether the current buffer is changed. If so, we will need
6887 /* 6894 * to split the current window or data could be lost.
6888 * Check whether the current buffer is changed. If so, we will need 6895 * Skip the check if the 'hidden' option is set, as in this case the
6889 * to split the current window or data could be lost. 6896 * buffer won't be lost.
6890 * Skip the check if the 'hidden' option is set, as in this case the 6897 */
6891 * buffer won't be lost. 6898 if (!P_HID(curbuf))
6892 */ 6899 {
6893 if (!P_HID(curbuf))
6894 {
6895 # ifdef FEAT_WINDOWS 6900 # ifdef FEAT_WINDOWS
6896 ++emsg_off; 6901 ++emsg_off;
6897 # endif 6902 # endif
6898 split = check_changed(curbuf, TRUE, FALSE, FALSE, FALSE); 6903 split = check_changed(curbuf, TRUE, FALSE, FALSE, FALSE);
6899 # ifdef FEAT_WINDOWS 6904 # ifdef FEAT_WINDOWS
6900 --emsg_off; 6905 --emsg_off;
6901 # else 6906 # else
6907 if (split)
6908 return;
6909 # endif
6910 }
6911
6912 /* Fake a ":sfirst" or ":first" command edit the first argument. */
6902 if (split) 6913 if (split)
6903 return; 6914 {
6904 # endif 6915 eap->cmdidx = CMD_sfirst;
6905 } 6916 eap->cmd[0] = 's';
6906 6917 }
6907 /* Fake a ":snext" or ":next" command, redefine the arglist. */ 6918 else
6908 if (split) 6919 eap->cmdidx = CMD_first;
6909 { 6920 ex_rewind(eap);
6910 eap->cmdidx = CMD_snext; 6921 }
6911 eap->cmd[0] = 's'; 6922 }
6912 } 6923 #endif
6913 else
6914 eap->cmdidx = CMD_next;
6915 ex_next(eap);
6916 }
6917 #endif