[Okular-devel] [Bug 274294] okular's synctex support doesn't work with lua(la)tex generated output

Philipp Woelfel woelfel at gmx.net
Mon Aug 1 00:40:59 CEST 2011


https://bugs.kde.org/show_bug.cgi?id=274294





--- Comment #15 from Philipp Woelfel <woelfel gmx net>  2011-07-31 22:40:58 ---
In linux, the synctex filename parser compares just the plain strings using
strcmp. For windows it actually compares the filenames character in a loop and
gets rid of case sensitivity and treats "/" and "\" equivalently.

So here is a non-developer's dirty fix:

In generators/poppler/synctex/synctex_parser_utils.c, function 
_synctex_is_equivalent_file_name I replaced the part between "#else" and
"#endif" with with the following:

#       else
next_character:
        if(SYNCTEX_IS_PATH_SEPARATOR(*lhs)) {/*  lhs points to a path separator
*/
                if(!SYNCTEX_IS_PATH_SEPARATOR(*rhs)) {/*  but not rhs */
                        return synctex_NO;
                }
                for (; *(lhs + 1) == '.' && SYNCTEX_IS_PATH_SEPARATOR(*(lhs +
2)); lhs += 2);
                for (; *(rhs + 1) == '.' && SYNCTEX_IS_PATH_SEPARATOR(*(rhs +
2)); rhs += 2);
        } else if(SYNCTEX_IS_PATH_SEPARATOR(*rhs)) {/*  rhs points to a path
separator but not lhs */
                return synctex_NO;
        } else if (!*lhs) {/*  lhs is at the end of the string */
                return *rhs ? synctex_NO : synctex_YES;
        } else if(!*rhs) {/*  rhs is at the end of the string but not lhs */
                return synctex_NO;
        }
        ++lhs;
        ++rhs;
        goto next_character;
/*    return 0 == strcmp(lhs,rhs)?synctex_YES:synctex_NO; */
#       endif


This is just a copy of the windows part of the code minus comparing uppercase
symbols plus 2 for-loops taken from the sumatraPDF code
(http://blog.kowalczyk.info/software/sumatrapdf/free-pdf-reader.html)

Perhaps it's  not very clean, but it works for me...

-- 
Configure bugmail: https://bugs.kde.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.


More information about the Okular-devel mailing list