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>
diff --git a/src/tabpanel.c b/src/tabpanel.c
index 599e434..3845faa 100644
--- a/src/tabpanel.c
+++ b/src/tabpanel.c
@@ -164,7 +164,7 @@
     int		row = 0;
     int		off = 0;
 #endif
-int		vsrow = 0;
+    int		vsrow = 0;
     int		is_right = tpl_align == ALIGN_RIGHT;
 
     if (maxwidth == 0)
@@ -198,14 +198,10 @@
 		    maxwidth - VERT_LEN, &curtab_row, NULL);
 	    do_by_tplmode(TPLMODE_REDRAW, VERT_LEN, maxwidth, &curtab_row,
 		    NULL);
-	    // clear for multi-byte vert separater
-	    screen_fill(0, cmdline_row, COLUMNS_WITHOUT_TPL(),
-		    COLUMNS_WITHOUT_TPL() + VERT_LEN,
-		    TPL_FILLCHAR, TPL_FILLCHAR, vs_attr);
-	    // draw vert separater in tabpanel
+	    // draw vert separator in tabpanel
 	    for (vsrow = 0; vsrow < cmdline_row; vsrow++)
 		screen_putchar(curwin->w_fill_chars.tpl_vert, vsrow,
-			COLUMNS_WITHOUT_TPL(), vs_attr);
+			topframe->fr_width, vs_attr);
 	}
 	else
 	{
@@ -214,10 +210,7 @@
 		    &curtab_row, NULL);
 	    do_by_tplmode(TPLMODE_REDRAW, 0, maxwidth - VERT_LEN,
 		    &curtab_row, NULL);
-	    // clear for multi-byte vert separater
-	    screen_fill(0, cmdline_row, maxwidth - VERT_LEN,
-		    maxwidth, TPL_FILLCHAR, TPL_FILLCHAR, vs_attr);
-	    // draw vert separater in tabpanel
+	    // draw vert separator in tabpanel
 	    for (vsrow = 0; vsrow < cmdline_row; vsrow++)
 		screen_putchar(curwin->w_fill_chars.tpl_vert, vsrow,
 			maxwidth - VERT_LEN, vs_attr);
@@ -272,8 +265,8 @@
     int is_right = tpl_align == ALIGN_RIGHT;
     if (tplmode == TPLMODE_REDRAW)
 	screen_fill(row_start, row_end,
-		(is_right ? COLUMNS_WITHOUT_TPL() : 0) + col_start,
-		(is_right ? COLUMNS_WITHOUT_TPL() : 0) + col_end,
+		(is_right ? topframe->fr_width : 0) + col_start,
+		(is_right ? topframe->fr_width : 0) + col_end,
 		TPL_FILLCHAR, TPL_FILLCHAR, attr);
 }
 
@@ -356,7 +349,7 @@
 	    if (*pargs->pcol + chcells <= pargs->col_end)
 	    {
 		int off = (tpl_align == ALIGN_RIGHT)
-			? COLUMNS_WITHOUT_TPL()
+			? topframe->fr_width
 			: 0;
 		if (TPLMODE_REDRAW == tplmode
 			&& (*pargs->prow - pargs->offsetrow >= 0
@@ -628,7 +621,7 @@
 		    p++;
 		}
 
-		while (p[i] != '\n' && p[i] != '\r' && (p[i] != NUL))
+		while (p[i] != '\n' && p[i] != '\r' && p[i] != NUL)
 		{
 		    if (i + 1 >= sizeof(buf))
 			break;