about summary refs log tree commit diff homepage
path: root/client.c
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2018-08-24 22:08:18 -0400
committerJune McEnroe <june@causal.agency>2018-08-24 22:08:18 -0400
commit897adb9ca2f0cd67b92a398a42b9c9eebaa70c19 (patch)
tree4a9b747cec17309e2062c935f31d85123dd1c95f /client.c
parentAdd copy and paste (diff)
downloadtorus-897adb9ca2f0cd67b92a398a42b9c9eebaa70c19.tar.gz
torus-897adb9ca2f0cd67b92a398a42b9c9eebaa70c19.zip
Separate 8, 9 and *, (
Diffstat (limited to '')
-rw-r--r--client.c30
1 files changed, 23 insertions, 7 deletions
diff --git a/client.c b/client.c
index c055028..ca67a84 100644
--- a/client.c
+++ b/client.c
@@ -263,10 +263,11 @@ static void colorFg(uint8_t fg) {
 static void colorBg(uint8_t bg) {
 	input.color = (input.color & 0x0F) | (bg & 0x07) << 4;
 }
-static void colorInvert(void) {
-	input.color = (input.color & 0x08)
-		| (input.color & 0x70) >> 4
-		| (input.color & 0x07) << 4;
+
+static uint8_t colorInvert(uint8_t color) {
+	return (color & 0x08)
+		| (color & 0x70) >> 4
+		| (color & 0x07) << 4;
 }
 
 static void cellCopy(void) {
@@ -347,8 +348,8 @@ static void inputNormal(wchar_t ch) {
 		break; case '^': colorBg(COLOR_CYAN);
 		break; case '&': colorBg(COLOR_WHITE);
 
-		break; case '8': case '*': input.color ^= COLOR_BRIGHT;
-		break; case '9': case '(': colorInvert();
+		break; case '8': input.color ^= COLOR_BRIGHT;
+		break; case '9': input.color = colorInvert(input.color);
 		break; case '`': input.color = tile.colors[cellY][cellX];
 
 		break; case 'H': cellSwap(-1,  0);
@@ -361,13 +362,28 @@ static void inputNormal(wchar_t ch) {
 		break; case 'N': cellSwap( 1,  1);
 
 		break; case 's': cellCopy();
+		break; case 'x': cellCopy(); clientPut(copy.color, ' ');
 		break; case 'p': clientPut(copy.color, copy.cell);
 
-		break; case 'x': cellCopy(); clientPut(copy.color, ' ');
 		break; case '~': {
+			cellCopy();
 			clientPut(input.color, tile.cells[cellY][cellX]);
 			clientMove(1, 0);
 		}
+		break; case '*': {
+			clientPut(
+				tile.colors[cellY][cellX] ^ COLOR_BRIGHT,
+				tile.cells[cellY][cellX]
+			);
+			clientMove(1, 0);
+		}
+		break; case '(': {
+			clientPut(
+				colorInvert(tile.colors[cellY][cellX]),
+				tile.cells[cellY][cellX]
+			);
+			clientMove(1, 0);
+		}
 
 		break; case CTRL('A'): {
 			clientPut(tile.colors[cellY][cellX], tile.cells[cellY][cellX] + 1);