Repository: nvaccess/nvda

Issue:
Repeat read status bar command 3 times on empty status bar announces nothing
From https://github.com/nvaccess/nvda/issues/1785#issuecomment-345228357 on PR "Make the Read status bar command copy its contents on third press like Report window title"

### Steps to reproduce:
1. Find an empty status bar
1. Press `NVDA+end` (desktop) or `NVDA+shift+end` (laptop) 3 times

### Pre-existing behaviour (other features)
We should try to be consistent with existing features here, or make them consistent

Report title: On an application with not title, pressing `NVDA+t` 3 times you get "no title application" copied to the clipboard and that is also what is announced, ie "no title application copied to clipboard"

Mark start, mark end, copy range:  with `NVDA+F9`, then `NVDA+F10`  twice. I am not able to think of a situation where you can create an empty selection and copy it. 

### Actual behavior:
When the status bar is empty and the read status bar command is triggered, blank is reported. When pressed 3 times, nothing is announced.

### Expected behavior:
I think something should be announced to acknowledge the command in both cases. In the first perhaps "no status bar information" in the the second "unable to copy status bar to clipboard"

I would suggest that in the (rare) case of a blank application title being copied, the behaviour should match.


Discussion:

Resolving patch:
diff --git a/source/globalCommands.py b/source/globalCommands.py
--- a/source/globalCommands.py
+++ b/source/globalCommands.py
@@ -3,7 +3,7 @@
 #A part of NonVisual Desktop Access (NVDA)
 #This file is covered by the GNU General Public License.
 #See the file COPYING for more details.
-#Copyright (C) 2006-2018 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, Leonard de Ruijter, Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger
+#Copyright (C) 2006-2018 NV Access Limited, Peter Vágner, Aleksey Sadovoy, Rui Batista, Joseph Lee, Leonard de Ruijter, Derek Riemer, Babbage B.V., Davy Kager, Ethan Holliger, Łukasz Golonka
 
 import time
 import itertools
@@ -1374,13 +1374,25 @@ def script_reportStatusLine(self,gesture):
 			ui.message(_("No status line found"))
 			return
 		if scriptHandler.getLastScriptRepeatCount()==0:
-			ui.message(text)
+			if not text.strip():
+				# Translators: Reported when status line exist, but is empty.
+				ui.message(_("no status bar information"))
+			else:
+				ui.message(text)
 		elif scriptHandler.getLastScriptRepeatCount()==1:
-			speech.speakSpelling(text)
+			if not  text.strip():
+				# Translators: Reported when status line exist, but is empty.
+				ui.message(_("no status bar information"))
+			else:
+				speech.speakSpelling(text)
 		else:
-			if api.copyToClip(text):
-				# Translators: The message presented when the status bar is copied to the clipboard.
-				ui.message(_("%s copied to clipboard")%text)
+			if not text.strip():
+				# Translators: Reported when user attempts to copy content of the empty status line.
+				ui.message(_("unable to copy status bar content to clipboard"))
+			else:
+				if api.copyToClip(text):
+					# Translators: The message presented when the status bar is copied to the clipboard.
+					ui.message(_("%s copied to clipboard")%text)
 	# Translators: Input help mode message for report status line text command.
 	script_reportStatusLine.__doc__ = _("Reads the current application status bar and moves the navigator to it. If pressed twice, spells the information. If pressed three times, copies the status bar to the clipboard")
 	script_reportStatusLine.category=SCRCAT_FOCUS


Test patch: