mirror of
https://github.com/ultimatepp/ultimatepp.git
synced 2026-07-11 22:03:01 -06:00
ide: Now retains scroll position when switching files
git-svn-id: svn://ultimatepp.org/upp/trunk@13627 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
parent
c7ff3b9790
commit
78a75accd5
4 changed files with 14 additions and 2 deletions
|
|
@ -1098,12 +1098,16 @@ LineEdit::EditPos LineEdit::GetEditPos() const {
|
|||
}
|
||||
|
||||
void LineEdit::SetEditPos(const LineEdit::EditPos& pos) {
|
||||
sb.SetY(minmax(pos.sby, 0, GetLineCount() - 1));
|
||||
SetEditPosSbOnly(pos);
|
||||
SetCursor(pos.cursor);
|
||||
}
|
||||
|
||||
void LineEdit::SetEditPosSb(const LineEdit::EditPos& pos) {
|
||||
SetCursor(pos.cursor);
|
||||
SetEditPosSbOnly(pos);
|
||||
}
|
||||
|
||||
void LineEdit::SetEditPosSbOnly(const LineEdit::EditPos& pos) {
|
||||
sb.SetY(minmax(pos.sby, 0, GetLineCount() - 1));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -432,6 +432,7 @@ public:
|
|||
EditPos GetEditPos() const;
|
||||
void SetEditPos(const EditPos& pos);
|
||||
void SetEditPosSb(const LineEdit::EditPos& pos);
|
||||
void SetEditPosSbOnly(const LineEdit::EditPos& pos);
|
||||
|
||||
void ScrollIntoCursor();
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
topic "LineEdit";
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[i448;a25;kKO9;2 $$1,0#37138531426314131252341829483380:class]
|
||||
[l288;2 $$2,0#27521748481378242620020725143825:desc]
|
||||
[0 $$3,0#96390100711032703541132217272105:end]
|
||||
|
|
@ -9,6 +8,7 @@ topic "LineEdit";
|
|||
[l288;i1121;b17;O9;~~~.1408;2 $$7,0#10431211400427159095818037425705:param]
|
||||
[i448;b42;O9;2 $$8,8#61672508125594000341940100500538:tparam]
|
||||
[b42;2 $$9,9#13035079074754324216151401829390:normal]
|
||||
[2 $$0,0#00000000000000000000000000000000:Default]
|
||||
[{_}
|
||||
[ {{10000@3 [s0;%% [*@(229)4 LineEdit]]}}&]
|
||||
[s3; &]
|
||||
|
|
@ -264,6 +264,12 @@ os])&]
|
|||
SetEditPos, no scrolls are performed to get cursor into the view.&]
|
||||
[s3; &]
|
||||
[s4; &]
|
||||
[s5;:Upp`:`:LineEdit`:`:SetEditPosSbOnly`(const Upp`:`:LineEdit`:`:EditPos`&`): [@(0.0.255) v
|
||||
oid]_[* SetEditPosSbOnly]([@(0.0.255) const]_[_^Upp`:`:LineEdit`:`:EditPos^ LineEdit`::E
|
||||
ditPos][@(0.0.255) `&]_[*@3 pos])&]
|
||||
[s2;%% Sets only scrollbar position of [%-*@3 pos].&]
|
||||
[s3;%% &]
|
||||
[s4; &]
|
||||
[s5;:LineEdit`:`:ScrollIntoCursor`(`): [@(0.0.255) void]_[* ScrollIntoCursor]()&]
|
||||
[s2;%% Performs minimal scroll to get the cursor into the view. `"Minimal`"
|
||||
means that if cursor is `"before`" the view, view is scrolled
|
||||
|
|
|
|||
|
|
@ -580,6 +580,7 @@ void Ide::EditFile0(const String& path, byte charset, int spellcheck_comments, c
|
|||
editor.SetEditPos(fd.editpos);
|
||||
if(!IsNull(fd.columnline) && fd.columnline.y >= 0 && fd.columnline.y < editor.GetLineCount())
|
||||
editor.SetCursor(editor.GetColumnLinePos(fd.columnline));
|
||||
editor.SetEditPosSbOnly(fd.editpos);
|
||||
if(!editor.IsView()) {
|
||||
editor.SetPickUndoData(pick(fd.undodata));
|
||||
editor.SetLineInfo(fd.lineinfo);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue