Godot Text Edit Node not wrapping - godot

Working on an app that is quite UI intensive in Godot and it seems the wrap_lines option isn't working on the text edit nodes. it still scrolls horizontally as I type or if I set text it just does one long line. Is there a second option I need to change in the node

I have a similar circumstance to your problem with my app and did my own custom solution. However, I am OK with just limiting the number of characters instead of wrapping the lines. My solution only covers limiting the line up to a certain number of characters. This is what I have for my solution:
func _on_TextArea1_text_changed():
var temp = $TextArea1.text
var maxTextSize = 9
if temp.length() > maxTextSize:
$TextArea1.text = temp.substr(0,maxTextSize)
Limitation: If I try to concatenate '\n' I get "Stack Overflow (Stack Size:1024)".
Resource: See https://docs.godotengine.org/en/stable/classes/class_textedit.html
Hope this helps.

Documenting how I fixed wrapping on my TextEdit:
The text property of your TextEdit node must be set after setting wrap_enabled to true. If you set text before, it will not be wrapped.
Took me hours to figure out what was going wrong. Extremely frustrating... Hope this saves someone else from the same.

Related

Counting up within text program?

I am editing app code to increase floors in tiny tower.
My dilemma is I need to have a large amount of text with a single number increasing by one after some constant text repeating over and over.
Sorry, I'm not good at describing what I need so I'll show y'all an example of what I need.
[Fs]**X**[Fs][Ff]58[Ff][Fl]1[Fl][Fod]0[Fod][Fsbt]1[Fsbt][Fsi]-1[Fsi][Fst]-1[Fst][Fstk]0,0,0[Fstk][Flst]0,0,0[Flst][Fn][Fn]|
I need this line of text repeating over and over again with the exception of the bolded X increasing by 1 every time the text repeats.
Such as
[Fs]**1**[Fs][Ff]58[Ff][Fl]1[Fl][Fod]0[Fod][Fsbt]1[Fsbt][Fsi]-1[Fsi][Fst]-1[Fst][Fstk]0,0,0[Fstk][Flst]0,0,0[Flst][Fn][Fn]|[Fs]**2**[Fs][Ff]58[Ff][Fl]1[Fl][Fod]0[Fod][Fsbt]1[Fsbt][Fsi]-1[Fsi][Fst]-1[Fst][Fstk]0,0,0[Fstk][Flst]0,0,0[Flst][Fn][Fn]|[Fs]**3**[Fs][Ff]58[Ff][Fl]1[Fl][Fod]0[Fod][Fsbt]1[Fsbt][Fsi]-1[Fsi][Fst]-1[Fst][Fstk]0,0,0[Fstk][Flst]0,0,0[Flst][Fn][Fn]|[Fs]**4**[Fs][Ff]58[Ff][Fl]1[Fl][Fod]0[Fod][Fsbt]1[Fsbt][Fsi]-1[Fsi][Fst]-1[Fst][Fstk]0,0,0[Fstk][Flst]0,0,0[Flst][Fn][Fn]| ETC...
I have manually written this code out to 5000 lines and I can't take it anymore. I don't know how many I need but if someone could give me either straight up the text that I need or some way for me to do it myself that would be amazing.
I need it to count up to at least 10k and id say 100k at the max.
Thanks for your help and please ask any questions if you need them answered to further help me.
In bash you could do
printf '[Fs]%s[Fs][Ff]58[Ff][Fl]1[Fl][Fod]0[Fod][Fsbt]1[Fsbt][Fsi]-1[Fsi][Fst]-1[Fst][Fstk]0,0,0[Fstk][Flst]0,0,0[Flst][Fn][Fn]|\n' {1..100000} > /path/to/the/outputfile
To create a file outputfile with the first 100k lines.
On Linux or Mac open a terminal (on Windows you can use WSL, gitbash, or cygwin), type bash, press enter, type the command from above, press enter again.

Python script in Colab keeps throwing error message: IndentationError: unindent does not match any outer indentation level

