Strange rendering behaviour with parenthesis in SwiftUI - swiftui

I am rendering a Text with a custom string inside it surrounded by parenthesis. I am not sure if this is a bug or I am doing something wrong, as the alignment seems totally broken.
Here is the code:
Text("All ()()\(allAutoFX.count) ))(()")
and here is the result, where you can see different base lines for the parenthesis before / after the count:
https://imgur.com/a/oJT8ssY

Related

SwiftUI: How to suppress line breaks for a part of texts?

I would like to prevent line breaks in a parts of SwiftUI Text - for example, when I have label like Car speed is 10 m/s., I would like to force SwiftUI to keep the m/s (or preferrably 10 m/s) together (but still allow it to do linebreaks elsewhere in text).
With default settings, the label might break like this 10 m<br>/s, which I'd like to prevent.
If the character in question would have been dash, I could use a non-breaking dash, but no such luck here.

Is there a SwiftUI equivalent for lineBreakMode for Text views?

I have a Text view, and I would like to configure it to wrap the first character that doesn't fit. In UIKit, this would be the equivalent of setting label.lineBreakMode = .byCharWrapping. Has this been implemented for SwiftUI Text yet? I haven't been able to find anything in the documentation for Text.
The reason that I want to do this is that I'm displaying a long code to the user, so wrapping by character rather than by word is desirable.
Not sure if this helps, but I am using the following which leads to long words getting wrapped by characters:
Text("Supercallifragilisticexpialidocious")
.font(.system(size: 100))
.minimumScaleFactor(0.01)
.lineLimit(3)
.multilineTextAlignment(.leading)
Unfortunately for my use case, I do not want the Text to wrap by characters. If I set lineLimit(1) that works fine and the font size is reduced to keep the Text on 1 line. But if Text is multiple words such as Text("Practically perfect in every way") then I want the string wrapped by word. I can't seem to get both Word wrapping for multiple words and font scaling for long words.

How to fix truncated syntax highlighting in Xcode for Macron Characters

In my project, I'm attempting to use identifiers with Macrons in them (which is perfectly valid, and everything still compiles).
The problem is that Xcode truncates syntax highlighting after the first occurrence of a character with a macron.
The standard answers for text highlighting issues have been:
Turn it off and on again.
Delete Derived Data, and turn it off and on again.
I've tried both with no success.
This example photo uses typedef to demonstrate the issue. For reference, ira and tōpū both roughly equate to float and int.
As you can see, the highlighting stops after the first t of tōpū, but ira is fully highlighted.
I would like to know how to get Xcode to recognise the macron characters and continue highlighting the entire identifier. Thanks!

Code::Blocks doesn't show all code completion

When I write a function, variable etc. matches are displayed very strange (I wrote "bass_l", but it still shows matches what begin with "bass_i"). And I can't see matches below "BASS_INPUT_TYPE_SPEAKER" just because they go under my screen.
Is there any way to fix this?

syntax highlighting between matching parenthesis

Say I hava a LaTeX document open in Vim, and I want to highlight every occurence of
{\color{red} ... }
(where the dots are supposed to symbolize some contents), that is, I want to have {\color{red}, } and everything between these highlighted. This I have done with
:syn region WarningMsg start=+{\\color{red}+ end=+}+
but I have the problem that, if I write something like {\color{red} some{thing} important}, then it is only {\color{red} some{thing} which gets highlighted, because Vim of course mathces the first occurrence of }. How can I make this Highlighting rule so that it skips matching curly brackets? Even multiple levels of such.
For clarity it is better to give each syntax region a bespoke name, and then link it to a standard colour group. I have renamed your original region redTeX.
You need to define a second region, innerBrace, defining the braces you want to ignore, and mark this region as transparent. Then redTeX should be marked to contain the transparent region, which it will then ignore.
syn region innerBrace start=+{+ end=+}+ transparent contains=redTeX
syn region redTeX start=+{\\color{red}+ end=+}+ contains=innerBrace
hi link redTeX WarningMsg
Note that in this case there is the added subtlety that redTeX itself matches as an innerBrace. I fixed this by marking innerBrace as containing redTeX.
Hope that makes sense!