mirror of
https://git.pwmt.org/pwmt/zathura.git
synced 2025-01-01 06:46:01 +01:00
Update coding style
This commit is contained in:
parent
0ce7730965
commit
a8ea4a6328
1 changed files with 16 additions and 7 deletions
23
synctex.c
23
synctex.c
|
@ -11,15 +11,24 @@
|
||||||
void
|
void
|
||||||
synctex_edit(zathura_t* zathura, zathura_page_t* page, int x, int y)
|
synctex_edit(zathura_t* zathura, zathura_page_t* page, int x, int y)
|
||||||
{
|
{
|
||||||
zathura_document_t* doc = zathura_page_get_document(page);
|
if (zathura == NULL || page == NULL) {
|
||||||
const char *filename = zathura_document_get_path(doc);
|
|
||||||
int pageIdx = zathura_page_get_index(page);
|
|
||||||
|
|
||||||
char *buffer = g_strdup_printf("%d:%d:%d:%s", pageIdx+1, x, y, filename);
|
|
||||||
if (buffer == NULL)
|
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (zathura->synctex.editor) {
|
zathura_document_t* document = zathura_page_get_document(page);
|
||||||
|
if (document == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *filename = zathura_document_get_path(document);
|
||||||
|
if (filename == NULL) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int page_idx = zathura_page_get_index(page);
|
||||||
|
char *buffer = g_strdup_printf("%d:%d:%d:%s", page_idx + 1, x, y, filename);
|
||||||
|
|
||||||
|
if (zathura->synctex.editor != NULL) {
|
||||||
char* argv[] = {"synctex", "edit", "-o", buffer, "-x", zathura->synctex.editor, NULL};
|
char* argv[] = {"synctex", "edit", "-o", buffer, "-x", zathura->synctex.editor, NULL};
|
||||||
g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
|
g_spawn_async(NULL, argv, NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, NULL);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue