.Developing comment wordwrap

git-svn-id: svn://ultimatepp.org/upp/trunk@10395 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-11-04 14:21:07 +00:00
parent f0ecf15891
commit 5be8dfdbb5
5 changed files with 35 additions and 3 deletions

View file

@ -53,6 +53,33 @@ void CSyntax::IndentInsert(CodeEditor& e, int chr, int count)
}
return;
}
#ifdef _DEBUG
{
int limit = e.GetBorderColumn();
int pos = e.GetCursor();
int lp = pos;
int l = e.GetLinePos(lp);
if(limit > 10 && lp >= limit && lp == e.GetLineLength(l)) {
int lp0 = e.GetPos(l);
WString ln = e.GetWLine(l);
int wl = limit;
while(wl > 0 && ln[wl - 1] != '\n' && ln[wl - 1] != ' ')
wl--;
int sl = wl - 1;
while(sl > 0 && ln[wl - 1] != '\n' && ln[sl - 1] == ' ')
sl--;
e.Remove(lp0 + sl, pos - (lp0 + sl));
e.SetCursor(lp0 + sl);
e.InsertChar('\n', 1);
for(int i = wl; i < ln.GetCount(); i++)
e.InsertChar(ln[i], 1);
e.InsertChar(chr, 1);
return;
}
}
#endif
// {, } inserted on line alone should be moved left sometimes:
int cl = e.GetCursorLine();
WString l = e.GetWLine(cl);

View file

@ -165,7 +165,6 @@ String CodeEditor::GetPasteText()
return h;
}
bool CodeEditor::IsCursorBracket(int pos) const
{
return pos == highlight_bracket_pos0 && hilite_bracket;

View file

@ -93,8 +93,8 @@ public:
class EditorSyntax : public HighlightSetup { // Inheriting to make static members available
struct SyntaxDef {
Event<One<EditorSyntax>&> factory;
String patterns;
String description;
String patterns;
String description;
};
static ArrayMap<String, SyntaxDef>& defs();

View file

@ -385,6 +385,7 @@ public:
LineEdit& TabSize(int n);
int GetTabSize() const { return tabsize; }
LineEdit& BorderColumn(int col, Color c = SColorFace());
int GetBorderColumn() const { return bordercolumn; }
LineEdit& SetFont(Font f);
Font GetFont() const { return font; }
LineEdit& NoHorzScrollbar(bool b = true) { nohbar = b; ScrollIntoCursor(); return *this; }

View file

@ -308,6 +308,11 @@ rColumn]([@(0.0.255) int]_[*@3 col], [_^Color^ Color]_[*@3 c]_`=_SColorFace())&]
[s2;%% Displays a border column of width [%-*@3 col] and color [%-*@3 c].&]
[s3; &]
[s4; &]
[s5;:Upp`:`:LineEdit`:`:GetBorderColumn`(`)const: [@(0.0.255) int]_[* GetBorderColumn]()_
[@(0.0.255) const]&]
[s2;%% Return border column position.&]
[s3; &]
[s4; &]
[s5;:LineEdit`:`:SetFont`(Font`): [_^LineEdit^ LineEdit][@(0.0.255) `&]_[* SetFont]([_^Font^ F
ont]_[*@3 f])&]
[s2;%% Sets the font. HighlightLine can replace this font, however,