[orca] Strip "\n" from end of flat-review copy/append string; separate with space
- From: Joanmarie Diggs <joanied src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [orca] Strip "\n" from end of flat-review copy/append string; separate with space
- Date: Wed, 22 Jan 2020 21:03:27 +0000 (UTC)
commit f08d1abf6f0fd5541dcc04e21f9878543dc97391
Author: Joanmarie Diggs <joanmarie diggs gmail com>
Date: Wed Jan 22 15:57:23 2020 -0500
Strip "\n" from end of flat-review copy/append string; separate with space
One cited use of Orca's copy/append flat-review contents is to paste the
results into a terminal. Because the copied/appended contents are often
newline-terminated, they cannot be directly pasted into a terminal without
executing the command by side-effect. That's a drag. Thus strip "\n" from
the end of any string to be copied or appended via flat review.
In addition, Orca was separating appending strings using a newline char.
Thus the aforementioned problem is still present. Orca now separates
appended strings with a space. Problem solved. Of course, maybe some users
would prefer the newline separator. For now, this is not customizable so
that we can get feedback based on real-world use/needs before adding yet
another setting.
src/orca/script_utilities.py | 4 ++--
src/orca/scripts/default.py | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/src/orca/script_utilities.py b/src/orca/script_utilities.py
index 668ddfa08..b42a03401 100644
--- a/src/orca/script_utilities.py
+++ b/src/orca/script_utilities.py
@@ -4768,9 +4768,9 @@ class Utilities:
clipboard = Gtk.Clipboard.get(Gdk.Atom.intern("CLIPBOARD", False))
clipboard.request_text(self._appendTextToClipboardCallback, text)
- def _appendTextToClipboardCallback(self, clipboard, text, newText):
+ def _appendTextToClipboardCallback(self, clipboard, text, newText, separator=" "):
text = text.rstrip("\n")
- text = "%s\n%s" % (text, newText)
+ text = "%s%s%s" % (text, separator, newText)
clipboard.set_text(text, -1)
def lastInputEventCameFromThisApp(self):
diff --git a/src/orca/scripts/default.py b/src/orca/scripts/default.py
index 9528ce356..ecd08b8ce 100644
--- a/src/orca/scripts/default.py
+++ b/src/orca/scripts/default.py
@@ -1745,7 +1745,7 @@ class Script(script.Script):
them in the clipboard."""
if self.flatReviewContext:
- self.utilities.setClipboardText(self.currentReviewContents)
+ self.utilities.setClipboardText(self.currentReviewContents.rstrip("\n"))
self.presentMessage(messages.FLAT_REVIEW_COPIED)
else:
self.presentMessage(messages.FLAT_REVIEW_NOT_IN)
@@ -1757,7 +1757,7 @@ class Script(script.Script):
the clipboard."""
if self.flatReviewContext:
- self.utilities.appendTextToClipboard(self.currentReviewContents)
+ self.utilities.appendTextToClipboard(self.currentReviewContents.rstrip("\n"))
self.presentMessage(messages.FLAT_REVIEW_APPENDED)
else:
self.presentMessage(messages.FLAT_REVIEW_NOT_IN)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]