From 7943801f913a3ca1278c7bc621bea32c65827e15 Mon Sep 17 00:00:00 2001 From: Roy Qu Date: Wed, 1 Mar 2023 20:28:00 +0800 Subject: [PATCH] - emhancement: Improve display of disassembled codes in the cpu info dialog. --- NEWS.md | 2 ++ RedPandaIDE/settings.cpp | 2 +- RedPandaIDE/widgets/cpudialog.cpp | 9 ++++++--- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/NEWS.md b/NEWS.md index 1fc1d123..f1c20f47 100644 --- a/NEWS.md +++ b/NEWS.md @@ -5,6 +5,8 @@ Red Panda C++ Version 2.16 - fix: Can't debug project when project is saved after it's compiled. - fix: Icons for buttons in the cpu info dialog is not correctly set. - enhancement: Add cfi directives for asm syntaxer in linux. + - change: Editor option "Scroll past end of line" default to false. + - emhancement: Improve display of disassembled codes in the cpu info dialog. Red Panda C++ Version 2.15 diff --git a/RedPandaIDE/settings.cpp b/RedPandaIDE/settings.cpp index e0a3fce6..dbe3380f 100644 --- a/RedPandaIDE/settings.cpp +++ b/RedPandaIDE/settings.cpp @@ -1447,7 +1447,7 @@ void Settings::Editor::doLoad() //scroll mAutoHideScrollbar = boolValue("auto_hide_scroll_bar", false); mScrollPastEof = boolValue("scroll_past_eof", true); - mScrollPastEol = boolValue("scroll_past_eol", true); + mScrollPastEol = boolValue("scroll_past_eol", false); mScrollByOneLess = boolValue("scroll_by_one_less", false); mHalfPageScroll = boolValue("half_page_scroll",false); mMouseWheelScrollSpeed = intValue("mouse_wheel_scroll_speed", 3); diff --git a/RedPandaIDE/widgets/cpudialog.cpp b/RedPandaIDE/widgets/cpudialog.cpp index bddce257..62079ca2 100644 --- a/RedPandaIDE/widgets/cpudialog.cpp +++ b/RedPandaIDE/widgets/cpudialog.cpp @@ -42,6 +42,10 @@ CPUDialog::CPUDialog(QWidget *parent) : ui->txtCode->setGutterWidth(0); ui->txtCode->setUseCodeFolding(false); ui->txtCode->setRightEdge(0); + QSynedit::EditorOptions options=ui->txtCode->getOptions(); + options.setFlag(QSynedit::EditorOption::eoScrollPastEof,false); + options.setFlag(QSynedit::EditorOption::eoScrollPastEol,false); + ui->txtCode->setOptions(options); syntaxerManager.applyColorScheme(ui->txtCode->syntaxer(), pSettings->editor().colorScheme()); PColorSchemeItem item = pColorManager->getItem(pSettings->editor().colorScheme(),COLOR_SCHEME_ACTIVE_LINE); @@ -114,16 +118,15 @@ void CPUDialog::setDisassembly(const QString& file, const QString& funcName,cons { ui->txtFunctionName->setText(QString("%1:%2").arg(file, funcName)); int activeLine = -1; - ui->txtCode->document()->clear(); for (int i=0;i")) { activeLine = i; } - ui->txtCode->document()->addLine(line); } + ui->txtCode->document()->setContents(lines); if (activeLine!=-1) - ui->txtCode->setCaretXYEx(true,QSynedit::BufferCoord{1,activeLine+1}); + ui->txtCode->setCaretXYCentered(QSynedit::BufferCoord{1,activeLine+1}); } void CPUDialog::resetEditorFont(float dpi)