This is a limitation of the Microsoft RichTextBox. I discovered that the character \u1? appeared to function as a hardspace. This is only used when the text is displayed and not when it is edited, so, you need to move off the window to see the effect.
This commit is contained in:
parent
726bf187cd
commit
4109bb7bfe
@ -455,7 +455,7 @@ namespace Volian.Controls.Library
|
||||
if (!readOnlyStep)
|
||||
{
|
||||
StepConfig sc = new StepConfig(MyItemInfo.MyContent.Config);
|
||||
if (sc.Step_BackgroundToSource != null || sc.Step_DeviationToSource != null)
|
||||
if (IsDerived(sc))
|
||||
readOnlyStep = true;
|
||||
}
|
||||
ReadOnly = readOnlyStep || VwMode == E_ViewMode.View || ActiveMode == false;
|
||||
@ -521,11 +521,35 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
}
|
||||
}
|
||||
// This is to fix an issue with Hard Spaces. To Summarize:
|
||||
// The Microsoft RichTextBox has a problem with hardspaces, that they don't work between numbers and lettters
|
||||
// This is the majority of cases for PROMS including ROs (Sepoint Number and Units) and transtions (Step ###)
|
||||
// As I investigated this further I found that if you pass a rtf unicode value for a hard space (\u160?) to
|
||||
// the RichTextBox, the RichTextBox will return an ASCII representation (\'A0). If you pass an ASCII representation
|
||||
// the RichTextBox will return a space.
|
||||
// Alternatively, If you pass a unicode representation of zero (\u0?) it acts like a hard space and returns an ASCII
|
||||
// representation (\'00). If you pass in the ASCII representation, it truncates the text.
|
||||
// The following two lines replace hard spaces (ASCII) with the UNICODE represntation of Zero.
|
||||
// Lastly, If you pass a unicode representation of one (\u1?) it acts like a hard space and returns an ASCII
|
||||
// representation (\'01). If you pass in the ASCII representation, it keeps the ASCII representation.
|
||||
// The following two lines replace hard spaces (ASCII) with the UNICODE represntation of Zero.
|
||||
// Other characters which behave like hard spaces are 28-31 and 128-159.
|
||||
if (!activeMode && Rtf.Contains(@"\'a0"))
|
||||
Rtf = Rtf.Replace(@"\'a0", @"\u1?");
|
||||
OrigRTF = Rtf;
|
||||
_InitializingRTB = false;
|
||||
|
||||
AdjustSizeForContents(!ActiveMode);
|
||||
}
|
||||
|
||||
private bool IsDerived(StepConfig sc)
|
||||
{
|
||||
foreach (EnhancedDocument ed in sc.MyEnhancedDocuments)
|
||||
if (ed.Type == "Source")
|
||||
// if (ed.Type == 0) //New Design
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
private bool _ProcessKeystrokes = true;
|
||||
public bool ProcessKeystrokes
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user