Skip to content

Commit

Permalink
[43_5] LaTeX: fix unexpected symbols when copy to LaTeX
Browse files Browse the repository at this point in the history
  • Loading branch information
da-liii authored Jan 16, 2024
1 parent 74d0915 commit 1cc282c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/Plugins/Qt/qt_gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ qt_gui_rep::set_selection (string key, tree t, string s, string sv, string sh,
cb->clear (mode);

c_string selection (s);
cb->setText (QString::fromLatin1 (selection, -1), mode);
cb->setText (utf8_to_qstring (s), mode);
QMimeData* md= new QMimeData;

if (format == "verbatim" || format == "default") {
Expand Down Expand Up @@ -381,9 +381,12 @@ qt_gui_rep::set_selection (string key, tree t, string s, string sv, string sh,
}
else if (format == "latex") {
string enc= get_preference ("texmacs->latex:encoding");
if (enc == "utf-8" || enc == "UTF-8" || enc == "cork")
md->setText (to_qstring (string (selection)));
else md->setText (QString::fromLatin1 (selection, -1));
if (enc == "utf-8" || enc == "UTF-8" || enc == "cork") {
md->setText (utf8_to_qstring (s));
}
else {
md->setText (QString::fromLatin1 (selection, -1));
}
}
else md->setText (QString::fromLatin1 (selection, -1));
cb->setMimeData (md, mode);
Expand Down

0 comments on commit 1cc282c

Please sign in to comment.