Open GoogleCodeExporter opened 9 years ago
I have written a patch which fixes the problem but it is ugly so you all may
want to implement it a different way. I will include it as the next comment.
Original comment by verta...@gmail.com
on 15 May 2015 at 2:35
Description: fixed a bug which inserts ampersands on spellcheck replace
Qt5 added an automatic keyboard shortcut feature which inserts & symbols
into menu labels representing which letter is a keyboard shortcut for
that action. I added a QMap which associates the QAction pointer with
the spelling suggestion so that the unmodified suggestion is inserted
without the ampersand.
.
texmaker (4.4.1-1) unstable; urgency=medium
.
* New upstream release.
* Refresh patches offset.
* d/copyright: Remove files that
aren't included by upstream anymore.
* Bump Standards-Version to 3.9.6 (no changes).
Author: Julián Moreno Patiño <julian@debian.org>
---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:
Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: https://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>
--- texmaker-4.4.1.orig/latexeditor.cpp
+++ texmaker-4.4.1/latexeditor.cpp
@@ -26,6 +26,7 @@
#include <QKeyEvent>
#include <QAbstractItemView>
#include <QApplication>
+#include <QMap>
#include <QModelIndex>
#include <QAbstractItemModel>
#include <QScrollBar>
@@ -44,6 +45,8 @@
#include "blockdata.h"
+QMap<QAction*,QString> spellingLookup;
+
static void convertToPlainText(QString &txt)
{
QChar *uc = txt.data();
@@ -858,6 +861,7 @@ if (inlinecheckSpelling && pChecker && !
if (ns > 0)
{
suggWords.clear();
+ spellingLookup.clear();
for (int i=0; i < ns; i++)
{
suggWords.append(codec->toUnicode(wlst[i]));
@@ -872,8 +876,12 @@ if (inlinecheckSpelling && pChecker && !
{
foreach (const QString &suggestion, suggWords)
{
- a = menu->addAction(suggestion, this, SLOT(correctWord()));
+ a = menu->addAction(suggestion, this, SLOT(correctWord()),
+ 0
+ );
a->setFont(spellmenufont);
+
a->setText(suggestion);
+ spellingLookup.insert(a,suggestion);
}
}
}
@@ -957,8 +965,8 @@ void LatexEditor::correctWord()
{
QAction *action = qobject_cast<QAction *>(sender());
if (action)
- {
- QString newword = action->text();
+ {
+ QString newword = spellingLookup.find(action).value();
replace(newword,false,"");
}
}
Original comment by verta...@gmail.com
on 15 May 2015 at 2:37
Original issue reported on code.google.com by
verta...@gmail.com
on 13 May 2015 at 9:04