Skip to content

Commit bd66693

Browse files
committed
Implemented right side feature.
1 parent ee4923e commit bd66693

File tree

3 files changed

+1606
-70
lines changed

3 files changed

+1606
-70
lines changed

Terminal.Gui/Views/TabView/TabRow.cs

Lines changed: 257 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,14 @@ private void RenderTabLineCanvas ()
204204

205205
break;
206206
case TabSide.Right:
207+
// Upper horizontal line
208+
lc.AddLine (
209+
new (vts.X - 1, vts.Y - 1),
210+
-1,
211+
Orientation.Horizontal,
212+
tab.BorderStyle
213+
);
214+
207215
break;
208216
default:
209217
throw new ArgumentOutOfRangeException ();
@@ -268,6 +276,24 @@ private void RenderTabLineCanvas ()
268276

269277
break;
270278
case TabSide.Right:
279+
if (Frame.Bottom > tab.Frame.Bottom)
280+
{
281+
// LRCorner
282+
lc.AddLine (
283+
new (vts.X - 1, vts.Bottom),
284+
1,
285+
Orientation.Vertical,
286+
tab.BorderStyle
287+
);
288+
289+
lc.AddLine (
290+
new (vts.X - 1, vts.Bottom),
291+
1,
292+
Orientation.Horizontal,
293+
tab.BorderStyle
294+
);
295+
}
296+
271297
break;
272298
default:
273299
throw new ArgumentOutOfRangeException ();
@@ -329,6 +355,21 @@ private void RenderTabLineCanvas ()
329355

330356
break;
331357
case TabSide.Right:
358+
// Upper left tee
359+
lc.AddLine (
360+
new (vts.Right, vts.Y - 1),
361+
0,
362+
Orientation.Vertical,
363+
tab.BorderStyle
364+
);
365+
366+
lc.AddLine (
367+
new (vts.Right, vts.Y - 1),
368+
-1,
369+
Orientation.Horizontal,
370+
tab.BorderStyle
371+
);
372+
332373
break;
333374
default:
334375
throw new ArgumentOutOfRangeException ();
@@ -394,6 +435,21 @@ private void RenderTabLineCanvas ()
394435

395436
break;
396437
case TabSide.Right:
438+
// Upper right tee
439+
lc.AddLine (
440+
new (vts.Right, vts.Bottom),
441+
0,
442+
Orientation.Vertical,
443+
tab.BorderStyle
444+
);
445+
446+
lc.AddLine (
447+
new (vts.Right, vts.Bottom),
448+
-1,
449+
Orientation.Horizontal,
450+
tab.BorderStyle
451+
);
452+
397453
break;
398454
default:
399455
throw new ArgumentOutOfRangeException ();
@@ -458,6 +514,24 @@ private void RenderTabLineCanvas ()
458514

459515
break;
460516
case TabSide.Right:
517+
if (Frame.Bottom > tab.Frame.Bottom)
518+
{
519+
//LRCorner
520+
lc.AddLine (
521+
new (vts.X - 1, vts.Bottom),
522+
1,
523+
Orientation.Vertical,
524+
tab.BorderStyle
525+
);
526+
527+
lc.AddLine (
528+
new (vts.X - 1, vts.Bottom),
529+
1,
530+
Orientation.Horizontal,
531+
tab.BorderStyle
532+
);
533+
}
534+
461535
break;
462536
default:
463537
throw new ArgumentOutOfRangeException ();
@@ -656,6 +730,39 @@ private void RenderTabLineCanvas ()
656730

657731
break;
658732
case TabSide.Right:
733+
if (_host.Style.ShowInitialLine || _host.Style.TabsSide == TabSide.Right)
734+
{
735+
// Upper left tee
736+
lc.AddLine (
737+
new (vts.Right, vts.Y - 1),
738+
0,
739+
Orientation.Vertical,
740+
tab.BorderStyle
741+
);
742+
743+
lc.AddLine (
744+
new (vts.Right, vts.Y - 1),
745+
-1,
746+
Orientation.Horizontal,
747+
tab.BorderStyle
748+
);
749+
}
750+
751+
// Lower left tee
752+
lc.AddLine (
753+
new (vts.X - 1, vts.Y - 1),
754+
0,
755+
Orientation.Vertical,
756+
tab.BorderStyle
757+
);
758+
759+
lc.AddLine (
760+
new (vts.X - 1, vts.Y - 1),
761+
1,
762+
Orientation.Horizontal,
763+
tab.BorderStyle
764+
);
765+
659766
break;
660767
default:
661768
throw new ArgumentOutOfRangeException ();
@@ -704,6 +811,21 @@ private void RenderTabLineCanvas ()
704811

705812
break;
706813
case TabSide.Right:
814+
// Upper right tee
815+
lc.AddLine (
816+
new (vts.X - 1, vts.Bottom),
817+
0,
818+
Orientation.Vertical,
819+
tab.BorderStyle
820+
);
821+
822+
lc.AddLine (
823+
new (vts.X - 1, vts.Bottom),
824+
1,
825+
Orientation.Horizontal,
826+
tab.BorderStyle
827+
);
828+
707829
break;
708830
default:
709831
throw new ArgumentOutOfRangeException ();
@@ -750,6 +872,21 @@ private void RenderTabLineCanvas ()
750872

751873
break;
752874
case TabSide.Right:
875+
// Lower right tee
876+
lc.AddLine (
877+
new (vts.Right, vts.Bottom),
878+
0,
879+
Orientation.Vertical,
880+
tab.BorderStyle
881+
);
882+
883+
lc.AddLine (
884+
new (vts.Right, vts.Bottom),
885+
-1,
886+
Orientation.Horizontal,
887+
tab.BorderStyle
888+
);
889+
753890
break;
754891
default:
755892
throw new ArgumentOutOfRangeException ();
@@ -874,6 +1011,21 @@ private void RenderTabLineCanvas ()
8741011

