diff --git a/uppsrc/Core/src.tpp/Range$en-us.tpp b/uppsrc/Core/src.tpp/Range$en-us.tpp new file mode 100644 index 000000000..ec1014785 --- /dev/null +++ b/uppsrc/Core/src.tpp/Range$en-us.tpp @@ -0,0 +1,25 @@ +topic ""; +[2 $$0,0#00000000000000000000000000000000:Default] +[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class] +[l288;2 $$2,2#27521748481378242620020725143825:desc] +[0 $$3,0#96390100711032703541132217272105:end] +[H6;0 $$4,0#05600065144404261032431302351956:begin] +[i448;a25;kKO9;2 $$5,0#37138531426314131252341829483370:item] +[l288;a4;*@5;1 $$6,6#70004532496200323422659154056402:requirement] +[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param] +[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam] +[b42;2 $$9,9#13035079074754324216151401829390:normal] +[{_}%EN-US +[ {{10000@(113.42.0) [s0; [*@7;4 Title]]}}&] +[s1;O_; &] +[s0; Range is a concept&] +[s1;:noref: [@(0.0.255)3 template][3 _<][@(0.0.255)3 class][3 _][*@4;3 I][3 >]&] +[s1;:Upp`:`:SubRangeClass`:`:class: [@(0.0.255) class]_[* SubRangeClass]&] +[s2; &] +[s3; &] +[s0;i448;a25;kKO9;@(0.0.255) &] +[ {{10000F(128)G(128)@1 [s0; [* Function List]]}}&] +[s0;i448;a25;kKO9;:noref:@(0.0.255) &] +[ {{10000F(128)G(128)@1 [s0; [* Public Method List]]}}&] +[s0; &] +[ {{10000F(128)G(128)@1 [s0; [* Constructor detail]]}}]] \ No newline at end of file diff --git a/uppsrc/RichEdit/Cursor.cpp b/uppsrc/RichEdit/Cursor.cpp index 5df34e4e8..9547c80f5 100644 --- a/uppsrc/RichEdit/Cursor.cpp +++ b/uppsrc/RichEdit/Cursor.cpp @@ -4,6 +4,8 @@ namespace Upp { void RichEdit::FinishNF() { + cursor = clamp(cursor, 0, text.GetLength()); + anchor = clamp(anchor, 0, text.GetLength()); anchorp = text.GetRichPos(anchor); cursorp = text.GetRichPos(cursor); tablesel = 0; @@ -17,6 +19,8 @@ void RichEdit::FinishNF() else if(p.table != anchorp.table) { if(anchor == 0 && anchorp.level == 1 && text.GetRichPos(anchor, 1).table == 1 && anchor < cursor) { + while(cursor > 0 && cursorp.level) // selection must at at plain text + cursorp = text.GetRichPos(--cursor); begtabsel = true; anchor = 0; } diff --git a/uppsrc/RichEdit/Modify.cpp b/uppsrc/RichEdit/Modify.cpp index 0a4107b8a..ed3df9157 100644 --- a/uppsrc/RichEdit/Modify.cpp +++ b/uppsrc/RichEdit/Modify.cpp @@ -45,14 +45,15 @@ RichEdit::UndoRec * RichEdit::UndoBegSelUnFix::GetRedo(const RichText& txt) return new RichEdit::UndoBegSelFix; } -bool RichEdit::BegSelTabFix() +bool RichEdit::BegSelTabFix(int& count) { - if(begtabsel) { + if(begtabsel) { // If selection starts with first table which is the first element in the text int c = cursor; AddUndo(new UndoBegSelFix); - BegSelFixRaw(text); + BegSelFixRaw(text); // adds an empty paragraph at the start Move(0); - Move(c + 1, true); + Move(c + 1, true); // and changes the selection + count++; begtabsel = false; return true; } @@ -60,7 +61,7 @@ bool RichEdit::BegSelTabFix() } void RichEdit::BegSelTabFixEnd(bool fix) -{ +{ // removes empty paragraph added by BegSelTabFix if(fix && GetLength() > 0) { int c = cursor; AddUndo(new UndoBegSelUnFix); @@ -121,7 +122,7 @@ void RichEdit::SaveFormat() pos = cursor; count = 0; } - bool b = BegSelTabFix(); + bool b = BegSelTabFix(count); SaveFormat(pos, count); BegSelTabFixEnd(b); } @@ -137,7 +138,7 @@ void RichEdit::ModifyFormat(int pos, const RichText::FormatInfo& fi, int count) { if(IsReadOnly()) return; - bool b = BegSelTabFix(); + bool b = BegSelTabFix(count); Limit(pos, count); SaveFormat(pos, count); text.ApplyFormatInfo(pos, fi, count); diff --git a/uppsrc/RichEdit/RichEdit.h b/uppsrc/RichEdit/RichEdit.h index be9b29a78..8afc1d59c 100644 --- a/uppsrc/RichEdit/RichEdit.h +++ b/uppsrc/RichEdit/RichEdit.h @@ -621,7 +621,8 @@ private: void HeaderFooter(); bool EditHeaderFooter(String& header_qtf, String& footer_qtf); - bool BegSelTabFix(); + bool BegSelTabFix(int& count); + bool BegSelTabFix() { int dummy; return BegSelTabFix(dummy); } void BegSelTabFixEnd(bool fix); Size GetPhysicalSize(const RichObject& obj); diff --git a/uppsrc/RichText/RichText.h b/uppsrc/RichText/RichText.h index 20fca592a..fe1c4428c 100644 --- a/uppsrc/RichText/RichText.h +++ b/uppsrc/RichText/RichText.h @@ -297,7 +297,7 @@ struct RichPos { int tabposintabtext; int tabtextlen; - int table; + int table; // current level table index (unique in text) or zero if not in table Size tabsize; Point cell; diff --git a/uppsrc/RichText/TxtPaint.cpp b/uppsrc/RichText/TxtPaint.cpp index 61328d4d8..411108ed5 100644 --- a/uppsrc/RichText/TxtPaint.cpp +++ b/uppsrc/RichText/TxtPaint.cpp @@ -252,7 +252,7 @@ int RichTxt::GetPos(int x, PageY y, RichContext rc) const } } - return pos - 1; + return clamp(pos - 1, 0, GetLength()); } RichHotPos RichTxt::GetHotPos(int x, PageY y, int tolerance, RichContext rc) const