How to color text in private message in mIRC - irc

am tring to input my each text line in private message colored, i use this code it is showing colored text but adding a space before text. how can i remove that space
on *:INPUT:?:{
say 4 $strip($1-)
halt
}
and also now commands like
/clear
is not working .. showing in read but its not working

on input events are sensible
if you dont know how it works, dont mess with it, since it may mess with all your scripts
try this
on *:input:?:{
if (!$inpaste) && (!$ctrlenter) && ($left($1,1) != /) {
command here
haltdef
}
}
by the way, this event must be on top of all on input events to work

Related

How to get the number of lines displayed in a Textmeshpro - text (UI)?

So in my script I want to know how many lines are displayed in a Textmeshpro - text (UI).
public TextMeshProUGUI commentaryText;
Debug.Log("number of lines " + (commentaryText.text.Split('\n').Length - 1));
I tried something like above but it will only show the number of lines with a \n newline character, however I also want to know about lines that are caused by wraparound when they reach the limit of the textbox. Is there a way to get the number of lines that the user sees?
Any advice appreciated. Thanks
Basically you can access commentaryText.textInfo.lineCount to get the number of lines. What I did is that on a button click it logs the number of lines for a TextMeshPro I created, so I was able to test it:
public TextMeshProUGUI textMeshPro;
public void Click()
{
Debug.Log(textMeshPro.textInfo.lineCount);
}
Update for what you'd like from the comments:
You need to set the TMP to align to bottom and set the overflow to masking. Then you need a parent that has a mask component (I used the basic panel). The text that would go outside the size of the parent is hidden.
I'm not sure what you'd like with the line count, but this will count the hidden lines as well. So in my example if you use the lineCount it will log 6.

How do I tell flutter that just inputting SPACE should be considered null in my flutter texting app?

I'm creating a basic texting app on flutter. At the moment just hitting the spacebar n times and hitting send would result in a text bubble with n spaces. How do I tell flutter that just spaces should be considered null or should not be sent?
In general, you should trim the String that you're going to send with the trim method. Trimming removes whitespace that usually isn't needed, just like in this case. Input formatters are not necessary and may prevent users from typing. Wherever you're getting your text input and sending it, add in this trimming.
String toSendString = inputText.trim(); //Send toSendString instead of inputText
You may only want to trim a certain side of the String instead, which can be done with trimLeft or trimRight.
Then, if the string is empty toSendString.isEmpty, don't send the message.
Alternatively, if trimming every message is for some reason undesirable, you can just check if all of the characters are spaces and conditionally send the message based on that with something like the following:
bool isAllSpaces(String input) {
String output = input.replaceAll(' ', '');
return output == '';
}
First of all you need to provide what are you using for the input. So if you are using
Textfield for input you can use Regex Expression in the input so now one cannot start a sentence with a space this is a work around but will stop user to enter blank spaces all the way and should impose at least one letter required.
TextField(
inputFormatters: [
WhitelistingTextInputFormatter(RegExp(r'[^-\s][a-zA-Z0-9-_\\s]+$')),
] ),
Add the inputFormatters property in your textfield. There also may be better solution than this but this will definitely restrict user to not send all blank message

How to make participant input appear on screen and be wrapped (Psychtoolbox)

