Problem With Text Display When There Are Right-To-Left Characters

The text is supposed to be displayed as (BBEdit):
The tabs are at the beginning of the lines.

image

But it is displayed in KM as below:
The tabs are displayed as if they are at the end of the lines.**

Shell Script - sed.kmmacros (2.4 KB)

The same problem with "Display Text in Window":

image

@peternlewis Any possibilities that it could be improved in the future?

I'm afraid this is a bug in the OS, not Keyboard Maestro. It affects Text Views. I tried to find other apps using Text Views, but they aren't all that common - often if you need to have multiline text you end up with a full blown editor instead. But you can see it for example in the Write a Review field in the App Store, and it has the same behaviour there. Looks like confusion about the line direction.

1 Like

Thanks. Is there any way to get around this?

What is the best way to report it to Apple for them to take a look at it?

I did not see Apple provide a "public"-forum-like platform for report bugs. I reported the problem with Safari's handling of the Clipboard.

It became somewhat like AppleCare support. The communication is only me and the engineers via a customer service representative. The representative was friendly, responsive. But I don't think it is the best way to handle bugs/or bug-like issues.

AppleScript displays text expectedly. Does AppleScript display the dialogue in a different way? @peternlewis

display dialog "Test Text" default answer "

Total number of verses = 359
  (total number of verses displayed = 359) 

[VERB hofal] (390 total words)

Number of different forms = 206:
(Triple-click a form to see its occurrences)

		אחז־1	(אחז)	to hold = 1
					מָאֳחָזִים = 1
		בוא	to come = 24
					הֻבָאת = 1
					הֻבָאתָה = 1
					הוּבָא = 6
					הוּבְאוּ = 1
					יוּבָא = 5
					יוּבָאוּ = 1
					מּוּבָא = 5
					מוּבָאוֹת = 1
					מוּבָאִים = 3
		בוס	to trample = 1
					מוּבָס = 1
		בקע	to cleave, split = 1
					הָבְקְעָה = 1

"

Result:
image

Yes. Different controls. AXTextArea vs AXTextfield.

The complexity there comes from the mix of RTL and LTR.

The trick might be to step back a bit, define the pragmatic outcome that you need, and choose a different channel through which to display.

Mellel is a good editor for interleaving LTR and RTL, and the Google Apps do quite well. Sublime Text does less well.

One has just has to choose the instrument for the job.

2 Likes

Thanks, @ComplexPoint.
I'm also using Mellel.

But for me, I need to process the texts first in KM and then export to other apps.
When I was testing my actions, I use Display Text in window to show how the actions work. The problem I mentioned above led me to think that the tabs at the beginning of the lines are all trimmed. I could find other ways to show display the texts, but if there is no issue with the text display in KM, it's much more convenient, especially when I'm building/testing macros.

How to test this difference with AppleScript?
I use the code below and get a similar display.

display dialog myText with title "Result"

image

Use some other way to display the next - use the Custom HTML Prompt action or open it as a document in BBEdit or maybe TextEdit.

Feedback Assistant. Report it as a bug in the OS and demonstrate it using the App Store reviews so that it is all first-party software and they can't simply say its not their problem.

Reporting bugs to Apple is hit and miss, with a lot more miss than hit.

1 Like

This is Genius! I'm so glad I asked! I used the variables to set the default input/text field, but I never thought of using it as a substitute for "Display Text in Window".

I'm very happy with this solution! Thank you so much!!!

(I'll let others worry about the text display in Apple. I think I reported the Safari issue as a bug to Apple. After I reported the issue with Safari, I've had four-five phone calls with Apple representatives. They are very nice talking to and I'm grateful for them. But after so many talks, now I'm still waiting for updates from them. Really don't want to go through this process again.)

1 Like