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

InputField: only soften line breaks inside format tags #253

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
12 changes: 7 additions & 5 deletions ui/widgets/fields/input_field.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,11 +1069,6 @@ void ApplyTagFormat(QTextCharFormat &to, const QTextCharFormat &from) {
text[position] = ch;
}
};
for (auto i = 0, length = int(data.text.size()); i != length; ++i) {
if (newline(i)) {
force(i, kSoftLine);
}
}
for (auto i = data.tags.begin(); i != data.tags.end();) {
auto &tagStart = *i;
const auto &id = tagStart.id;
Expand All @@ -1098,6 +1093,13 @@ void ApplyTagFormat(QTextCharFormat &to, const QTextCharFormat &from) {
}
auto &tagEnd = *(j - 1);

// Multiple lines in the same formatting tag belong to the same block
for (auto c = from; c < till; ++c) {
if (newline(c)) {
force(c, kSoftLine);
}
}

if (from > 0 && newline(from - 1)) {
force(from - 1, kHardLine);
} else if (newline(from)) {
Expand Down