mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2024-11-22 04:11:16 -05:00
Repair UDP Highlight Callsign regression
When passing the 'Highlight last' parameter as true occasional matches in prior periods could be incorrectly highlighted. This fix should also improve performance when there is a large decode history, and highlight request for a new callsign is received.
This commit is contained in:
parent
342896c359
commit
d919af68a5
@ -13,7 +13,6 @@
|
|||||||
#include <QListIterator>
|
#include <QListIterator>
|
||||||
#include <QRegularExpression>
|
#include <QRegularExpression>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include "Configuration.hpp"
|
#include "Configuration.hpp"
|
||||||
#include "Network/LotWUsers.hpp"
|
#include "Network/LotWUsers.hpp"
|
||||||
@ -126,8 +125,6 @@ namespace
|
|||||||
void DisplayText::appendText(QString const& text, QColor bg, QColor fg
|
void DisplayText::appendText(QString const& text, QColor bg, QColor fg
|
||||||
, QString const& call1, QString const& call2)
|
, QString const& call1, QString const& call2)
|
||||||
{
|
{
|
||||||
// qDebug () << "DisplayText::appendText: text:" << text << "Nbsp pos:" << text.indexOf (QChar::Nbsp);
|
|
||||||
|
|
||||||
auto cursor = textCursor ();
|
auto cursor = textCursor ();
|
||||||
cursor.movePosition (QTextCursor::End);
|
cursor.movePosition (QTextCursor::End);
|
||||||
auto block_format = cursor.blockFormat ();
|
auto block_format = cursor.blockFormat ();
|
||||||
@ -548,7 +545,6 @@ namespace
|
|||||||
void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg,
|
void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg,
|
||||||
QColor const& fg, bool last_period_only)
|
QColor const& fg, bool last_period_only)
|
||||||
{
|
{
|
||||||
// qDebug () << "DisplayText::highlight_callsign: callsign:" << callsign << "last period:" << last_period_only;
|
|
||||||
if (!callsign.size ())
|
if (!callsign.size ())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
@ -575,10 +571,10 @@ void DisplayText::highlight_callsign (QString const& callsign, QColor const& bg,
|
|||||||
{
|
{
|
||||||
period_start = prior;
|
period_start = prior;
|
||||||
}
|
}
|
||||||
while (!cursor.isNull () && cursor > period_start)
|
cursor = period_start;
|
||||||
|
while (!cursor.isNull ())
|
||||||
{
|
{
|
||||||
cursor = document ()->find (target, cursor
|
cursor = document ()->find (target, cursor, QTextDocument::FindWholeWords);
|
||||||
, QTextDocument::FindBackward | QTextDocument::FindWholeWords);
|
|
||||||
if (!cursor.isNull () && cursor.hasSelection ())
|
if (!cursor.isNull () && cursor.hasSelection ())
|
||||||
{
|
{
|
||||||
if (bg.isValid () || fg.isValid ())
|
if (bg.isValid () || fg.isValid ())
|
||||||
|
Loading…
Reference in New Issue
Block a user