Bidi: Fix control characters appearing in reader window titles on Windows

Fix in 6d5ce578e4 only affected tabs.

Fixes #3135
This commit is contained in:
Abe Jellinek 2023-05-25 09:05:19 +03:00
parent 4ca4278635
commit 91fec9024c
2 changed files with 6 additions and 7 deletions

View file

@ -80,13 +80,7 @@ var Zotero_Tabs = new function () {
iconBackgroundImage: tab.iconBackgroundImage
})));
var { tab } = this._getTab(this._selectedID);
let tabTitle = tab.title;
if (Zotero.isWin) {
// Windows displays bidi control characters as placeholders in window titles, so strip them
// See https://github.com/mozilla-services/screenshots/issues/4863
tabTitle = tabTitle.replace(/[\u2068\u2069]/g, '');
}
document.title = (tabTitle.length ? tabTitle + ' - ' : '') + 'Zotero';
document.title = (tab.title.length ? tab.title + ' - ' : '') + 'Zotero';
this._updateTabBar();
// Hide any tab `title` tooltips that might be open
window.Zotero_Tooltip.stop();

View file

@ -198,6 +198,11 @@ class ReaderInstance {
readerTitle = parts.filter(x => x).join(' - ');
}
}
if (Zotero.isWin) {
// Windows displays bidi control characters as placeholders in window titles, so strip them
// See https://github.com/mozilla-services/screenshots/issues/4863
readerTitle = readerTitle.replace(/[\u2068\u2069]/g, '');
}
this._title = readerTitle;
this._setTitleValue(readerTitle);
}