comparison src/buffer.c @ 1618:46bbe11644e0

updated for version 7.2a
author vimboss
date Tue, 24 Jun 2008 20:19:36 +0000
parents a83f48a17efb
children f4f8014d516e
comparison
equal deleted inserted replaced
1617:5f0c7aae4da2 1618:46bbe11644e0
1231 * make buf current buffer 1231 * make buf current buffer
1232 */ 1232 */
1233 if (action == DOBUF_SPLIT) /* split window first */ 1233 if (action == DOBUF_SPLIT) /* split window first */
1234 { 1234 {
1235 # ifdef FEAT_WINDOWS 1235 # ifdef FEAT_WINDOWS
1236 /* jump to first window containing buf if one exists ("useopen") */ 1236 /* If 'switchbuf' contains "useopen": jump to first window containing
1237 if (vim_strchr(p_swb, 'o') != NULL && buf_jump_open_win(buf)) 1237 * "buf" if one exists */
1238 if ((swb_flags & SWB_USEOPEN) && buf_jump_open_win(buf))
1238 return OK; 1239 return OK;
1239 /* jump to first window in any tab page containing buf if one exists 1240 /* If 'switchbuf' contians "usetab": jump to first window in any tab
1240 * ("usetab") */ 1241 * page containing "buf" if one exists */
1241 if (vim_strchr(p_swb, 'a') != NULL && buf_jump_open_tab(buf)) 1242 if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf))
1242 return OK; 1243 return OK;
1243 if (win_split(0, 0) == FAIL) 1244 if (win_split(0, 0) == FAIL)
1244 # endif 1245 # endif
1245 return FAIL; 1246 return FAIL;
1246 } 1247 }
1872 col = 0; 1873 col = 0;
1873 1874
1874 #ifdef FEAT_WINDOWS 1875 #ifdef FEAT_WINDOWS
1875 if (options & GETF_SWITCH) 1876 if (options & GETF_SWITCH)
1876 { 1877 {
1877 /* use existing open window for buffer if wanted */ 1878 /* If 'switchbuf' contains "useopen": jump to first window containing
1878 if (vim_strchr(p_swb, 'o') != NULL) /* useopen */ 1879 * "buf" if one exists */
1880 if (swb_flags & SWB_USEOPEN)
1879 wp = buf_jump_open_win(buf); 1881 wp = buf_jump_open_win(buf);
1880 /* use existing open window in any tab page for buffer if wanted */ 1882 /* If 'switchbuf' contians "usetab": jump to first window in any tab
1881 if (vim_strchr(p_swb, 'a') != NULL) /* usetab */ 1883 * page containing "buf" if one exists */
1884 if (wp == NULL && (swb_flags & SWB_USETAB))
1882 wp = buf_jump_open_tab(buf); 1885 wp = buf_jump_open_tab(buf);
1883 /* split window if wanted ("split") */ 1886 /* If 'switchbuf' contains "split" or "newtab" and the current buffer
1884 if (wp == NULL && vim_strchr(p_swb, 'l') != NULL && !bufempty()) 1887 * isn't empty: open new window */
1885 { 1888 if (wp == NULL && (swb_flags & (SWB_SPLIT | SWB_NEWTAB)) && !bufempty())
1886 if (win_split(0, 0) == FAIL) 1889 {
1890 if (swb_flags & SWB_NEWTAB) /* Open in a new tab */
1891 tabpage_new();
1892 else if (win_split(0, 0) == FAIL) /* Open in a new window */
1887 return FAIL; 1893 return FAIL;
1888 # ifdef FEAT_SCROLLBIND 1894 # ifdef FEAT_SCROLLBIND
1889 curwin->w_p_scb = FALSE; 1895 curwin->w_p_scb = FALSE;
1890 # endif 1896 # endif
1891 } 1897 }
4021 } 4027 }
4022 else 4028 else
4023 #endif 4029 #endif
4024 n = width - maxwidth + 1; 4030 n = width - maxwidth + 1;
4025 p = s + n; 4031 p = s + n;
4026 mch_memmove(s + 1, p, STRLEN(p) + 1); 4032 STRMOVE(s + 1, p);
4027 *s = '<'; 4033 *s = '<';
4028 4034
4029 /* Fill up for half a double-wide character. */ 4035 /* Fill up for half a double-wide character. */
4030 while (++width < maxwidth) 4036 while (++width < maxwidth)
4031 { 4037 {
4052 if (item[l].type == Middle) 4058 if (item[l].type == Middle)
4053 break; 4059 break;
4054 if (l < itemcnt) 4060 if (l < itemcnt)
4055 { 4061 {
4056 p = item[l].start + maxwidth - width; 4062 p = item[l].start + maxwidth - width;
4057 mch_memmove(p, item[l].start, STRLEN(item[l].start) + 1); 4063 STRMOVE(p, item[l].start);
4058 for (s = item[l].start; s < p; s++) 4064 for (s = item[l].start; s < p; s++)
4059 *s = fillchar; 4065 *s = fillchar;
4060 for (l++; l < itemcnt; l++) 4066 for (l++; l < itemcnt; l++)
4061 item[l].start += maxwidth - width; 4067 item[l].start += maxwidth - width;
4062 width = maxwidth; 4068 width = maxwidth;
4865 * Find end of set command: ':' or end of line. 4871 * Find end of set command: ':' or end of line.
4866 * Skip over "\:", replacing it with ":". 4872 * Skip over "\:", replacing it with ":".
4867 */ 4873 */
4868 for (e = s; *e != ':' && *e != NUL; ++e) 4874 for (e = s; *e != ':' && *e != NUL; ++e)
4869 if (e[0] == '\\' && e[1] == ':') 4875 if (e[0] == '\\' && e[1] == ':')
4870 mch_memmove(e, e + 1, STRLEN(e)); 4876 STRMOVE(e, e + 1);
4871 if (*e == NUL) 4877 if (*e == NUL)
4872 end = TRUE; 4878 end = TRUE;
4873 4879
4874 /* 4880 /*
4875 * If there is a "set" command, require a terminating ':' and 4881 * If there is a "set" command, require a terminating ':' and