From 9de2f906ba265cd2364794130d9e36c7840ec382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Mon, 16 Sep 2019 08:13:55 +0200 Subject: [PATCH] liboperators/OperatorFlipVertical.py:{flipPairs,apply()}: correctly flip flippable text characters. assets/text/TODO: updated. --- assets/text/TODO | 7 +++---- liboperators/OperatorFlipVertical.py | 11 +++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/assets/text/TODO b/assets/text/TODO index da2b5a0..5d96ce1 100644 --- a/assets/text/TODO +++ b/assets/text/TODO @@ -24,9 +24,8 @@ Queue: 2) text tool: impl. backspace & enter, update internal brushPos if updated w/ arrow keys 3) text tool: a) honour RTL text flow b) navigating w/ cursor keys c) pasting text 4) scroll down, apply operator to entire canvas, scroll up -5) flip tool: correctly flip chars e.g. \ -> /, etc. -6) underline FUCKING BROKEN _AGAIN_ -7) select-related {re,un}do bugs -8) clone selection lag +5) underline FUCKING BROKEN _AGAIN_ +6) select-related {re,un}do bugs +7) clone selection lag vim:ff=dos tw=0 diff --git a/liboperators/OperatorFlipVertical.py b/liboperators/OperatorFlipVertical.py index 856b0e0..4f9235b 100644 --- a/liboperators/OperatorFlipVertical.py +++ b/liboperators/OperatorFlipVertical.py @@ -8,12 +8,23 @@ from Operator import Operator class OperatorFlipVertical(Operator): name = "Flip" + flipPairs = { + "(":")", ")":"(", + "/":"\\", "\\":"/", + "\[":"]", "]":"\[", + "\{":"\}", "\}":"\{", + "<":">", ">":"<", + "`":"'", + } # # apply(self, region) def apply(self, region): for numRow in range(len(region)): region[numRow].reverse() + for numCol in range(len(region[numRow])): + if region[numRow][numCol][3] in self.flipPairs: + region[numRow][numCol][3] = self.flipPairs[region[numRow][numCol][3]] return region # __init__(self, *args): initialisation method