chore: draw + better
parent
ebcdd26a02
commit
cb1f44064f
|
@ -92,7 +92,7 @@ func Draw(
|
|||
}
|
||||
}
|
||||
|
||||
// Each kemap has many layers
|
||||
// Each keymap has many layers
|
||||
layersStr := make([]string, 0, len(keymap.Layers))
|
||||
for iLayer, layer := range keymap.Layers {
|
||||
// Preprocess table
|
||||
|
@ -118,7 +118,9 @@ func Draw(
|
|||
}
|
||||
|
||||
// Padding to center key
|
||||
padding := (key.NewW - len(keyStr)) / 2
|
||||
// Why / 2, why - 1 ?
|
||||
// Base on my feeling of course
|
||||
padding := (key.NewW-len(keyStr))/2 - 1
|
||||
if padding <= 0 {
|
||||
padding = 1
|
||||
}
|
||||
|
@ -149,7 +151,7 @@ func Draw(
|
|||
count++
|
||||
}
|
||||
|
||||
// Postprocess table
|
||||
// Process new table
|
||||
newTable := make([][]string, 0, newMaxY+1)
|
||||
|
||||
for i := 0; i < len(table); i++ {
|
||||
|
@ -186,6 +188,15 @@ func Draw(
|
|||
}
|
||||
newTable = append(newTable, append(paddingRow, "+"))
|
||||
|
||||
// Postprocess new table
|
||||
for i := 1; i < len(newTable); i++ {
|
||||
for j := 0; j < len(newTable[i]); j++ {
|
||||
if newTable[i-1][j] == "|" {
|
||||
newTable[i][j] = "+"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
layerStr := fmt.Sprintf("Layer %d\n", iLayer)
|
||||
for i := range newTable {
|
||||
for j := range newTable[i] {
|
||||
|
|
|
@ -1,39 +1,39 @@
|
|||
Layout LAYOUT_60_tsangan_hhkb
|
||||
Layer 0
|
||||
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
| GESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` |
|
||||
+-----------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-----------+
|
||||
| TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | BACKSPACE |
|
||||
+-------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-----------------+
|
||||
| CTRL ESC | A | S | D | F | G | H | J | K | L | ; | ' | SHIFT ENTER |
|
||||
+-----------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------------+-------+
|
||||
| SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | MO(1) |
|
||||
+-----------+-------+-----------+-------------------------------------------------------+-----------+-------+-----------+
|
||||
| | ALT | CMD | SPACE | CMD | ALT | |
|
||||
| GESC | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | \ | ` |
|
||||
+-------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+
|
||||
| TAB | Q | W | E | R | T | Y | U | I | O | P | [ | ] | BACKSPACE |
|
||||
+-----------+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-----------+
|
||||
| CTRL ESC | A | S | D | F | G | H | J | K | L | ; | ' | SHIFT ENTER |
|
||||
+-------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---------+-------+
|
||||
| SHIFT | Z | X | C | V | B | N | M | , | . | / | SHIFT | MO(1) |
|
||||
+-----------+-----+-+-----+-----+-+-------+-------+-------+-------+-------+-------+-----+-+-------+-+-------+---+-------+
|
||||
| | ALT | CMD | SPACE | CMD | ALT | |
|
||||
+-----------+-------+-----------+-------------------------------------------------------+-----------+-------+-----------+
|
||||
|
||||
Layer 1
|
||||
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
| ` | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | |
|
||||
+-----------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-----------+
|
||||
| | | | | | | | | | | | UP | | |
|
||||
+-------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-----------------+
|
||||
| | VOLD | VOLU | MUTE | | | | | | | LEFT | RGHT | |
|
||||
+-----------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------------+-------+
|
||||
| | | | | | | | | | | DOWN | | |
|
||||
+-----------+-------+-----------+-------------------------------------------------------+-----------+-------+-----------+
|
||||
| ` | F1 | F2 | F3 | F4 | F5 | F6 | F7 | F8 | F9 | F10 | F11 | F12 | | |
|
||||
+-------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+
|
||||
| | | | | | | | | | | | UP | | |
|
||||
+-----------+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-----------+
|
||||
| | VOLD | VOLU | MUTE | | | | | | | LEFT | RGHT | |
|
||||
+-------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---------+-------+
|
||||
| | | | | | | | | | | DOWN | | |
|
||||
+-----------+-----+-+-----+-----+-+-------+-------+-------+-------+-------+-------+-----+-+-------+-+-------+---+-------+
|
||||
| | TG(2) | | | | | |
|
||||
+-----------+-------+-----------+-------------------------------------------------------+-----------+-------+-----------+
|
||||
|
||||
Layer 2
|
||||
+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+
|
||||
| BOOT | | | | | | | | | | | | | | |
|
||||
+-----------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-----------+
|
||||
| BOOT | | | | | | | | | | | | | | |
|
||||
+-------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+-------+
|
||||
| | | | | | | | | | | | | | |
|
||||
+-------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-----------------+
|
||||
| CAPSLOCK | RGBH | RGBS | RGBV | | | | | HOME | PGUP | | | |
|
||||
+-----------------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------+-------------+-------+
|
||||
| | | | | | | | | END | PGDN | | | |
|
||||
+-----------+-------+-----------+-------------------------------------------------------+-----------+-------+-----------+
|
||||
| | | | | RGBTO | RGBMO | |
|
||||
+-----------+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-+-----+-----------+
|
||||
| CAPSLOCK | RGBH | RGBS | RGBV | | | | | HOME | PGUP | | | |
|
||||
+-------------+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---------+-------+
|
||||
| | | | | | | | | END | PGDN | | | |
|
||||
+-----------+-----+-+-----+-----+-+-------+-------+-------+-------+-------+-------+-----+-+-------+-+-------+---+-------+
|
||||
| | | | | RGBTO | RGBMO | |
|
||||
+-----------+-------+-----------+-------------------------------------------------------+-----------+-------+-----------+
|
||||
|
|
Loading…
Reference in New Issue