...

Source file src/code.rocketnine.space/tslocum/cview/semigraphics.go

Documentation: code.rocketnine.space/tslocum/cview

     1  package cview
     2  
     3  import "github.com/gdamore/tcell/v2"
     4  
     5  // Semigraphics provides an easy way to access unicode characters for drawing.
     6  //
     7  // Named like the unicode characters, 'Semigraphics'-prefix used if unicode block
     8  // isn't prefixed itself.
     9  const (
    10  	// Block: General Punctation U+2000-U+206F (http://unicode.org/charts/PDF/U2000.pdf)
    11  	SemigraphicsHorizontalEllipsis rune = '\u2026' // …
    12  
    13  	// Block: Box Drawing U+2500-U+257F (http://unicode.org/charts/PDF/U2500.pdf)
    14  	BoxDrawingsLightHorizontal                    rune = '\u2500' // ─
    15  	BoxDrawingsHeavyHorizontal                    rune = '\u2501' // ━
    16  	BoxDrawingsLightVertical                      rune = '\u2502' // │
    17  	BoxDrawingsHeavyVertical                      rune = '\u2503' // ┃
    18  	BoxDrawingsLightTripleDashHorizontal          rune = '\u2504' // ┄
    19  	BoxDrawingsHeavyTripleDashHorizontal          rune = '\u2505' // ┅
    20  	BoxDrawingsLightTripleDashVertical            rune = '\u2506' // ┆
    21  	BoxDrawingsHeavyTripleDashVertical            rune = '\u2507' // ┇
    22  	BoxDrawingsLightQuadrupleDashHorizontal       rune = '\u2508' // ┈
    23  	BoxDrawingsHeavyQuadrupleDashHorizontal       rune = '\u2509' // ┉
    24  	BoxDrawingsLightQuadrupleDashVertical         rune = '\u250a' // ┊
    25  	BoxDrawingsHeavyQuadrupleDashVertical         rune = '\u250b' // ┋
    26  	BoxDrawingsLightDownAndRight                  rune = '\u250c' // ┌
    27  	BoxDrawingsDownLighAndRightHeavy              rune = '\u250d' // ┍
    28  	BoxDrawingsDownHeavyAndRightLight             rune = '\u250e' // ┎
    29  	BoxDrawingsHeavyDownAndRight                  rune = '\u250f' // ┏
    30  	BoxDrawingsLightDownAndLeft                   rune = '\u2510' // ┐
    31  	BoxDrawingsDownLighAndLeftHeavy               rune = '\u2511' // ┑
    32  	BoxDrawingsDownHeavyAndLeftLight              rune = '\u2512' // ┒
    33  	BoxDrawingsHeavyDownAndLeft                   rune = '\u2513' // ┓
    34  	BoxDrawingsLightUpAndRight                    rune = '\u2514' // └
    35  	BoxDrawingsUpLightAndRightHeavy               rune = '\u2515' // ┕
    36  	BoxDrawingsUpHeavyAndRightLight               rune = '\u2516' // ┖
    37  	BoxDrawingsHeavyUpAndRight                    rune = '\u2517' // ┗
    38  	BoxDrawingsLightUpAndLeft                     rune = '\u2518' // ┘
    39  	BoxDrawingsUpLightAndLeftHeavy                rune = '\u2519' // ┙
    40  	BoxDrawingsUpHeavyAndLeftLight                rune = '\u251a' // ┚
    41  	BoxDrawingsHeavyUpAndLeft                     rune = '\u251b' // ┛
    42  	BoxDrawingsLightVerticalAndRight              rune = '\u251c' // ├
    43  	BoxDrawingsVerticalLightAndRightHeavy         rune = '\u251d' // ┝
    44  	BoxDrawingsUpHeavyAndRightDownLight           rune = '\u251e' // ┞
    45  	BoxDrawingsDownHeacyAndRightUpLight           rune = '\u251f' // ┟
    46  	BoxDrawingsVerticalHeavyAndRightLight         rune = '\u2520' // ┠
    47  	BoxDrawingsDownLightAnbdRightUpHeavy          rune = '\u2521' // ┡
    48  	BoxDrawingsUpLightAndRightDownHeavy           rune = '\u2522' // ┢
    49  	BoxDrawingsHeavyVerticalAndRight              rune = '\u2523' // ┣
    50  	BoxDrawingsLightVerticalAndLeft               rune = '\u2524' // ┤
    51  	BoxDrawingsVerticalLightAndLeftHeavy          rune = '\u2525' // ┥
    52  	BoxDrawingsUpHeavyAndLeftDownLight            rune = '\u2526' // ┦
    53  	BoxDrawingsDownHeavyAndLeftUpLight            rune = '\u2527' // ┧
    54  	BoxDrawingsVerticalheavyAndLeftLight          rune = '\u2528' // ┨
    55  	BoxDrawingsDownLightAndLeftUpHeavy            rune = '\u2529' // ┨
    56  	BoxDrawingsUpLightAndLeftDownHeavy            rune = '\u252a' // ┪
    57  	BoxDrawingsHeavyVerticalAndLeft               rune = '\u252b' // ┫
    58  	BoxDrawingsLightDownAndHorizontal             rune = '\u252c' // ┬
    59  	BoxDrawingsLeftHeavyAndRightDownLight         rune = '\u252d' // ┭
    60  	BoxDrawingsRightHeavyAndLeftDownLight         rune = '\u252e' // ┮
    61  	BoxDrawingsDownLightAndHorizontalHeavy        rune = '\u252f' // ┯
    62  	BoxDrawingsDownHeavyAndHorizontalLight        rune = '\u2530' // ┰
    63  	BoxDrawingsRightLightAndLeftDownHeavy         rune = '\u2531' // ┱
    64  	BoxDrawingsLeftLightAndRightDownHeavy         rune = '\u2532' // ┲
    65  	BoxDrawingsHeavyDownAndHorizontal             rune = '\u2533' // ┳
    66  	BoxDrawingsLightUpAndHorizontal               rune = '\u2534' // ┴
    67  	BoxDrawingsLeftHeavyAndRightUpLight           rune = '\u2535' // ┵
    68  	BoxDrawingsRightHeavyAndLeftUpLight           rune = '\u2536' // ┶
    69  	BoxDrawingsUpLightAndHorizontalHeavy          rune = '\u2537' // ┷
    70  	BoxDrawingsUpHeavyAndHorizontalLight          rune = '\u2538' // ┸
    71  	BoxDrawingsRightLightAndLeftUpHeavy           rune = '\u2539' // ┹
    72  	BoxDrawingsLeftLightAndRightUpHeavy           rune = '\u253a' // ┺
    73  	BoxDrawingsHeavyUpAndHorizontal               rune = '\u253b' // ┻
    74  	BoxDrawingsLightVerticalAndHorizontal         rune = '\u253c' // ┼
    75  	BoxDrawingsLeftHeavyAndRightVerticalLight     rune = '\u253d' // ┽
    76  	BoxDrawingsRightHeavyAndLeftVerticalLight     rune = '\u253e' // ┾
    77  	BoxDrawingsVerticalLightAndHorizontalHeavy    rune = '\u253f' // ┿
    78  	BoxDrawingsUpHeavyAndDownHorizontalLight      rune = '\u2540' // ╀
    79  	BoxDrawingsDownHeavyAndUpHorizontalLight      rune = '\u2541' // ╁
    80  	BoxDrawingsVerticalHeavyAndHorizontalLight    rune = '\u2542' // ╂
    81  	BoxDrawingsLeftUpHeavyAndRightDownLight       rune = '\u2543' // ╃
    82  	BoxDrawingsRightUpHeavyAndLeftDownLight       rune = '\u2544' // ╄
    83  	BoxDrawingsLeftDownHeavyAndRightUpLight       rune = '\u2545' // ╅
    84  	BoxDrawingsRightDownHeavyAndLeftUpLight       rune = '\u2546' // ╆
    85  	BoxDrawingsDownLightAndUpHorizontalHeavy      rune = '\u2547' // ╇
    86  	BoxDrawingsUpLightAndDownHorizontalHeavy      rune = '\u2548' // ╈
    87  	BoxDrawingsRightLightAndLeftVerticalHeavy     rune = '\u2549' // ╉
    88  	BoxDrawingsLeftLightAndRightVerticalHeavy     rune = '\u254a' // ╊
    89  	BoxDrawingsHeavyVerticalAndHorizontal         rune = '\u254b' // ╋
    90  	BoxDrawingsLightDoubleDashHorizontal          rune = '\u254c' // ╌
    91  	BoxDrawingsHeavyDoubleDashHorizontal          rune = '\u254d' // ╍
    92  	BoxDrawingsLightDoubleDashVertical            rune = '\u254e' // ╎
    93  	BoxDrawingsHeavyDoubleDashVertical            rune = '\u254f' // ╏
    94  	BoxDrawingsDoubleHorizontal                   rune = '\u2550' // ═
    95  	BoxDrawingsDoubleVertical                     rune = '\u2551' // ║
    96  	BoxDrawingsDownSingleAndRightDouble           rune = '\u2552' // ╒
    97  	BoxDrawingsDownDoubleAndRightSingle           rune = '\u2553' // ╓
    98  	BoxDrawingsDoubleDownAndRight                 rune = '\u2554' // ╔
    99  	BoxDrawingsDownSingleAndLeftDouble            rune = '\u2555' // ╕
   100  	BoxDrawingsDownDoubleAndLeftSingle            rune = '\u2556' // ╖
   101  	BoxDrawingsDoubleDownAndLeft                  rune = '\u2557' // ╗
   102  	BoxDrawingsUpSingleAndRightDouble             rune = '\u2558' // ╘
   103  	BoxDrawingsUpDoubleAndRightSingle             rune = '\u2559' // ╙
   104  	BoxDrawingsDoubleUpAndRight                   rune = '\u255a' // ╚
   105  	BoxDrawingsUpSingleAndLeftDouble              rune = '\u255b' // ╛
   106  	BoxDrawingsUpDobuleAndLeftSingle              rune = '\u255c' // ╜
   107  	BoxDrawingsDoubleUpAndLeft                    rune = '\u255d' // ╝
   108  	BoxDrawingsVerticalSingleAndRightDouble       rune = '\u255e' // ╞
   109  	BoxDrawingsVerticalDoubleAndRightSingle       rune = '\u255f' // ╟
   110  	BoxDrawingsDoubleVerticalAndRight             rune = '\u2560' // ╠
   111  	BoxDrawingsVerticalSingleAndLeftDouble        rune = '\u2561' // ╡
   112  	BoxDrawingsVerticalDoubleAndLeftSingle        rune = '\u2562' // ╢
   113  	BoxDrawingsDoubleVerticalAndLeft              rune = '\u2563' // ╣
   114  	BoxDrawingsDownSingleAndHorizontalDouble      rune = '\u2564' // ╤
   115  	BoxDrawingsDownDoubleAndHorizontalSingle      rune = '\u2565' // ╥
   116  	BoxDrawingsDoubleDownAndHorizontal            rune = '\u2566' // ╦
   117  	BoxDrawingsUpSingleAndHorizontalDouble        rune = '\u2567' // ╧
   118  	BoxDrawingsUpDoubleAndHorizontalSingle        rune = '\u2568' // ╨
   119  	BoxDrawingsDoubleUpAndHorizontal              rune = '\u2569' // ╩
   120  	BoxDrawingsVerticalSingleAndHorizontalDouble  rune = '\u256a' // ╪
   121  	BoxDrawingsVerticalDoubleAndHorizontalSingle  rune = '\u256b' // ╫
   122  	BoxDrawingsDoubleVerticalAndHorizontal        rune = '\u256c' // ╬
   123  	BoxDrawingsLightArcDownAndRight               rune = '\u256d' // ╭
   124  	BoxDrawingsLightArcDownAndLeft                rune = '\u256e' // ╮
   125  	BoxDrawingsLightArcUpAndLeft                  rune = '\u256f' // ╯
   126  	BoxDrawingsLightArcUpAndRight                 rune = '\u2570' // ╰
   127  	BoxDrawingsLightDiagonalUpperRightToLowerLeft rune = '\u2571' // ╱
   128  	BoxDrawingsLightDiagonalUpperLeftToLowerRight rune = '\u2572' // ╲
   129  	BoxDrawingsLightDiagonalCross                 rune = '\u2573' // ╳
   130  	BoxDrawingsLightLeft                          rune = '\u2574' // ╴
   131  	BoxDrawingsLightUp                            rune = '\u2575' // ╵
   132  	BoxDrawingsLightRight                         rune = '\u2576' // ╶
   133  	BoxDrawingsLightDown                          rune = '\u2577' // ╷
   134  	BoxDrawingsHeavyLeft                          rune = '\u2578' // ╸
   135  	BoxDrawingsHeavyUp                            rune = '\u2579' // ╹
   136  	BoxDrawingsHeavyRight                         rune = '\u257a' // ╺
   137  	BoxDrawingsHeavyDown                          rune = '\u257b' // ╻
   138  	BoxDrawingsLightLeftAndHeavyRight             rune = '\u257c' // ╼
   139  	BoxDrawingsLightUpAndHeavyDown                rune = '\u257d' // ╽
   140  	BoxDrawingsHeavyLeftAndLightRight             rune = '\u257e' // ╾
   141  	BoxDrawingsHeavyUpAndLightDown                rune = '\u257f' // ╿
   142  )
   143  
   144  // SemigraphicJoints is a map for joining semigraphic (or otherwise) runes.
   145  // So far only light lines are supported but if you want to change the border
   146  // styling you need to provide the joints, too.
   147  // The matching will be sorted ascending by rune value, so you don't need to
   148  // provide all rune combinations,
   149  // e.g. (─) + (│) = (┼) will also match (│) + (─) = (┼)
   150  var SemigraphicJoints = map[string]rune{
   151  	// (─) + (│) = (┼)
   152  	string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightVertical}): BoxDrawingsLightVerticalAndHorizontal,
   153  	// (─) + (┌) = (┬)
   154  	string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightDownAndRight}): BoxDrawingsLightDownAndHorizontal,
   155  	// (─) + (┐) = (┬)
   156  	string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightDownAndLeft}): BoxDrawingsLightDownAndHorizontal,
   157  	// (─) + (└) = (┴)
   158  	string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightUpAndRight}): BoxDrawingsLightUpAndHorizontal,
   159  	// (─) + (┘) = (┴)
   160  	string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightUpAndLeft}): BoxDrawingsLightUpAndHorizontal,
   161  	// (─) + (├) = (┼)
   162  	string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndHorizontal,
   163  	// (─) + (┤) = (┼)
   164  	string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndHorizontal,
   165  	// (─) + (┬) = (┬)
   166  	string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightDownAndHorizontal,
   167  	// (─) + (┴) = (┴)
   168  	string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightUpAndHorizontal,
   169  	// (─) + (┼) = (┼)
   170  	string([]rune{BoxDrawingsLightHorizontal, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   171  
   172  	// (│) + (┌) = (├)
   173  	string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightDownAndRight}): BoxDrawingsLightVerticalAndRight,
   174  	// (│) + (┐) = (┤)
   175  	string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightDownAndLeft}): BoxDrawingsLightVerticalAndLeft,
   176  	// (│) + (└) = (├)
   177  	string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightUpAndRight}): BoxDrawingsLightVerticalAndRight,
   178  	// (│) + (┘) = (┤)
   179  	string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightUpAndLeft}): BoxDrawingsLightVerticalAndLeft,
   180  	// (│) + (├) = (├)
   181  	string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndRight,
   182  	// (│) + (┤) = (┤)
   183  	string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndLeft,
   184  	// (│) + (┬) = (┼)
   185  	string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   186  	// (│) + (┴) = (┼)
   187  	string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   188  	// (│) + (┼) = (┼)
   189  	string([]rune{BoxDrawingsLightVertical, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   190  
   191  	// (┌) + (┐) = (┬)
   192  	string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightDownAndLeft}): BoxDrawingsLightDownAndHorizontal,
   193  	// (┌) + (└) = (├)
   194  	string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightUpAndRight}): BoxDrawingsLightVerticalAndRight,
   195  	// (┌) + (┘) = (┼)
   196  	string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightUpAndLeft}): BoxDrawingsLightVerticalAndHorizontal,
   197  	// (┌) + (├) = (├)
   198  	string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndRight,
   199  	// (┌) + (┤) = (┼)
   200  	string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndHorizontal,
   201  	// (┌) + (┬) = (┬)
   202  	string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightDownAndHorizontal,
   203  	// (┌) + (┴) = (┼)
   204  	string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   205  	// (┌) + (┴) = (┼)
   206  	string([]rune{BoxDrawingsLightDownAndRight, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   207  
   208  	// (┐) + (└) = (┼)
   209  	string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightUpAndRight}): BoxDrawingsLightVerticalAndHorizontal,
   210  	// (┐) + (┘) = (┤)
   211  	string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightUpAndLeft}): BoxDrawingsLightVerticalAndLeft,
   212  	// (┐) + (├) = (┼)
   213  	string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndHorizontal,
   214  	// (┐) + (┤) = (┤)
   215  	string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndLeft,
   216  	// (┐) + (┬) = (┬)
   217  	string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightDownAndHorizontal,
   218  	// (┐) + (┴) = (┼)
   219  	string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   220  	// (┐) + (┼) = (┼)
   221  	string([]rune{BoxDrawingsLightDownAndLeft, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   222  
   223  	// (└) + (┘) = (┴)
   224  	string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightUpAndLeft}): BoxDrawingsLightUpAndHorizontal,
   225  	// (└) + (├) = (├)
   226  	string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndRight,
   227  	// (└) + (┤) = (┼)
   228  	string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndHorizontal,
   229  	// (└) + (┬) = (┼)
   230  	string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   231  	// (└) + (┴) = (┴)
   232  	string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightUpAndHorizontal,
   233  	// (└) + (┼) = (┼)
   234  	string([]rune{BoxDrawingsLightUpAndRight, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   235  
   236  	// (┘) + (├) = (┼)
   237  	string([]rune{BoxDrawingsLightUpAndLeft, BoxDrawingsLightVerticalAndRight}): BoxDrawingsLightVerticalAndHorizontal,
   238  	// (┘) + (┤) = (┤)
   239  	string([]rune{BoxDrawingsLightUpAndLeft, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndLeft,
   240  	// (┘) + (┬) = (┼)
   241  	string([]rune{BoxDrawingsLightUpAndLeft, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   242  	// (┘) + (┴) = (┴)
   243  	string([]rune{BoxDrawingsLightUpAndLeft, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightUpAndHorizontal,
   244  	// (┘) + (┼) = (┼)
   245  	string([]rune{BoxDrawingsLightUpAndLeft, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   246  
   247  	// (├) + (┤) = (┼)
   248  	string([]rune{BoxDrawingsLightVerticalAndRight, BoxDrawingsLightVerticalAndLeft}): BoxDrawingsLightVerticalAndHorizontal,
   249  	// (├) + (┬) = (┼)
   250  	string([]rune{BoxDrawingsLightVerticalAndRight, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   251  	// (├) + (┴) = (┼)
   252  	string([]rune{BoxDrawingsLightVerticalAndRight, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   253  	// (├) + (┼) = (┼)
   254  	string([]rune{BoxDrawingsLightVerticalAndRight, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   255  
   256  	// (┤) + (┬) = (┼)
   257  	string([]rune{BoxDrawingsLightVerticalAndLeft, BoxDrawingsLightDownAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   258  	// (┤) + (┴) = (┼)
   259  	string([]rune{BoxDrawingsLightVerticalAndLeft, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   260  	// (┤) + (┼) = (┼)
   261  	string([]rune{BoxDrawingsLightVerticalAndLeft, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   262  
   263  	// (┬) + (┴) = (┼)
   264  	string([]rune{BoxDrawingsLightDownAndHorizontal, BoxDrawingsLightUpAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   265  	// (┬) + (┼) = (┼)
   266  	string([]rune{BoxDrawingsLightDownAndHorizontal, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   267  
   268  	// (┴) + (┼) = (┼)
   269  	string([]rune{BoxDrawingsLightUpAndHorizontal, BoxDrawingsLightVerticalAndHorizontal}): BoxDrawingsLightVerticalAndHorizontal,
   270  }
   271  
   272  // PrintJoinedSemigraphics prints a semigraphics rune into the screen at the given
   273  // position with the given color, joining it with any existing semigraphics
   274  // rune. Background colors are preserved. At this point, only regular single
   275  // line borders are supported.
   276  func PrintJoinedSemigraphics(screen tcell.Screen, x, y int, ch rune, color tcell.Color) {
   277  	previous, _, style, _ := screen.GetContent(x, y)
   278  	style = style.Foreground(color)
   279  
   280  	// What's the resulting rune?
   281  	var result rune
   282  	if ch == previous {
   283  		result = ch
   284  	} else {
   285  		if ch < previous {
   286  			previous, ch = ch, previous
   287  		}
   288  		result = SemigraphicJoints[string([]rune{previous, ch})]
   289  	}
   290  	if result == 0 {
   291  		result = ch
   292  	}
   293  
   294  	// We only print something if we have something.
   295  	screen.SetContent(x, y, result, nil, style)
   296  }
   297  

View as plain text