summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/buffer.c7
-rw-r--r--src/gui.c30
-rw-r--r--src/mark.c58
-rw-r--r--src/proto/gui_gtk_x11.pro1
-rw-r--r--src/proto/mark.pro2
5 files changed, 77 insertions, 21 deletions
diff --git a/src/buffer.c b/src/buffer.c
index 5d3ddd62f..4e5e0370f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3633,7 +3633,7 @@ build_stl_str_hl(wp, out, outlen, fmt, use_sandbox, fillchar, maxwidth, hltab, t
str = tmp;
break;
case STL_PAGENUM:
-#if defined(FEAT_PRINTER) || defined(FEAT_WINDOWS)
+#if defined(FEAT_PRINTER) || defined(FEAT_GUI_TABLINE)
num = printer_page_num;
#else
num = 0;
@@ -4448,16 +4448,17 @@ ex_buffer_all(eap)
for (wp = firstwin; wp != NULL; wp = wpnext)
{
wpnext = wp->w_next;
- if (wp->w_buffer->b_nwindows > 1
+ if ((wp->w_buffer->b_nwindows > 1
#ifdef FEAT_VERTSPLIT
|| ((cmdmod.split & WSP_VERT)
? wp->w_height + wp->w_status_height < Rows - p_ch
+ - tabline_height()
: wp->w_width != Columns)
#endif
#ifdef FEAT_WINDOWS
|| (had_tab > 0 && wp != firstwin)
#endif
- )
+ ) && firstwin != lastwin)
{
win_close(wp, FALSE);
#ifdef FEAT_AUTOCMD
diff --git a/src/gui.c b/src/gui.c
index 7b6e38bdb..0a2286bf7 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -3097,7 +3097,6 @@ gui_init_which_components(oldval)
int using_toolbar = FALSE;
#endif
#ifdef FEAT_GUI_TABLINE
- static int prev_has_tabline = FALSE;
int using_tabline;
#endif
#ifdef FEAT_FOOTER
@@ -3199,9 +3198,8 @@ gui_init_which_components(oldval)
/* 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 (prev_has_tabline != using_tabline)
+ if (!gui_mch_showing_tabline() != !using_tabline)
{
- prev_has_tabline = using_tabline;
gui_update_tabline();
need_set_size = TRUE;
if (using_tabline)
@@ -3369,6 +3367,7 @@ get_tabline_label(tp)
int use_sandbox = FALSE;
int save_called_emsg = called_emsg;
char_u res[MAXPATHL];
+ tabpage_T *save_curtab;
called_emsg = FALSE;
@@ -3377,12 +3376,31 @@ get_tabline_label(tp)
set_vim_var_nr(VV_LNUM, printer_page_num);
use_sandbox = was_set_insecurely((char_u *)"guitablabel", 0);
# endif
+ /* It's almost as going to the tabpage, but without autocommands. */
+ curtab->tp_firstwin = firstwin;
+ curtab->tp_lastwin = lastwin;
+ curtab->tp_curwin = curwin;
+ save_curtab = curtab;
+ curtab = tp;
+ topframe = curtab->tp_topframe;
+ firstwin = curtab->tp_firstwin;
+ lastwin = curtab->tp_lastwin;
+ curwin = curtab->tp_curwin;
+ curbuf = curwin->w_buffer;
+
/* Can't use NameBuff directly, build_stl_str_hl() uses it. */
- build_stl_str_hl(tp == curtab ? curwin : tp->tp_curwin,
- res, MAXPATHL, p_gtl, use_sandbox,
- 0, (int)Columns, NULL, NULL);
+ build_stl_str_hl(curwin, res, MAXPATHL, p_gtl, use_sandbox,
+ 0, (int)Columns, NULL, NULL);
STRCPY(NameBuff, res);
+ /* Back to the original curtab. */
+ curtab = save_curtab;
+ topframe = curtab->tp_topframe;
+ firstwin = curtab->tp_firstwin;
+ lastwin = curtab->tp_lastwin;
+ curwin = curtab->tp_curwin;
+ curbuf = curwin->w_buffer;
+
if (called_emsg)
set_string_option_direct((char_u *)"guitablabel", -1,
(char_u *)"", OPT_FREE, SID_ERROR);
diff --git a/src/mark.c b/src/mark.c
index 98550b3d9..8a3d108d6 100644
--- a/src/mark.c
+++ b/src/mark.c
@@ -39,13 +39,27 @@ static void write_one_filemark __ARGS((FILE *fp, xfmark_T *fm, int c1, int c2));
#endif
/*
- * Set named mark 'c' at current cursor position.
+ * Set named mark "c" at current cursor position.
* Returns OK on success, FAIL if bad name given.
*/
int
setmark(c)
int c;
{
+ return setmark_pos(c, &curwin->w_cursor, curbuf->b_fnum);
+}
+
+/*
+ * Set named mark "c" to position "pos".
+ * When "c" is upper case use file "fnum".
+ * Returns OK on success, FAIL if bad name given.
+ */
+ int
+setmark_pos(c, pos, fnum)
+ int c;
+ pos_T *pos;
+ int fnum;
+{
int i;
/* Check for a special key (may cause islower() to crash). */
@@ -54,9 +68,14 @@ setmark(c)
if (c == '\'' || c == '`')
{
- setpcmark();
- /* keep it even when the cursor doesn't move */
- curwin->w_prev_pcmark = curwin->w_pcmark;
+ if (pos == &curwin->w_cursor)
+ {
+ setpcmark();
+ /* keep it even when the cursor doesn't move */
+ curwin->w_prev_pcmark = curwin->w_pcmark;
+ }
+ else
+ curwin->w_pcmark = *pos;
return OK;
}
@@ -64,12 +83,12 @@ setmark(c)
* file. */
if (c == '[')
{
- curbuf->b_op_start = curwin->w_cursor;
+ curbuf->b_op_start = *pos;
return OK;
}
if (c == ']')
{
- curbuf->b_op_end = curwin->w_cursor;
+ curbuf->b_op_end = *pos;
return OK;
}
@@ -81,14 +100,14 @@ setmark(c)
if (islower(c))
{
i = c - 'a';
- curbuf->b_namedm[i] = curwin->w_cursor;
+ curbuf->b_namedm[i] = *pos;
return OK;
}
if (isupper(c))
{
i = c - 'A';
- namedfm[i].fmark.mark = curwin->w_cursor;
- namedfm[i].fmark.fnum = curbuf->b_fnum;
+ namedfm[i].fmark.mark = *pos;
+ namedfm[i].fmark.fnum = fnum;
vim_free(namedfm[i].fname);
namedfm[i].fname = NULL;
return OK;
@@ -267,6 +286,9 @@ movechangelist(count)
/*
* Find mark "c".
+ * If "changefile" is TRUE it's allowed to edit another file for '0, 'A, etc.
+ * If "fnum" is not NULL store the fnum there for '0, 'A etc., don't edit
+ * another file.
* Returns:
* - pointer to pos_T if found. lnum is 0 when mark not set, -1 when mark is
* in another file which can't be gotten. (caller needs to check lnum!)
@@ -276,7 +298,16 @@ movechangelist(count)
pos_T *
getmark(c, changefile)
int c;
- int changefile; /* allowed to edit another file */
+ int changefile;
+{
+ return getmark_fnum(c, changefile, NULL);
+}
+
+ pos_T *
+getmark_fnum(c, changefile, fnum)
+ int c;
+ int changefile;
+ int *fnum;
{
pos_T *posp;
#ifdef FEAT_VISUAL
@@ -382,11 +413,14 @@ getmark(c, changefile)
if (namedfm[c].fmark.fnum == 0)
fname2fnum(&namedfm[c]);
- if (namedfm[c].fmark.fnum != curbuf->b_fnum)
+
+ if (fnum != NULL)
+ *fnum = namedfm[c].fmark.fnum;
+ else if (namedfm[c].fmark.fnum != curbuf->b_fnum)
{
+ /* mark is in another file */
posp = &pos_copy;
- /* mark is in another file */
if (namedfm[c].fmark.mark.lnum != 0
&& changefile && namedfm[c].fmark.fnum)
{
diff --git a/src/proto/gui_gtk_x11.pro b/src/proto/gui_gtk_x11.pro
index 30bde6a13..afb384eb3 100644
--- a/src/proto/gui_gtk_x11.pro
+++ b/src/proto/gui_gtk_x11.pro
@@ -6,6 +6,7 @@ void gui_mch_stop_blink __ARGS((void));
void gui_mch_start_blink __ARGS((void));
int gui_mch_init_check __ARGS((void));
void gui_mch_show_tabline __ARGS((int showit));
+int gui_mch_showing_tabline __ARGS((void));
void gui_mch_update_tabline __ARGS((void));
void gui_mch_set_curtab __ARGS((int nr));
int gui_mch_init __ARGS((void));
diff --git a/src/proto/mark.pro b/src/proto/mark.pro
index 040f08bc0..13e186899 100644
--- a/src/proto/mark.pro
+++ b/src/proto/mark.pro
@@ -1,10 +1,12 @@
/* mark.c */
int setmark __ARGS((int c));
+int setmark_pos __ARGS((int c, pos_T *pos, int fnum));
void setpcmark __ARGS((void));
void checkpcmark __ARGS((void));
pos_T *movemark __ARGS((int count));
pos_T *movechangelist __ARGS((int count));
pos_T *getmark __ARGS((int c, int changefile));
+pos_T *getmark_fnum __ARGS((int c, int changefile, int *fnum));
pos_T *getnextmark __ARGS((pos_T *startpos, int dir, int begin_line));
void fmarks_check_names __ARGS((buf_T *buf));
int check_mark __ARGS((pos_T *pos));