Skip to content

Commit

Permalink
Fix super_fast_search for RTL documents
Browse files Browse the repository at this point in the history
  • Loading branch information
ahrm authored and raffaem committed Jun 26, 2023
1 parent 5c66d73 commit b4a0bb3
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pdf_viewer/main_widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3511,7 +3511,7 @@ void MainWidget::perform_search(std::wstring text, bool is_regex) {
if (search_term.size() > 0) {
// in mupdf RTL documents are reversed, so we reverse the search string
//todo: better (or any!) handling of mixed RTL and LTR text
if (is_rtl(search_term[0])) {
if ((!SUPER_FAST_SEARCH) && is_rtl(search_term[0])) {
search_term = reverse_wstring(search_term);
}
}
Expand Down
2 changes: 1 addition & 1 deletion pdf_viewer/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ std::vector<fz_stext_char*> reorder_stext_line(fz_stext_line* line) {

if (rtl) {
std::sort(reordered_chars.begin(), reordered_chars.end(), [](fz_stext_char* lhs, fz_stext_char* rhs) {
return (lhs->quad.lr.x >= rhs->quad.lr.x) && (lhs->quad.ll.x > rhs->quad.ll.x);
return lhs->quad.lr.x > rhs->quad.lr.x;
});
}
else {
Expand Down

0 comments on commit b4a0bb3

Please sign in to comment.