mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2024-12-29 11:06:00 +01:00
Adjust for different indices in SyncTex
Signed-off-by: Sebastian Ramacher <sebastian+dev@ramacher.at>
This commit is contained in:
parent
71d9f6a546
commit
d2a1a2d6d0
2 changed files with 15 additions and 2 deletions
12
main.c
12
main.c
|
@ -118,8 +118,16 @@ main(int argc, char* argv[])
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
const int line = MIN(INT_MAX, g_ascii_strtoll(split_fwd[0], NULL, 10));
|
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 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);
|
const bool ret = zathura_dbus_synctex_position(real_path, split_fwd[2], line, column, synctex_pid);
|
||||||
g_strfreev(split_fwd);
|
g_strfreev(split_fwd);
|
||||||
|
|
||||||
|
|
|
@ -122,6 +122,10 @@ synctex_rectangles_from_position(const char* filename, const char* input_file,
|
||||||
return NULL;
|
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);
|
synctex_scanner_t scanner = synctex_scanner_new_with_output_file(filename, NULL, 1);
|
||||||
if (scanner == NULL) {
|
if (scanner == NULL) {
|
||||||
girara_debug("Failed to create synctex scanner.");
|
girara_debug("Failed to create synctex scanner.");
|
||||||
|
@ -187,3 +191,4 @@ synctex_rectangles_from_position(const char* filename, const char* input_file,
|
||||||
|
|
||||||
return hitlist;
|
return hitlist;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue