mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-02-07 04:10:08 +00:00
Underline whitespace atoms in TextEditor when font is underlined
This commit is contained in:
parent
4ddcc7bb61
commit
508d6de04e
2 changed files with 18 additions and 3 deletions
|
|
@ -281,7 +281,8 @@ struct TextEditor::Iterator
|
|||
bottomRight (ed.getMaximumWidth(), ed.getMaximumHeight()),
|
||||
wordWrapWidth (ed.getWordWrapWidth()),
|
||||
passwordCharacter (ed.passwordCharacter),
|
||||
lineSpacing (ed.lineSpacing)
|
||||
lineSpacing (ed.lineSpacing),
|
||||
underlineWhitespace (ed.underlineWhitespace)
|
||||
{
|
||||
jassert (wordWrapWidth > 0);
|
||||
|
||||
|
|
@ -511,7 +512,7 @@ struct TextEditor::Iterator
|
|||
//==============================================================================
|
||||
void draw (Graphics& g, const UniformTextSection*& lastSection, AffineTransform transform) const
|
||||
{
|
||||
if (passwordCharacter != 0 || ! atom->isWhitespace())
|
||||
if (passwordCharacter != 0 || (underlineWhitespace || ! atom->isWhitespace()))
|
||||
{
|
||||
if (lastSection != currentSection)
|
||||
{
|
||||
|
|
@ -684,6 +685,7 @@ private:
|
|||
const float wordWrapWidth;
|
||||
const juce_wchar passwordCharacter;
|
||||
const float lineSpacing;
|
||||
const bool underlineWhitespace;
|
||||
TextAtom tempAtom;
|
||||
|
||||
void moveToEndOfLastAtom()
|
||||
|
|
|
|||
|
|
@ -249,7 +249,7 @@ public:
|
|||
|
||||
@see setFont
|
||||
*/
|
||||
const Font& getFont() const noexcept { return currentFont; }
|
||||
const Font& getFont() const noexcept { return currentFont; }
|
||||
|
||||
/** Applies a colour to all the text in the editor.
|
||||
|
||||
|
|
@ -258,6 +258,18 @@ public:
|
|||
*/
|
||||
void applyColourToAllText (const Colour& newColour, bool changeCurrentTextColour = true);
|
||||
|
||||
/** Sets whether whitespace should be underlined when the editor font is underlined.
|
||||
|
||||
@see isWhitespaceUnderlined
|
||||
*/
|
||||
void setWhitespaceUnderlined (bool shouldUnderlineWhitespace) noexcept { underlineWhitespace = shouldUnderlineWhitespace; }
|
||||
|
||||
/** Returns true if whitespace is underlined for underlined fonts.
|
||||
|
||||
@see setWhitespaceIsUnderlined
|
||||
*/
|
||||
bool isWhitespaceUnderlined() const noexcept { return underlineWhitespace; }
|
||||
|
||||
//==============================================================================
|
||||
/** If set to true, focusing on the editor will highlight all its text.
|
||||
|
||||
|
|
@ -729,6 +741,7 @@ private:
|
|||
bool menuActive = false;
|
||||
bool valueTextNeedsUpdating = false;
|
||||
bool consumeEscAndReturnKeys = true;
|
||||
bool underlineWhitespace = true;
|
||||
|
||||
UndoManager undoManager;
|
||||
std::unique_ptr<CaretComponent> caret;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue