mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 03:52:19 +02:00
Add option for configuring mMaxCol with mWrapCommentsAt
This commit is contained in:
parent
5c320fa9c9
commit
acc2e5b14c
4 changed files with 8 additions and 4 deletions
|
@ -120,7 +120,7 @@ namespace IDE.Compiler
|
|||
static extern bool BfParser_Reduce(void* bfParser, void* bfPassInstance);
|
||||
|
||||
[CallingConvention(.Stdcall), CLink]
|
||||
static extern char8* BfParser_Format(void* bfParser, int32 formatEnd, int32 formatStart, out int32* outCharMapping);
|
||||
static extern char8* BfParser_Format(void* bfParser, int32 formatEnd, int32 formatStart, out int32* outCharMapping, int32 maxCol);
|
||||
|
||||
[CallingConvention(.Stdcall), CLink]
|
||||
static extern char8* BfParser_GetDebugExpressionAt(void* bfParser, int32 cursorIdx);
|
||||
|
@ -207,7 +207,7 @@ namespace IDE.Compiler
|
|||
public void Reformat(int formatStart, int formatEnd, out int32[] char8Mapping, String str)
|
||||
{
|
||||
int32* char8MappingPtr;
|
||||
var stringPtr = BfParser_Format(mNativeBfParser, (int32)formatStart, (int32)formatEnd, out char8MappingPtr);
|
||||
var stringPtr = BfParser_Format(mNativeBfParser, (int32)formatStart, (int32)formatEnd, out char8MappingPtr, gApp.mSettings.mEditorSettings.mWrapCommentsAt);
|
||||
str.Append(stringPtr);
|
||||
|
||||
char8Mapping = new int32[str.Length];
|
||||
|
|
|
@ -625,6 +625,7 @@ namespace IDE
|
|||
public FileRecoveryKind mEnableFileRecovery = .Yes;
|
||||
public bool mFormatOnSave = false;
|
||||
public bool mSyncWithWorkspacePanel = false;
|
||||
public int32 mWrapCommentsAt = 0;
|
||||
|
||||
public void Serialize(StructuredData sd)
|
||||
{
|
||||
|
@ -650,6 +651,7 @@ namespace IDE
|
|||
sd.Add("EnableFileRecovery", mEnableFileRecovery);
|
||||
sd.Add("FormatOnSave", mFormatOnSave);
|
||||
sd.Add("SyncWithWorkspacePanel", mSyncWithWorkspacePanel);
|
||||
sd.Add("WrapCommentsAt", mWrapCommentsAt);
|
||||
}
|
||||
|
||||
public void Deserialize(StructuredData sd)
|
||||
|
@ -679,6 +681,7 @@ namespace IDE
|
|||
sd.GetEnum<FileRecoveryKind>("EnableFileRecovery", ref mEnableFileRecovery);
|
||||
sd.Get("FormatOnSave", ref mFormatOnSave);
|
||||
sd.Get("SyncWithWorkspacePanel", ref mSyncWithWorkspacePanel);
|
||||
sd.Get("WrapCommentsAt", ref mWrapCommentsAt);
|
||||
}
|
||||
|
||||
public void SetDefaults()
|
||||
|
|
|
@ -126,7 +126,7 @@ namespace IDE.ui
|
|||
AddPropertiesItem(category, "Enable File Recovery", "mEnableFileRecovery");
|
||||
AddPropertiesItem(category, "Format on Save", "mFormatOnSave");
|
||||
AddPropertiesItem(category, "Sync with Workspace Panel", "mSyncWithWorkspacePanel");
|
||||
|
||||
AddPropertiesItem(category, "Wrap comments at length (0 = none)", "mWrapCommentsAt");
|
||||
category.Open(true, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -3800,13 +3800,14 @@ BF_EXPORT bool BF_CALLTYPE BfParser_Reduce(BfParser* bfParser, BfPassInstance* b
|
|||
}
|
||||
|
||||
static Array<int> gCharMapping;
|
||||
BF_EXPORT const char* BF_CALLTYPE BfParser_Format(BfParser* bfParser, int formatStart, int formatEnd, int** outCharMapping)
|
||||
BF_EXPORT const char* BF_CALLTYPE BfParser_Format(BfParser* bfParser, int formatStart, int formatEnd, int** outCharMapping, int maxCol)
|
||||
{
|
||||
BP_ZONE("BfParser_Reduce");
|
||||
String& outString = *gTLStrReturn.Get();
|
||||
outString.clear();
|
||||
gCharMapping.Clear();
|
||||
BfPrinter bfPrinter(bfParser->mRootNode, bfParser->mSidechannelRootNode, bfParser->mErrorRootNode);
|
||||
bfPrinter.mMaxCol = maxCol;
|
||||
bfPrinter.mFormatStart = formatStart;
|
||||
bfPrinter.mFormatEnd = formatEnd;
|
||||
bfPrinter.mCharMapping = &gCharMapping;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue