In there a convenient way to have multiline input in libedit/editline - c

Using libedit/editline, and trying to figure out a good way to do multiline input/editing. The target is an SQL client, where queries will often span multiple lines and terminate with ;.
I can call el_gets, and process each line of input, stopping when I see the terminating ;. I can even concatenate those and store them as a single entry in el_history - and it will correctly access them when using the arrows to scroll through history.
However, when entering the command and after starting a new line, I can no longer use the arrows to move up and edit the previous line. E.g.:
prompt> SELECT * FROM table
WHERE 🀫
At that point, I'd like to be able to use the up-arrow, to move up and edit the text already entered on the first line. Is this possible? How would one do so? I assume that using el_gets isn't correct in this case, since it would remove the line from the editline buffering, yet I don't see an alternative API that would work.
Thoughts?

Related

LogicApp Split and Replace having problems with \n

I have been trying to split a string into an array of each line \n
As this doesn't work I tried replacing replace(outputs('Compose_6'),'\r\n','#') with a view to then splitting on #.
I have searched the internet and tried various things but nothing seems to work.
Can someone explain how to do this?
Thanks in advance
Using split(variables('string var'),'\n') expression, you can split string into array. By default logic app will add an extra black slash to original back slash. So suggesting you to change expression in code view as mentioned above.
I have created logic app as shown below,
In first initialize variable action, taken a string variable with text as shown below
Hello
Test split functionality
Using logic apps
Next initialize variable action, using a array variable and assigning value using expression as split(variables('string var'),'\n'). Make sure you dont have double back slash added in code view. Only one back slash should be there when you see it in code view.
Code view:
The output of logic app can be shown below,
Refer this SO thread.

If a line of text is separated into multiple text leaves in the accessibility tree, is it still accessible well?

Below is a picture of my current accessibility tree. You can see that the 4 text leaves in it are separated, but it still forms only one line of content. Is this still accessible well ("well" meaning screen readers can detect that they form one complete sentence), or should all of the text leaves be combined into one leaf?
If they should be combined, how can you concatenate variables into the text in React, while keeping it as one single leaf? This is my current code: <p>{cloudiness}% ({cloudinessDescription})</p>
How they are read aloud depends on the screen reader being used. VoiceOver reads it as one phrase, but that doesn't mean others will. Having it split up wouldn't be a nice experience, but it doesn't mean it's not accessible.
If you really want to make sure it's read as one phrase but don't like the noise of the template literal inside the JSX (I agree), why not define the string somewhere else until you are able to test on multiple screen readers?
const cloudinessSummary = `${cloudiness}% (${cloudinessDescription})`;
return <p>{cloudinessSummary}</p>;

Eclipse: how can I copy code WITHOUT selection highlighting?

If I copy a block of code in C and paste it into Word, the syntax highlighting works well. But if I copy a single word on a line, the selection ("highlight") is also copied, meaning that the text pasted into Word is dark blue, and almost unreadable.
The fix seems to be to copy the entire line including the EOL char, then the "selection" part goes away.
I used InsideClipboard to view the RTF of each case, and the single word selection version has a "\highlight2" tag around the text. That seems to be the issue.
Is there a way of getting rid of this, while retaining the other- actually useful- syntax highlighting?
Bad: (if I copy just the selected word "FooText")
{\highlight2
{\cf0 }
{\cf0\b FooText\b0}
}
Good: (if I copy the entire selected line, including EOL)
{\cf0 FooTex}
{\cf0\ul t\ul0}
There is probably a bug in this version of Eclipse causing the highlighting to be incorrect / inconsistent
You can paste as text-only in Word using Paste-Options (Ctrl-Alt-V)

C - Is there a way to remove a mvwprintw from my window? (Ncurses)

I want my mvwprintw statement to disappear after a point in the code. I don't know how delete the print statement though. Is there a print function that can do it? I tried by creating another statement full of spaces thinking it would overlap the existing statement and it would look blank. I tried looking online but could not find anything. Please let me know if there is a way.
You can clear the whole line by moving to the beginning of a line
move(3,0);
and then clearing the line
clrtoeol();
I actually found a way, hopefully this helps someone with the same problem in the future. All you need to do is to add \rat the beginning of your statement and it will over wright anything previously in that spot.
mvwprintw(win2,3,16,"Hi.");
mvwprintw(win2,3,16,"\rPlease make your first move."); //overwrites the "Hi"
mvwprintw(win2,3,16,"\rPlease make your second move.");//overwrites the "Please make your first move"
Adding blank spaces into the print statement would erase your previous message.

WPF Flowdocument - Prevent line break before % sign

I've got a FlowDocument generating a document for a client, and it's getting a line break that they don't like. Is there any way to mark a section of text that it should avoid line breaks? Something like this:
<Paragraph>Here is a paragraph where there should be <span NoLineBreak=True>no line break</span> in a certain part.</Paragraph>
Obviously, a Span doesn't have a NoLineBreak property, but I'm wondering if there's some equivilant functionality available, or if someone can get me started on a way of implementing a SpanWithNoLineBreak class or RunWithNoLineBreak class?
UPDATE
Actually, one issue I'm having is with a percent sign, where there isn't even a space:
<Paragraph>When I print and ½% I want the one-half and '%' symbols to not line break between them.</Paragraph>
The & #x00BD; is the unicode for a ½ symbol. I'm getting a line wrap between the 1/2 and the % even though there's no space between them.
The Unicode character "Word Joiner" (U+2060) is intended for just this purpose. It "does not normally produce any space but prohibits a line break on either side of it" (Wikipedia). You place it between U+00BD and '%' to prevent a line break between them.
Unfortunately, WPF (or perhaps the typical fonts supplied with Windows) don't support it properly, and instead render it as a square box. As an alternative, you could use U+FEFF; the use of this character as a zero-width non-breaking space is now deprecated (it's reserved for use as a byte-order mark), but it worked as a line-break-preventer for me.
Finally, there are some other characters that can also be used for this purpose: U+202F (narrow no-break space) also prevents breaking, but also renders as a very thin space. U+00A0 (no-break space) prevents breaking and displays as a normal space.
Try replacing the spaces with non-breaking spaces.
EDIT: Well there's always the backup plan of just putting in TextBlocks in your FlowDocument with TextWrapping=NoWrap, but I'd try to find a better way...

Resources