Commit d2a1a2d6 authored by Sebastian Ramacher's avatar Sebastian Ramacher

Adjust for different indices in SyncTex

Signed-off-by: Sebastian Ramacher's avatarSebastian Ramacher <sebastian+dev@ramacher.at>
parent 71d9f6a5
......@@ -118,8 +118,16 @@ main(int argc, char* argv[])
return -1;
}
const int line = MIN(INT_MAX, g_ascii_strtoll(split_fwd[0], NULL, 10));
const int column = MIN(INT_MAX, g_ascii_strtoll(split_fwd[1], NULL, 10));
int line = MIN(INT_MAX, g_ascii_strtoll(split_fwd[0], NULL, 10));
int column = MIN(INT_MAX, g_ascii_strtoll(split_fwd[1], NULL, 10));
/* SyncTeX starts indexing at 1, but we use 0 */
if (line > 0) {
--line;
}
if (column > 0) {
--column;
}
const bool ret = zathura_dbus_synctex_position(real_path, split_fwd[2], line, column, synctex_pid);
g_strfreev(split_fwd);
......
......@@ -122,6 +122,10 @@ synctex_rectangles_from_position(const char* filename, const char* input_file,
return NULL;
}
/* We use indexes starting at 0 but SyncTeX uses 1 */
++line;
++column;
synctex_scanner_t scanner = synctex_scanner_new_with_output_file(filename, NULL, 1);
if (scanner == NULL) {
girara_debug("Failed to create synctex scanner.");
......@@ -187,3 +191,4 @@ synctex_rectangles_from_position(const char* filename, const char* input_file,
return hitlist;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment