Bugs in TextEditor: press [end] key, line break up and line spacing


#1
  1. in TextEditor, press [end] key can’t reach the end of the line when the content is CJK text.

  2. There is no way to set line break up, so it will break up the content ahead of schedule when white space(s) blends in CJK characters.

  3. Request agian mightily:
    TextEditor::setLineSpacing (const float lineSpacing);

Thanks!!!


#2

If I request an RichTextEditor based on WYSWYG, will I be killed? :worried:


#3

no any help… It seems even worse than killed me…:no_mouth:


#4

I have tried reproducing these issues with the Keyboard Viewer on Mac using different CJK languages but it seems to work fine. If you have any suggestions on how to fix these issues then I’d be happy to take a look.

Ed


#5

OK, please try this text (Chinese mixed some English words for example):

editor->setMultiLine (true);
editor->setReturnKeyStartsNewLine (true);

血糖高只是一个表象,不是疾病的根源,它告诉人们体内出现了问题,如果你把表象掩盖了(例如单纯降糖),就像试图捂住燃烧的火一样,疾病的进程将继续加重下去。因此,解决糖尿病的最有效方式是稳定血糖,而稳定JUCE forum 血糖的唯一方式就是摄入正确的食品。任何治疗糖尿病,如果没有结合于稳定血糖的饮食方式,其效果只能是短期的,过一阶段,血糖的水平 Is that true? 还会高,因为导致血糖高very very good 的因素(例如前面所提到的食品)并没有得到纠正。 综上所述,只有通过选择具有稳定血糖作用的食品,或者通过食品之间的正确搭配而达到稳定血糖效果的混合食品,这样的饮食方式才能使机体的血糖水平自然而然的降低下来,同时 line break up 避免吃(或喝)含果糖高的食品(或饮料)。血糖水平正常了,胰岛素的水平才能正常,才能杜绝由糖尿病所引发的各种疾病,使机体真正走向健康、抵抗衰老。

  1. press [end] key or [cmd + ->] on mbp at any line.
  2. the wrong line break-up…

#6

At the present, I can solve the wrong line break-up and increase the line spacing by hard-hack, it’s certainly a bad idea…so I hope juce-team could attach importance to these problems…

Solve the confusing of text line break-up of the default Editor when it blends Chinese charactors and English words (however, it’ll break up English word):

L227 in TextEditor, the ‘if’ statement need comment:

text.isWhitespace() &&

Increase line-spacing:
Same class above, L481 change the original to

lineHeight = section->font.getHeight() + 4;

L540 change the original to:

... atomX, (float) roundToInt (lineY + lineHeight - maxDescent - 2));

L573 change the original to:

... atomX, (float) roundToInt (lineY + lineHeight - maxDescent - 2));

#7

Also, the default temp-underline of juce::TextEditor is too ugly and unbecoming, so I did this:

L560, underline change to backgound highlight:

//g.reduceClipRegion (Rectangle<int> (startX, baselineY, endX - startX, 1));
//g.fillCheckerBoard (Rectangle<int> (endX, baselineY + 1), 3, 1, colour, Colours::transparentBlack);
g.setColour (Colours::cyan.withAlpha (0.95f));
g.fillRoundedRectangle (startX - 1.f, baselineY - lineHeight + 10.5f, endX - startX + 2.f, lineHeight - 2.5f, 5.f);
drawSelectedText (g, underline, colour);

#8

We’ve now added this to the TextEditor on the develop branch.

Ed


#9

Thanks @ed95 !

Hope the problem of ‘press end key can’t reach the end of line’ will be solved soon… and setLineBreakup(...) will appear in JUCE lib…


#10

Hi, @ed95

I tested the new method setLineSpacing(), but there’s still bugs there.

  1. New bug: after using the new method, the ‘down key’ wont work at all.
  2. press ‘end key’ still can’t reach the end of line, the caret will at the place of before the last character of the line.
  3. still break up the content ahead of schedule when whitespace(s) blends in CJK characters.

Please, please fix them… You can do it! come on ed95!!


#11

And… if possible and without too much difficulty, could you add this method for TextEditor? just like the class CodeEditorComponent.

setColourScheme (const ColourScheme& scheme)


#12

We’re all pretty swamped with JUCE 5 features at the moment so I can’t promise that this will get done any time soon. I’ll add it to the backlog but if you’ve got any patches that resolve these issues in the meantime then I can take a look.

Ed


#13

Sadly… all I have to do just above, ed95.

It seems juce team will take these problems in the new version 5…

Don’t know why you guys don’t want a useful TextEditor which is so important for a modern C++ framework/library, so strange…