8751012
break;
8761013
case TabSide.Right:
1014+
// Upper horizontal line
1015+
lc.AddLine (
1016+
new (vts.X - 1, vts.Y - 1),
1017+
1,
1018+
Orientation.Vertical,
1019+
tab.BorderStyle
1020+
);
1021+
1022+
lc.AddLine (
1023+
new (vts.X - 1, vts.Y - 1),
1024+
0,
1025+
Orientation.Horizontal,
1026+
tab.BorderStyle
1027+
);
1028+
8771029
break;
8781030
default:
8791031
throw new ArgumentOutOfRangeException ();
@@ -939,6 +1091,24 @@ private void RenderTabLineCanvas ()
9391091

9401092
break;
9411093
case TabSide.Right:
1094+
if (Frame.Bottom > tab.Frame.Bottom)
1095+
{
1096+
// Lower right tee
1097+
lc.AddLine (
1098+
new (vts.X - 1, vts.Bottom),
1099+
0,
1100+
Orientation.Vertical,
1101+
tab.BorderStyle
1102+
);
1103+
1104+
lc.AddLine (
1105+
new (vts.X - 1, vts.Bottom),
1106+
1,
1107+
Orientation.Horizontal,
1108+
tab.BorderStyle
1109+
);
1110+
}
1111+
9421112
break;
9431113
default:
9441114
throw new ArgumentOutOfRangeException ();
@@ -1010,6 +1180,16 @@ private void RenderTabLineCanvas ()
10101180

10111181
break;
10121182
case TabSide.Right:
1183+
lc.AddLine (
1184+
new (
1185+
vts.X - 1,
1186+
vts.Bottom
1187+
),
1188+
lineLength - arrowOffset,
1189+
Orientation.Vertical,
1190+
tab.BorderStyle
1191+
);
1192+
10131193
break;
10141194
default:
10151195
throw new ArgumentOutOfRangeException ();
@@ -1102,6 +1282,65 @@ private void RenderTabLineCanvas ()
11021282

11031283
break;
11041284
case TabSide.Right:
1285+
if (i == selectedTab)
1286+
{
1287+
if (Frame.Bottom == tab.Frame.Bottom)
1288+
{
1289+
// Lower right horizontal line
1290+
lc.AddLine (
1291+
new (vts.X - 1, vts.Bottom),
1292+
0,
1293+
Orientation.Horizontal,
1294+
tab.BorderStyle
1295+
);
1296+
}
1297+
else
1298+
{
1299+
lc.AddLine (
1300+
new (vts.X - 1, vts.Bottom),
1301+
lineLength,
1302+
Orientation.Vertical,
1303+
tab.BorderStyle
1304+
);
1305+
}
1306+
}
1307+
else
1308+
{
1309+
if (Frame.Bottom == tab.Frame.Bottom)
1310+
{
1311+
lc.AddLine (
1312+
new (vts.X - 1, vts.Bottom),
1313+
-1,
1314+
Orientation.Vertical,
1315+
tab.BorderStyle
1316+
);
1317+
1318+
lc.AddLine (
1319+
new (vts.X - 1, vts.Bottom),
1320+
0,
1321+
Orientation.Horizontal,
1322+
tab.BorderStyle
1323+
);
1324+
1325+
}
1326+
else
1327+
{
1328+
lc.AddLine (
1329+
new (vts.X - 1, vts.Bottom),
1330+
lineLength,
1331+
Orientation.Vertical,
1332+
tab.BorderStyle
1333+
);
1334+
1335+
lc.AddLine (
1336+
new (vts.X - 1, tabsBarVts.Bottom),
1337+
1,
1338+
Orientation.Horizontal,
1339+
tab.BorderStyle
1340+
);
1341+
}
1342+
}
1343+
11051344
break;
11061345
default:
11071346
throw new ArgumentOutOfRangeException ();
@@ -1154,6 +1393,20 @@ private void RenderTabLineCanvas ()
11541393

11551394
break;
11561395
case TabSide.Right:
1396+
if (Frame.Bottom > tab.Frame.Bottom)
1397+
{
1398+
// More URCorner
1399+
lc.AddLine (
1400+
new (
1401+
vts.X - 1,
1402+
tabsBarVts.Bottom - 1
1403+
),
1404+
-1,
1405+
Orientation.Horizontal,
1406+
tab.BorderStyle
1407+
);
1408+
}
1409+
11571410
break;
11581411
default:
11591412
throw new ArgumentOutOfRangeException ();
@@ -1208,6 +1461,7 @@ private void RenderUnderline ()
12081461

12091462
break;
12101463
case TabSide.Bottom:
1464+
case TabSide.Right:
12111465
_leftUpScrollIndicator.X = 0;
12121466
_leftUpScrollIndicator.Y = 0;
12131467

@@ -1216,8 +1470,6 @@ private void RenderUnderline ()
12161470
_leftUpScrollIndicator.X = Pos.AnchorEnd (1);
12171471
_leftUpScrollIndicator.Y = 0;
12181472

1219-
break;
1220-
case TabSide.Right:
12211473
break;
12221474
default:
12231475
throw new ArgumentOutOfRangeException ();
@@ -1251,6 +1503,9 @@ private void RenderUnderline ()
12511503

12521504
break;
12531505
case TabSide.Right:
1506+
_rightDownScrollIndicator.X = 0;
1507+
_rightDownScrollIndicator.Y = Pos.AnchorEnd (1);
1508+
12541509
break;
12551510
default:
12561511
throw new ArgumentOutOfRangeException ();

0 commit comments

Comments
 (0)