Permalink
Browse files

Support backward search for file names with non-ascii chars

  • Loading branch information...
1 parent 23b004e commit c1c04c0222589151817c41c8cb8d213e6f40ffce @msiniscalchi msiniscalchi committed Oct 19, 2012
Showing with 11 additions and 2 deletions.
  1. +8 −1 evince/evince_backward_search
  2. +3 −1 messages/7.txt
@@ -20,7 +20,7 @@
# Incorporates fixes from http://ubuntuforums.org/showthread.php?t=1716268
-import dbus, subprocess, time, re
+import dbus, subprocess, time, re, urllib, sys
RUNNING, CLOSED = range(2)
@@ -108,7 +108,14 @@ class EvinceWindowProxy:
def on_sync_source(self, input_file, source_link, time):
print input_file + ":" + str(source_link[0])
+ # This is probably useless
input_file = input_file.replace("%20", " ")
+ # This is to deal with source files with non-ascii names
+ # We get url-quoted UTF-8 from dbus; convert to url-quoted ascii
+ # and then unquote. If you don't first convert ot ascii, it fails.
+ # It's a bit magical, but it seems to work
+ input_file = urllib.unquote(input_file.encode('ascii'))
+ print type(input_file), input_file
cmd = re.sub("%f",input_file,self.editor)
cmd = re.sub("%l",str(source_link[0]), cmd)
print cmd
View
@@ -13,4 +13,6 @@ Bugs fixed:
- Robustified makePDF.py; now it should always fail gracefully when it cannot parse tex file names,
and kindly ask the user to report the bug on GitHub :-) Note TODO: better filename regexp!
-- Ignore non-ascii chars in output of "ps xw" when checking if evince is running (avoids crashes)
+- Ignore non-ascii chars in output of "ps xw" when checking if evince is running (avoids crashes)
+
+- Support inverse search for file names with non-ascii chars (hopefully)

0 comments on commit c1c04c0

Please sign in to comment.