Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: find jumps to wrong location. #2060

Merged
merged 2 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lib/third_party/imgui/ColorTextEditor/include/TextEditor.h
Original file line number Diff line number Diff line change
Expand Up @@ -629,7 +629,6 @@ class TextEditor
uint64_t mStartTime = 0;
std::vector<std::string> mDefines;
TextEditor *mSourceCodeEditor = nullptr;
float mSavedScrollY = 0;
float mShiftedScrollY = 0;
float mScrollY = 0;
float mScrollYIncrement = 0.0F;
Expand Down
6 changes: 1 addition & 5 deletions lib/third_party/imgui/ColorTextEditor/source/TextEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1179,8 +1179,6 @@ void TextEditor::RenderText(const char *aTitle, const ImVec2 &lineNumbersStartPo

if (mTopMarginChanged) {
mTopMarginChanged = false;
if (mTopMargin == 0)
mSavedScrollY = ImGui::GetScrollY();
auto window = ImGui::GetCurrentWindow();
auto maxScroll = window->ScrollMax.y;
if (maxScroll > 0) {
Expand All @@ -1196,10 +1194,8 @@ void TextEditor::RenderText(const char *aTitle, const ImVec2 &lineNumbersStartPo

if (mNewTopMargin > mTopMargin)
mShiftedScrollY = oldScrollY + pixelCount;
else if (mNewTopMargin > 0)
mShiftedScrollY = oldScrollY - pixelCount;
else
mShiftedScrollY = mSavedScrollY;
mShiftedScrollY = oldScrollY - pixelCount;
ImGui::SetScrollY(mShiftedScrollY);
mTopMargin = mNewTopMargin;
}
Expand Down
Loading