I'm currently using Google Colab in order to take advantage of its free GPU. I was trying to modify a code that I copy and pasted from machinelearningmaster.com. However, whenever I try to add a new code line, for example "print("some words"), I get an indention error.
I have tried adding tabs or spaces before the print call but I still get the error. for example:
space,space,print("some words")
tab, tab ,print("some words")
I have also checked the colab editor settings, currently the indention width setting are set to two spaces.
The first three lines are part of the original code, the print statement is
my addition. I copy and pasted this directly from the colab editor. In Colab all four lines are aligned. As you can see here only the first three lines are aligned. I don't know what's going on.
img_path = images_dir + filename
ann_path = annotations_dir + image_id + '.xml'
count=count+1
print("this is count: ", count)
I expected this to print the value of count, instead I get an error message telling me:
IndentationError: unindent does not match any outer indentation level
Okay, after much searching and frustration, I have an idea of what went wrong, but even better, a solution to fix it.
It appears that the Google Collaborator (Colab) editor does not have a way to set it for tabs "\t" versus space (space-bar entries). From the settings tab on the cell you can set the width of the tab from 2 to 4, but these will be interpreted as 2 to 4 space-bar entries. Usually, this isn't a problem. However, if you're like me and you want to test out code from the web, or be lazy and just copy paste from your editor, problems can arise.
Here's how I fixed it. Before pasting the copied code into Colab, first put it into notepad++. Go to View> Show Symbols >Show All Characters, click on this, you should now be able so see all the characters in the code. Find a tab, it will look like an arrow pointing to the right -->, right click and copy it. Open Search> Find, open the Replace tab. Depending on your version of notepad++ the tab you copied will automatically be entered and the replace will already be set to four spaces. Hit "Replace all". This will automatically replace all tabs with equivalent spaces. Copy the code from notepad++ back to Colab. Now there will be no more conflicts.
I think using a simple find and replace tool will just work fine. I also came across this error recently in Colab and I went through #Rice Man solution. The only difference was I used Libre office writer instead of Notepad++. I also found this tool to be helpful. I am not proficient in using Colab but this solution worked for me.
Another quick fix that worked for me related to this question.
I was trying to run a python script in colab and faced this error though the line seems at an appropriate indentation in that script.
I checked with the !cat filename.py cmd, and found out that the actual indentation appears different than it is in the script (hence the error).
Taking that unindented line (according to the colab) at the start of the line and using space afterward fixed the error.
I used this website to fix the error.
Copy your code to the site, then click beautify button on top left. This will remove indention errors.
If you want to know where the indention error is coming from, use #Prachi answer.

Soft lines after html elements and a specific letter showing wrongly in Linux

The previous week I moved my local server with my site from a computer with Windows to another one with Linux.Thats when i noticed that there are some weird soft lines after elements and the letter "Λ" (which is greek) showing like its damaged.Its important to mention that if i zoom out the letter is displayed correctly.Also i visited my site from a PC with windows and everything seems fine. I hope that these photos will help you understand better the problem.
Soft Lines + Letter Problem
Soft Lines + Zoom Out
I have read somewhere (don't remember much where exactly) that many problems of the sort are caused by the encoding.
So you might want to ensure that your characters are UTF-8.
Have a look at this article
Hope it helps

Mediawiki/wikipedia text format issue

so i got an issue with text formatting and i have no idea how this problem is called or what i should search after, so i thought i try to explain it here.
It's literally nothing dramatic or should take long, i simply want to write stuff like
''italic'' or '''bold'''
without that it actually gets italic or bold... i literally want
''italic''
to be displayed. I've also tried to use code blocks but even within the blocks it writes italic then.. i'm sure there is a <..> command but i simply can not find it
Does anyone know?
try this:
<nowiki>''italic''</nowiki>

JTextArea setWrapStyleWord(true) does not work if appending text

According to Oracle at JTextArea documentation, if you wish to wrap lines AND wrap at word boundaries and not character boundaries you must use code as follows:
jtaOutputPrimes.setLineWrap(true);
jtaOutputPrimes.setWrapStyleWord(true);
Please note that the jtaOutputPrimes is the name of my JTextArea on my JPanel.
The issue comes in when I use the method append to add text to the JTextArea as follows:
jtaOutputPrimes.append(",");
In this case, the setWrapStyleWord setting does not work. It continues to use the character boundaries and not the word boundaries.
I have found another person experiencing same issue here: setWrapStyleWord issue
Now, lets say you are running an JApplet that has this JTextArea. If you type in the text area, it will word wrap fine, but any passed text from the append method does not work.
I believe this is a bug, and I cannot find Oracle acknowledge it as such anywhere.
Can anyone help? Thanks!
I found out why this was happening, and this simple fix may be beneficial to others. The issue came into play because when I appended the comma (,) to the JTextArea it was eliminating the white space between words. To fix this, I simply placed a space after the comma like so, and it worked.
jtaOutputPrimes.append(", ");

Resources