I’m trying to create a rectangle box on screen in PTB wherein the participant can type text that is wrapped inside this box. So I would like to get the string input to be drawn on screen while typing in a rectangular box where the text input is wrapped to avoid it continuing outside the border of this box. I have been searching for a while now and haven’t found anything that works or anyone who did this before. I assume I might be overlooking something very simple.
I have tried using:
% Textbox
Screen('FrameRect',window, white, [300 300 1600 600],4);
message = [‘Your comments: ‘];
replySubj = Ask(window, message, white, black, 'GetChar',[300 225 1600 600]);
The response input is nicely drawn on screen while typing, but only on one line that is not wrapped when I reach the side of the box, or even my screen. Is their a way to wrap the text (e.g. by integrating WrapString.m) so it stays inside a specified rectangle on screen, and continues to a new line if the text is too long for one line?
Any help is very much appreciated.
Looking at the GetEchoString function, it does the following upon each character strike (to the best of my understanding of how the display is managed):
if it is Ctrl-C, Enter, or Return: exit;
if it is Backspace, issue command to re-draw the previous full string (prompt + user input) with the same colour as the background to erase it ; then remove the last character from the stored full string;
else append the character to the stored full string.
Then issue the command to draw the resulting updated full string in the specified colour, and finally update the screen following the previous commands, with the option dontclearset to 1 (incremental drawing, cf. Screen('Flip', windowPtr, 0, 1) call).
To add wrapping capabilities, we can thus modify GetEchoString as follows:
comment out the re-drawing commands when Backspace is hit, simply updating the stored string (see below);
add a call to WrapString on the updated string to wrap it;
used DrawFormattedText to issue command to display the wrapped string;
finally, call Screen('Flip', windowPtr) that is update the screen with dontclearset to 0 (default).
The relevant part of the function are now thus:
% adapted from PTB3 GetEchoString
while true
if useKbCheck
char = GetKbChar(varargin{:});
else
char = GetChar;
end
if isempty(char)
string = '';
break;
end
switch (abs(char))
case {13, 3, 10}
% ctrl-C, enter, or return
break;
case 8
% backspace
if ~isempty(string)
% Remove last character from string:
string = string(1:length(string)-1);
end
otherwise
string = [string, char];
end
output = [msg, ' ', string];
output=WrapString(output,maxNumChar);
DrawFormattedText(windowPtr,output,x,y,textColor,[],0,0,vLineSpacing);
Screen('Flip',windowPtr);
end
Where maxNumChar and vLineSpacing are to be defined depending on your needs.
This will take care of the horizontal wrapping of the text, while keeping the Backspace function working. Note however that you could still overflow vertically if the whole screen is filled.

highlight expressions on netbeans

I want to know if there is a way to highlight the full content in an expression like if, while, etc.
I have to work in a code that is bad indented where expressions can cover over 1000 lines and I can't format it.
for exemple :
if ($somethingTrue) {
while ($somethingHappen) {
// 500 lines...
} }
if ($someCondition) {
}
look, it's very hard to see the end of the first if and what it cover...
Does someone know if there is a native feature or plugin on netbeans that do this job ?
Thanks !
You don't need any plugin/external jar file for achieving the same. Whichever expression you want to check the body of, just click on the opening brace after that expression and NetBeans will automatically show you the closing brace for that expression.
Basically, Netbeans shows the ending brace for a corresponding starting brace entry---for each of if-statements,loop-statements,method declarations,etc.
In the shown figure, see my if-statement starting with yellow brace(cursor blinking there), and the corresponding ending brace for the if-statement.
EDIT :-
You also can also have a brand new-code fold,just by typing fcom, and hitting (Tab) button on KeyBoard. And, then put whatever block you want inside it and done. Expand whenever you wish and collapse whenever you want.
Check the position of my mouse-pointer which shows the current block of if-statement. You can expand and collapse as per your wish. And, also you can have several of them for each of your expression-tree.

How can i create a textarea that has read and write lines using gtk

Any one know how i can create a text area which displays lines of text which can not be edited but allows you to edit the bottom most line for text.
basically in a similar fashion to embedded consoles inside applications that allow you to run code direct on the application.
currently using a textview i can go and edit the code above and the output response are also editable.
It's possible using a GtkTextView, but not trivial. You have to create a tag that makes the text uneditable, and apply it from the beginning of the buffer to just before the end position. Then when you receive and process input, extend or re-apply the tag to cover that line of input and your program's response to it.
Here's an example of it being done:
creating the tag
applying the tag