mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-30 22:25:12 +00:00
Fixes for compact chat list
* Links were parsed in chat name * Second line of text was partially shown in global search results
This commit is contained in:
@@ -746,7 +746,11 @@ void InnerWidget::paintPeerSearchResult(
|
||||
|
||||
auto nameleft = st::dialogsPadding.x() + DialogsPhotoSize() + st::dialogsPhotoPadding;
|
||||
auto namewidth = fullWidth - nameleft - st::dialogsPadding.x();
|
||||
QRect rectForName(nameleft, st::dialogsPadding.y() + st::dialogsNameTop, namewidth, st::msgNameFont->height);
|
||||
QRect rectForName(
|
||||
nameleft,
|
||||
(DialogListLines() == 1) ? st::dialogsPadding.y() : st::dialogsPadding.y() + st::dialogsNameTop,
|
||||
namewidth,
|
||||
st::msgNameFont->height);
|
||||
|
||||
// draw chat icon
|
||||
if (auto chatTypeIcon = Layout::ChatTypeIcon(peer, active, selected)) {
|
||||
@@ -773,6 +777,19 @@ void InnerWidget::paintPeerSearchResult(
|
||||
badgeStyle);
|
||||
rectForName.setWidth(rectForName.width() - badgeWidth);
|
||||
|
||||
if (DialogListLines() == 1) {
|
||||
QString text = peer->nameText().toString();
|
||||
p.setPen(active
|
||||
? st::dialogsNameFgActive
|
||||
: selected
|
||||
? st::dialogsNameFgOver
|
||||
: st::dialogsNameFg);
|
||||
p.setFont(st::dialogsTextFont);
|
||||
|
||||
Ui::Text::String textStr;
|
||||
textStr.setText(st::dialogsTextStyle, text, Ui::NameTextOptions());
|
||||
textStr.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
|
||||
} else {
|
||||
QRect tr(nameleft, st::dialogsPadding.y() + st::msgNameFont->height + st::dialogsSkip, namewidth, st::dialogsTextFont->height);
|
||||
p.setFont(st::dialogsTextFont);
|
||||
QString username = peer->userName();
|
||||
@@ -796,6 +813,7 @@ void InnerWidget::paintPeerSearchResult(
|
||||
|
||||
p.setPen(active ? st::dialogsTextFgActive : st::dialogsNameFg);
|
||||
peer->nameText().drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
|
||||
}
|
||||
}
|
||||
|
||||
void InnerWidget::paintSearchInChat(Painter &p) const {
|
||||
|
@@ -379,7 +379,8 @@ void paintOneLineRow(
|
||||
}
|
||||
|
||||
if (!(from && (flags & Flag::SearchResult))) {
|
||||
Ui::Text::String textStr = { st::dialogsTextStyle, text };
|
||||
Ui::Text::String textStr;
|
||||
textStr.setText(st::dialogsTextStyle, text, Ui::NameTextOptions());
|
||||
textStr.drawElided(p, rectForName.left(), rectForName.top(), rectForName.width());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user