Skip to content

Commit a8fbfa1

Browse files
committed
Implemented right side feature.
1 parent e671494 commit a8fbfa1

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
@@ -205,6 +205,14 @@ private void RenderTabLineCanvas ()
205205

206206
break;
207207
case TabSide.Right:
208+
// Upper horizontal line
209+
lc.AddLine (
210+
new (vts.X - 1, vts.Y - 1),
211+
-1,
212+
Orientation.Horizontal,
213+
tab.BorderStyle
214+
);
215+
208216
break;
209217
default:
210218
throw new ArgumentOutOfRangeException ();
@@ -269,6 +277,24 @@ private void RenderTabLineCanvas ()
269277

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

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

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

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

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

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

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

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

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

10121182
break;
10131183
case TabSide.Right:
1184+
lc.AddLine (
1185+
new (
1186+
vts.X - 1,
1187+
vts.Bottom
1188+
),
1189+
lineLength - arrowOffset,
1190+
Orientation.Vertical,
1191+
tab.BorderStyle
1192+
);
1193+
10141194
break;
10151195
default:
10161196
throw new ArgumentOutOfRangeException ();
@@ -1103,6 +1283,65 @@ private void RenderTabLineCanvas ()
11031283

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

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

12101463
break;
12111464
case TabSide.Bottom:
1465+
case TabSide.Right:
12121466
_leftUpScrollIndicator.X = 0;
12131467
_leftUpScrollIndicator.Y = 0;
12141468

@@ -1217,8 +1471,6 @@ private void RenderUnderline ()
12171471
_leftUpScrollIndicator.X = Pos.AnchorEnd (1);
12181472
_leftUpScrollIndicator.Y = 0;
12191473

1220-
break;
1221-
case TabSide.Right:
12221474
break;
12231475
default:
12241476
throw new ArgumentOutOfRangeException ();
@@ -1252,6 +1504,9 @@ private void RenderUnderline ()
12521504

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

0 commit comments

Comments
 (0)