Skip to content

Commit

Permalink
fix: code display issue
Browse files Browse the repository at this point in the history
as title

Log:
Bug:
  • Loading branch information
Lighto-Ku authored and deepin-mozart committed Nov 17, 2023
1 parent bf42b4c commit 5a75b84
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/plugins/codegeex/widgets/codeeditcomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ void CodeEditComponent::initUI()
titleWidget->setVisible(false);

codeEdit = new DPlainTextEdit(this);
codeEdit->setWordWrapMode(QTextOption::WrapMode::NoWrap);
codeEdit->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Expanding);
layout->addWidget(codeEdit);
}
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/codegeex/widgets/messagecomponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ void MessageComponent::updateMessage(const MessageData &msgData)
if (msgData.messageType() == MessageData::Ask) {
curUpdateLabel = new DLabel(this);
curUpdateLabel->setWordWrap(true);
curUpdateLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
msgLayout->addWidget(curUpdateLabel);
curUpdateLabel->setText(msgData.messageData());
return;
Expand All @@ -38,10 +39,12 @@ void MessageComponent::updateMessage(const MessageData &msgData)
case Label:
if (!curUpdateLabel) {
curUpdateLabel = new DLabel(this);
curUpdateLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
curUpdateLabel->setWordWrap(true);
msgLayout->addWidget(curUpdateLabel);
} else if (msgData.messageLines().length() > messageData.messageLines().length()) {
curUpdateLabel = new DLabel(this);
curUpdateLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
curUpdateLabel->setWordWrap(true);
msgLayout->addWidget(curUpdateLabel);
}
Expand Down Expand Up @@ -141,6 +144,7 @@ bool MessageComponent::createCodeEdit(const MessageData &newData)
messageData.appendData({ addedLine });
currentUpdateState = Label;
curUpdateLabel = new DLabel(this);
curUpdateLabel->setTextInteractionFlags(Qt::TextSelectableByMouse);
curUpdateLabel->setWordWrap(true);
msgLayout->addWidget(curUpdateLabel);
if (i != (addedLines.count() - 1))
Expand Down

0 comments on commit 5a75b84

Please sign in to comment.