We are using clang-format to format our C++17-supporting code base and we would like to add a space before an attribute that appertains to a variable:
int x[[maybe_unused]] = foo(); // clang-format 6 does this
int y [[maybe_unused]] = bar(); // we'd like this
Does anyone know how to make the appropriate adjustments to get that extra space? I've not found any field that I can set in my .clang-format file.
This problem was solved with clang-format 7.
Related
When using MathQuill one needs to type \nsub to get the ⊈ symbol. The latex you get back is \not\subset, which is fine.
But when you try to set back the same \not\subset expression to the MathQuill field, you get a different result : \neg\subset, which translates to a different rendering.
The problem can be reproduced directly on the MathQuill page (http://mathquill.com/) using the browser console :
Any ideas on how to handle or work around this ?
MathQuill will accept \nsub while typing, but also \notsubset, which got me to a simple find-and-replace solution, which does not require any other code change.
Not the best, but it works; the only downside is that the list of text replacements is fixed; the set operators are the one I found; could be more.
// special math pre-processing
var mathFix = {
"\\not\\subset" : "\\notsubset",
"\\not\\supset" : "\\notsupset"
}
var mathTextFixed = '<your latex here>';
Object.keys(mathFix).forEach(function(t1) {
mathTextFixed = mathTextFixed.replace(t1, mathFix[t1]);
});
mathField.latex(mathTextFixed);
Adding this line to the clang-format file gets me an error (basically rejecting the keyword).
AlignConsecutiveAssignment: true
My goal is obviously to have the = operator alingned in consecutive statements like:
a = true;
blueish = false;
What is the way to obtain this with the latest stock Xcode 6.3.1?
Thanks...
I am new to F#, looking at it as an alternative to Matlab.
In reference to this question, how can I create an empty Serie and an empty Frame.
If I did not just miss it, why an empty Serie or Frame has not been designed in the library,
something like list.empty ?
Adding Frame.empty and Series.empty is a great suggestion. I think these should be in the library and I'm adding an issue to GitHub to make sure they get added.
In the meantime, you should be able to use something like this:
let empty : Series<int, float> = series []
let empty : Frame<int, string> = frame []
Note that I had to add type annotations - from my code snippet, the compiler cannot figure out what is the type of keys and values, so I had to explicitly specify that (but if you use the values as arguments to other functions, then this should not be needed).
The second line does not actually work in the current version, because of a bug (oops!) so you can use Frame.ofRows instead, which works fine:
let frame : Frame<int, string> = Frame.ofRows []
EDIT: The bug is now fixed in version 0.9.11-beta
I'm trying to write something like rtf editor in BCB6 and I've encountered such problem while trying to add table to my RichEdit1:
RichEdit1->PlainText=true;
AnsiString ret=RichEdit1->Text;
ret.Insert(table, RichEdit1->SelStart);
RichEdit1->Text=ret;
RichEdit1->PlainText=false;
RichEdit1->Repaint();
This code adds formatted text (code of table) to the RichEdit1 instead of adding formatting code as plain text and displaying it like a table.
Am I doing it wrong, or it can be a problem with something else.
The PlainText property is only used by the Lines->LoadFrom...() and Lines->SaveTo...() methods, nothing else.
The Text property only operates on plain text. Reading the property extracts the RichEdit's textual content without formatting. Setting the property does not process RTF code at all, the RichEdit's textual content is replaced with the new text as-is.
If you want to insert RTF code into the RichEdit, especially if you don't want to overwrite the RichEdit's current content, you will have to use the EM_STREAMIN message directly. For example:
DWORD CALLBACK StreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
{
int numRead = reinterpret_cast<TStringStream*>(dwCookie)->Read(pbBuff, cb);
if (pcb) *pcb = numRead;
return 0;
}
TStringStream *strm = new TStringStream(table);
EDITSTREAM es = {0};
es.dwCookie = (DWORD_PTR) strm;
es.pfnCallback = &StreamInCallback;
SendMessage(RichEdit1->Handle, EM_STREAMIN, SF_RTF | SFF_SELECTION, reinterpret_cast<LPARAM>(&es));
delete strm;
Problem solved, formatting was not added because of table code was not in {} brackets, after adding them around table code and using SendMessage, program works well.
I am using TAdvMemo. My problem is with the WordWrap property. It works very well when I type text in the text area, but when I add a string to it in code, it has no effect.
I have set WordWrap property to: wwRightMargin and RightMargin property to 80, but not see other property that can help me, so i ask some idea as solve it?
i mean for example:
AdvMemo.Lines.Add(MyString);
where MyString is a string as: 'hello word'. When it is longer than 80 chars, and wrap is enabled, it should wrap to a new line, but instead it's all on the same line.
Try using AdvMemo.InsertText instead. Lines.Add doesn't care about wrapping, it just handles some special chars in the string.
After you added text to adv memo you must update wrap by calling UpdateWrap() function. Here is an example for you:
AdvMemo.Lines.Add(MyString);
AdvMemo.UpdateWrap();
or
AdvMemo.Lines.Text(MyString);
AdvMemo.UpdateWrap();
Be sure that WordWrap property of Adv Memo is different than wwNone.