Make optional the space character hack used to fix Tamil text display inside anchors: the space is sometimes a problem with cut & paste
This commit is contained in:
parent
352dba0c77
commit
b64751e138
@ -22,6 +22,7 @@
|
||||
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QSettings>
|
||||
|
||||
#include "preview_plaintorich.h"
|
||||
|
||||
@ -43,6 +44,8 @@ void PlainToRichQtPreview::clear()
|
||||
m_lastanchor = 0;
|
||||
m_groupanchors.clear();
|
||||
m_groupcuranchors.clear();
|
||||
QSettings settings("Recoll.org", "recoll");
|
||||
m_spacehack = settings.value("anchorSpcHack", 0).toBool();
|
||||
}
|
||||
|
||||
bool PlainToRichQtPreview::haveAnchors()
|
||||
@ -82,9 +85,12 @@ string PlainToRichQtPreview::startMatch(unsigned int grpidx)
|
||||
// Tamil text (qt bug?). Just inserting a space character after
|
||||
// the opening <a tag, before the text, clears the problem, reason
|
||||
// unknown. We also inverted the <span and <a tags to avoid
|
||||
// highlighting the spurious space.
|
||||
// highlighting the spurious space. The space hack only work in a
|
||||
// <pre> section. Also: having <a name=xxx></a> before the match
|
||||
// term causes the same problem (so not a possible fix).
|
||||
string hackspace = m_spacehack? " " : "";
|
||||
string startmarker{
|
||||
"<a name='" + termAnchorName(m_lastanchor) + "'> " +
|
||||
"<a name='" + termAnchorName(m_lastanchor) + "'>" + hackspace +
|
||||
"<span style='" + qs2utf8s(prefs.qtermstyle) + "'>"
|
||||
};
|
||||
return startmarker;
|
||||
|
||||
@ -50,6 +50,7 @@ private:
|
||||
// in the query (the map key is and index into HighlightData.groups).
|
||||
std::map<unsigned int, std::vector<int> > m_groupanchors;
|
||||
std::map<unsigned int, unsigned int> m_groupcuranchors;
|
||||
bool m_spacehack{false};
|
||||
};
|
||||
|
||||
/* A thread to convert to rich text (mark search terms) */
|
||||
|
||||
@ -16,8 +16,6 @@
|
||||
<property name="sizeGripEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<layout class="QVBoxLayout">
|
||||
<item>
|
||||
<widget class="QTabWidget" name="tabWidget">
|
||||
@ -1026,6 +1024,37 @@ May be slow for big documents.</string>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_3">
|
||||
<attribute name="title">
|
||||
<string>Misc</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QCheckBox" name="anchorTamilHackCB">
|
||||
<property name="text">
|
||||
<string>Work around QTBUG-78923 by inserting space before anchor text</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
@ -1084,8 +1113,6 @@ May be slow for big documents.</string>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources/>
|
||||
|
||||
@ -42,6 +42,7 @@
|
||||
#include <qlist.h>
|
||||
#include <QTimer>
|
||||
#include <QListWidget>
|
||||
#include <QSettings>
|
||||
|
||||
#include "recoll.h"
|
||||
#include "guiutils.h"
|
||||
@ -103,6 +104,10 @@ void UIPrefsDialog::init()
|
||||
// Update dialog state from stored prefs
|
||||
void UIPrefsDialog::setFromPrefs()
|
||||
{
|
||||
// Most values are stored in the prefs struct. Some rarely used
|
||||
// ones go directly through the settings
|
||||
QSettings settings("Recoll.org", "recoll");
|
||||
|
||||
// Entries per result page spinbox
|
||||
pageLenSB->setValue(prefs.respagesize);
|
||||
collapseDupsCB->setChecked(prefs.collapseDuplicates);
|
||||
@ -144,6 +149,7 @@ void UIPrefsDialog::setFromPrefs()
|
||||
closeToTrayCB->setEnabled(showTrayIconCB->checkState());
|
||||
closeToTrayCB->setChecked(prefs.closeToTray);
|
||||
showTempFileWarningCB->setChecked(prefs.showTempFileWarning == -1);
|
||||
anchorTamilHackCB->setChecked(settings.value("anchorSpcHack", 0).toBool());
|
||||
previewHtmlCB->setChecked(prefs.previewHtml);
|
||||
previewActiveLinksCB->setChecked(prefs.previewActiveLinks);
|
||||
switch (prefs.previewPlainPre) {
|
||||
@ -262,6 +268,9 @@ void UIPrefsDialog::setupReslistFontPB()
|
||||
|
||||
void UIPrefsDialog::accept()
|
||||
{
|
||||
// Most values are stored in the prefs struct. Some rarely used
|
||||
// ones go directly through the settings
|
||||
QSettings settings("Recoll.org", "recoll");
|
||||
prefs.noBeeps = noBeepsCB->isChecked();
|
||||
prefs.ssearchNoComplete = ssNoCompleteCB->isChecked();
|
||||
prefs.ssearchStartOnComplete = ssSearchOnCompleteCB->isChecked();
|
||||
@ -330,6 +339,7 @@ void UIPrefsDialog::accept()
|
||||
prefs.closeToTray = closeToTrayCB->isChecked();
|
||||
prefs.showTempFileWarning = showTempFileWarningCB->isChecked() ?
|
||||
-1 : 1024;
|
||||
settings.setValue("anchorSpcHack", anchorTamilHackCB->isChecked());
|
||||
prefs.previewHtml = previewHtmlCB->isChecked();
|
||||
prefs.previewActiveLinks = previewActiveLinksCB->isChecked();
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user