patch 9.1.1425: tabpanel: there are still some problems with the tabpanel
Problem: tabpanel: there are still some problems with the tabpanel with
column handling
Solution: fix the problems and refactor Tabpanel feature (Hirohito
Higashi).
fixes: #17423
fixes: #17332
closes: #17336
Signed-off-by: Hirohito Higashi <h.east.727@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
6c40df09e0
commit
3b9b95dc63
104
src/screen.c
104
src/screen.c
@ -156,13 +156,13 @@ screen_fill_end(
|
||||
if (wp->w_p_rl)
|
||||
{
|
||||
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
|
||||
W_ENDCOL(wp) - nn + TPL_LCOL(wp), (int)W_ENDCOL(wp) - off + TPL_LCOL(wp),
|
||||
W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - off,
|
||||
c1, c2, attr);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
|
||||
wp->w_wincol + off + TPL_LCOL(wp), (int)wp->w_wincol + nn + TPL_LCOL(wp),
|
||||
wp->w_wincol + off, (int)wp->w_wincol + nn,
|
||||
c1, c2, attr);
|
||||
return nn;
|
||||
}
|
||||
@ -215,18 +215,15 @@ win_draw_end(
|
||||
if (wp->w_p_rl)
|
||||
{
|
||||
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
|
||||
wp->w_wincol + TPL_LCOL(wp), W_ENDCOL(wp) - 1 - n +
|
||||
TPL_LCOL(wp), c2, c2, attr);
|
||||
wp->w_wincol, W_ENDCOL(wp) - 1 - n, c2, c2, attr);
|
||||
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
|
||||
W_ENDCOL(wp) - 1 - n + TPL_LCOL(wp), W_ENDCOL(wp) - n +
|
||||
TPL_LCOL(wp), c1, c2, attr);
|
||||
W_ENDCOL(wp) - 1 - n, W_ENDCOL(wp) - n, c1, c2, attr);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
{
|
||||
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow,
|
||||
wp->w_wincol + n + TPL_LCOL(wp), (int)W_ENDCOL(wp) + TPL_LCOL(wp),
|
||||
c1, c2, attr);
|
||||
wp->w_wincol + n, (int)W_ENDCOL(wp), c1, c2, attr);
|
||||
}
|
||||
|
||||
set_empty_rows(wp, row);
|
||||
@ -369,6 +366,9 @@ char_needs_redraw(int off_from, int off_to, int cols)
|
||||
&& ScreenLines[off_from + 1]
|
||||
!= ScreenLines[off_to + 1])))))
|
||||
return TRUE;
|
||||
// TODO: This is a temporary solution until the root cause is fixed.
|
||||
if (firstwin->w_wincol > 0)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@ -395,9 +395,7 @@ blocked_by_popup(int row, int col)
|
||||
|
||||
if (!popup_visible)
|
||||
return FALSE;
|
||||
if (col < TPL_LCOL(NULL))
|
||||
return FALSE;
|
||||
off = row * screen_Columns + col - TPL_LCOL(NULL);
|
||||
off = row * screen_Columns + col;
|
||||
return popup_mask[off] > screen_zindex || popup_transparent[off];
|
||||
}
|
||||
#endif
|
||||
@ -857,7 +855,7 @@ screen_line(
|
||||
{
|
||||
// For a window that has a right neighbor, draw the separator char
|
||||
// right of the window contents. But not on top of a popup window.
|
||||
if (coloff + col < TPL_LCOL(NULL) + COLUMNS_WITHOUT_TPL())
|
||||
if (coloff + col < firstwin->w_wincol + topframe->fr_width)
|
||||
{
|
||||
if (!skip_for_popup(row, col + coloff))
|
||||
{
|
||||
@ -922,14 +920,10 @@ draw_vsep_win(win_T *wp, int row)
|
||||
if (!wp->w_vsep_width)
|
||||
return;
|
||||
|
||||
if (COLUMNS_WITHOUT_TPL() <= W_ENDCOL(wp) + 1)
|
||||
return;
|
||||
|
||||
// draw the vertical separator right of this window
|
||||
c = fillchar_vsep(&hl, wp);
|
||||
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height,
|
||||
W_ENDCOL(wp) + TPL_LCOL(wp), W_ENDCOL(wp) + 1 + TPL_LCOL(wp),
|
||||
c, ' ', hl);
|
||||
W_ENDCOL(wp), W_ENDCOL(wp) + 1, c, ' ', hl);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1056,9 +1050,10 @@ win_redr_custom(
|
||||
// Use 'tabline'. Always at the first line of the screen.
|
||||
stl = p_tal;
|
||||
row = 0;
|
||||
col = firstwin->w_wincol;
|
||||
fillchar = ' ';
|
||||
attr = HL_ATTR(HLF_TPF);
|
||||
maxwidth = COLUMNS_WITHOUT_TPL();
|
||||
maxwidth = topframe->fr_width;
|
||||
opt_name = (char_u *)"tabline";
|
||||
}
|
||||
else
|
||||
@ -1155,7 +1150,7 @@ win_redr_custom(
|
||||
for (n = 0; hltab[n].start != NULL; n++)
|
||||
{
|
||||
len = (int)(hltab[n].start - p);
|
||||
screen_puts_len(p, len, row, col + TPL_LCOL(wp), curattr);
|
||||
screen_puts_len(p, len, row, col, curattr);
|
||||
col += vim_strnsize(p, len);
|
||||
p = hltab[n].start;
|
||||
|
||||
@ -1176,12 +1171,12 @@ win_redr_custom(
|
||||
else
|
||||
curattr = highlight_user[hltab[n].userhl - 1];
|
||||
}
|
||||
screen_puts(p, row, col + TPL_LCOL(wp), curattr);
|
||||
screen_puts(p, row, col, curattr);
|
||||
|
||||
if (wp == NULL)
|
||||
{
|
||||
// Fill the TabPageIdxs[] array for clicking in the tab pagesline.
|
||||
col = 0;
|
||||
col = firstwin->w_wincol;
|
||||
len = 0;
|
||||
p = buf;
|
||||
fillchar = 0;
|
||||
@ -1193,7 +1188,7 @@ win_redr_custom(
|
||||
p = tabtab[n].start;
|
||||
fillchar = tabtab[n].userhl;
|
||||
}
|
||||
while (col < COLUMNS_WITHOUT_TPL())
|
||||
while (col < Columns)
|
||||
TabPageIdxs[col++] = fillchar;
|
||||
}
|
||||
|
||||
@ -2132,15 +2127,15 @@ redraw_block(int row, int end, win_T *wp)
|
||||
|
||||
if (wp == NULL)
|
||||
{
|
||||
col = 0;
|
||||
width = COLUMNS_WITHOUT_TPL();
|
||||
col = firstwin->w_wincol;
|
||||
width = topframe->fr_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
col = wp->w_wincol;
|
||||
width = wp->w_width;
|
||||
}
|
||||
screen_draw_rectangle(row, col + TPL_LCOL(wp), end - row, width, FALSE);
|
||||
screen_draw_rectangle(row, col, end - row, width, FALSE);
|
||||
}
|
||||
|
||||
void
|
||||
@ -2918,11 +2913,6 @@ linecopy(int to, int from, win_T *wp)
|
||||
unsigned off_to = LineOffset[to] + wp->w_wincol;
|
||||
unsigned off_from = LineOffset[from] + wp->w_wincol;
|
||||
|
||||
#if defined(FEAT_TABPANEL)
|
||||
off_to += TPL_LCOL(wp);
|
||||
off_from += TPL_LCOL(wp);
|
||||
#endif
|
||||
|
||||
mch_memmove(ScreenLines + off_to, ScreenLines + off_from,
|
||||
wp->w_width * sizeof(schar_T));
|
||||
if (enc_utf8)
|
||||
@ -3256,7 +3246,7 @@ setcursor_mayforce(int force)
|
||||
&& (*mb_ptr2cells)(ml_get_cursor()) == 2
|
||||
&& vim_isprintc(gchar_cursor())) ? 2 : 1)) :
|
||||
#endif
|
||||
curwin->w_wcol) + TPL_LCOL(NULL));
|
||||
curwin->w_wcol));
|
||||
}
|
||||
}
|
||||
|
||||
@ -3326,8 +3316,7 @@ win_ins_lines(
|
||||
if (lastrow > Rows)
|
||||
lastrow = Rows;
|
||||
screen_fill(nextrow - line_count, lastrow - line_count,
|
||||
wp->w_wincol + TPL_LCOL(wp), (int)W_ENDCOL(wp) + TPL_LCOL(wp),
|
||||
' ', ' ', 0);
|
||||
wp->w_wincol, (int)W_ENDCOL(wp), ' ', ' ', 0);
|
||||
}
|
||||
|
||||
if (screen_ins_lines(0, W_WINROW(wp) + row, line_count, (int)Rows, 0, NULL)
|
||||
@ -3425,7 +3414,7 @@ win_do_lines(
|
||||
|
||||
// only a few lines left: redraw is faster
|
||||
if (mayclear && Rows - line_count < 5
|
||||
&& wp->w_width == COLUMNS_WITHOUT_TPL())
|
||||
&& wp->w_width == topframe->fr_width)
|
||||
{
|
||||
if (!no_win_do_lines_ins)
|
||||
screenclear(); // will set wp->w_lines_valid to 0
|
||||
@ -3442,8 +3431,7 @@ win_do_lines(
|
||||
if (row + line_count >= wp->w_height)
|
||||
{
|
||||
screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height,
|
||||
wp->w_wincol + TPL_LCOL(wp), (int)W_ENDCOL(wp) + TPL_LCOL(wp),
|
||||
' ', ' ', 0);
|
||||
wp->w_wincol, (int)W_ENDCOL(wp), ' ', ' ', 0);
|
||||
return OK;
|
||||
}
|
||||
|
||||
@ -3464,9 +3452,9 @@ win_do_lines(
|
||||
* a character in the lower right corner of the scroll region may cause a
|
||||
* scroll-up .
|
||||
*/
|
||||
if (scroll_region || wp->w_width != COLUMNS_WITHOUT_TPL())
|
||||
if (scroll_region || wp->w_width != topframe->fr_width)
|
||||
{
|
||||
if (scroll_region && (wp->w_width == COLUMNS_WITHOUT_TPL()
|
||||
if (scroll_region && (wp->w_width == topframe->fr_width
|
||||
|| *T_CSV != NUL))
|
||||
scroll_region_set(wp, row);
|
||||
if (del)
|
||||
@ -3475,7 +3463,7 @@ win_do_lines(
|
||||
else
|
||||
retval = screen_ins_lines(W_WINROW(wp) + row, 0, line_count,
|
||||
wp->w_height - row, clear_attr, wp);
|
||||
if (scroll_region && (wp->w_width == COLUMNS_WITHOUT_TPL()
|
||||
if (scroll_region && (wp->w_width == topframe->fr_width
|
||||
|| *T_CSV != NUL))
|
||||
scroll_region_reset();
|
||||
return retval;
|
||||
@ -3599,7 +3587,7 @@ screen_ins_lines(
|
||||
* exists.
|
||||
*/
|
||||
result_empty = (row + line_count >= end);
|
||||
if (wp != NULL && wp->w_width != COLUMNS_WITHOUT_TPL() && *T_CSV == NUL)
|
||||
if (wp != NULL && wp->w_width != topframe->fr_width && *T_CSV == NUL)
|
||||
{
|
||||
// Avoid that lines are first cleared here and then redrawn, which
|
||||
// results in many characters updated twice. This happens with CTRL-F
|
||||
@ -3645,7 +3633,7 @@ screen_ins_lines(
|
||||
#ifdef FEAT_CLIPBOARD
|
||||
// Remove a modeless selection when inserting lines halfway the screen
|
||||
// or not the full width of the screen.
|
||||
if (off + row > 0 || (wp != NULL && wp->w_width != COLUMNS_WITHOUT_TPL()))
|
||||
if (off + row > 0 || (wp != NULL && wp->w_width != topframe->fr_width))
|
||||
clip_clear_selection(&clip_star);
|
||||
else
|
||||
clip_scroll_selection(-line_count);
|
||||
@ -3677,7 +3665,7 @@ screen_ins_lines(
|
||||
end += off;
|
||||
for (i = 0; i < line_count; ++i)
|
||||
{
|
||||
if (wp != NULL && wp->w_width != COLUMNS_WITHOUT_TPL())
|
||||
if (wp != NULL && wp->w_width != topframe->fr_width)
|
||||
{
|
||||
// need to copy part of a line
|
||||
j = end - 1 - i;
|
||||
@ -3685,11 +3673,10 @@ screen_ins_lines(
|
||||
linecopy(j + line_count, j, wp);
|
||||
j += line_count;
|
||||
if (can_clear((char_u *)" "))
|
||||
lineclear(LineOffset[j] + wp->w_wincol + TPL_LCOL(wp),
|
||||
lineclear(LineOffset[j] + wp->w_wincol,
|
||||
wp->w_width, clear_attr);
|
||||
else
|
||||
lineinvalid(LineOffset[j] + wp->w_wincol + TPL_LCOL(wp),
|
||||
wp->w_width);
|
||||
lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width);
|
||||
LineWraps[j] = FALSE;
|
||||
}
|
||||
else
|
||||
@ -3704,10 +3691,9 @@ screen_ins_lines(
|
||||
LineOffset[j + line_count] = temp;
|
||||
LineWraps[j + line_count] = FALSE;
|
||||
if (can_clear((char_u *)" "))
|
||||
lineclear(temp + TPL_LCOL(wp), COLUMNS_WITHOUT_TPL(),
|
||||
clear_attr);
|
||||
lineclear(temp, topframe->fr_width, clear_attr);
|
||||
else
|
||||
lineinvalid(temp + TPL_LCOL(wp), COLUMNS_WITHOUT_TPL());
|
||||
lineinvalid(temp, topframe->fr_width);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3840,7 +3826,7 @@ screen_del_lines(
|
||||
* 5. Use T_DL (delete line) if it exists.
|
||||
* 6. redraw the characters from ScreenLines[].
|
||||
*/
|
||||
if (wp != NULL && wp->w_width != COLUMNS_WITHOUT_TPL() && *T_CSV == NUL)
|
||||
if (wp != NULL && wp->w_width != topframe->fr_width && *T_CSV == NUL)
|
||||
{
|
||||
// Avoid that lines are first cleared here and then redrawn, which
|
||||
// results in many characters updated twice. This happens with CTRL-F
|
||||
@ -3863,7 +3849,7 @@ screen_del_lines(
|
||||
else if (*T_CDL != NUL && line_count > 1 && can_delete)
|
||||
type = USE_T_CDL;
|
||||
else if (can_clear(T_CE) && result_empty
|
||||
&& (wp == NULL || wp->w_width == COLUMNS_WITHOUT_TPL()))
|
||||
&& (wp == NULL || wp->w_width == topframe->fr_width))
|
||||
type = USE_T_CE;
|
||||
else if (*T_DL != NUL && can_delete)
|
||||
type = USE_T_DL;
|
||||
@ -3875,7 +3861,7 @@ screen_del_lines(
|
||||
#ifdef FEAT_CLIPBOARD
|
||||
// Remove a modeless selection when deleting lines halfway the screen or
|
||||
// not the full width of the screen.
|
||||
if (off + row > 0 || (wp != NULL && wp->w_width != COLUMNS_WITHOUT_TPL()))
|
||||
if (off + row > 0 || (wp != NULL && wp->w_width != topframe->fr_width))
|
||||
clip_clear_selection(&clip_star);
|
||||
else
|
||||
clip_scroll_selection(line_count);
|
||||
@ -3914,7 +3900,7 @@ screen_del_lines(
|
||||
end += off;
|
||||
for (i = 0; i < line_count; ++i)
|
||||
{
|
||||
if (wp != NULL && wp->w_width != COLUMNS_WITHOUT_TPL())
|
||||
if (wp != NULL && wp->w_width != topframe->fr_width)
|
||||
{
|
||||
// need to copy part of a line
|
||||
j = row + i;
|
||||
@ -3922,11 +3908,10 @@ screen_del_lines(
|
||||
linecopy(j - line_count, j, wp);
|
||||
j -= line_count;
|
||||
if (can_clear((char_u *)" "))
|
||||
lineclear(LineOffset[j] + wp->w_wincol + TPL_LCOL(wp),
|
||||
lineclear(LineOffset[j] + wp->w_wincol,
|
||||
wp->w_width, clear_attr);
|
||||
else
|
||||
lineinvalid(LineOffset[j] + wp->w_wincol + TPL_LCOL(wp),
|
||||
wp->w_width);
|
||||
lineinvalid(LineOffset[j] + wp->w_wincol, wp->w_width);
|
||||
LineWraps[j] = FALSE;
|
||||
}
|
||||
else
|
||||
@ -3942,10 +3927,9 @@ screen_del_lines(
|
||||
LineOffset[j - line_count] = temp;
|
||||
LineWraps[j - line_count] = FALSE;
|
||||
if (can_clear((char_u *)" "))
|
||||
lineclear(temp + TPL_LCOL(NULL), COLUMNS_WITHOUT_TPL(),
|
||||
clear_attr);
|
||||
lineclear(temp, (int)Columns, clear_attr);
|
||||
else
|
||||
lineinvalid(temp + TPL_LCOL(NULL), COLUMNS_WITHOUT_TPL());
|
||||
lineinvalid(temp, (int)Columns);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4333,7 +4317,7 @@ draw_tabline(void)
|
||||
);
|
||||
|
||||
#if defined(FEAT_TABPANEL)
|
||||
col = TPL_LCOL(NULL);
|
||||
col = firstwin->w_wincol;
|
||||
#endif
|
||||
|
||||
if (ScreenLines == NULL)
|
||||
@ -4364,7 +4348,7 @@ draw_tabline(void)
|
||||
FOR_ALL_TABPAGES(tp)
|
||||
++tabcount;
|
||||
|
||||
tabwidth = (COLUMNS_WITHOUT_TPL() - 1 + tabcount / 2) / tabcount;
|
||||
tabwidth = (topframe->fr_width - 1 + tabcount / 2) / tabcount;
|
||||
if (tabwidth < 6)
|
||||
tabwidth = 6;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user