summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJérôme Laurens <jerome.laurens@u-bourgogne.fr>2017-09-12 17:16:53 +0000
committerJérôme Laurens <jerome.laurens@u-bourgogne.fr>2017-09-12 17:16:53 +0000
commit312adec8990003ebcbd7a504d658f893d63a8d53 (patch)
tree0520467ca4c81c0baaaeb72a193573aab9ecd6bd
parent1d59272d3a22556be28be08cbbcd140f23db9554 (diff)
synchronization enhancement and header included, only affects the synctex command line tool and editors
git-svn-id: svn://tug.org/texlive/trunk@45276 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_parser.c37
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_parser.h7
-rw-r--r--Build/source/texk/web2c/synctexdir/synctex_parser_advanced.h1
3 files changed, 29 insertions, 16 deletions
diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser.c b/Build/source/texk/web2c/synctexdir/synctex_parser.c
index bab4688ff23..278646f3961 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_parser.c
+++ b/Build/source/texk/web2c/synctexdir/synctex_parser.c
@@ -96,6 +96,7 @@
# endif
#include <stdlib.h>
+#include <stdarg.h>
#include <stdio.h>
#include <string.h>
#include <errno.h>
@@ -125,12 +126,11 @@ typedef char *(*synctex_node_str_f)(synctex_node_p);
* Each nodes has a class, it is therefore called an object.
* Each class has a unique scanner.
* Each class has a type which is a unique identifier.
- * Each class has a node mask which identifies node's attributes.
- * Each class has an info mask which info's attributes.
* The class points to various methods,
* each of them vary amongst objects.
- * The navigator records the offsets of the tree members getters.
- * The modelator records the offsets of the data members getters, relative to the last navigator getter.
+ * Each class has a data model which stores node's attributes.
+ * Each class has an tree model which stores children and parent.
+ * Inspectors give access to data and tree elements.
*/
/* 8 fields + size: spcflnat */
@@ -265,9 +265,9 @@ struct synctex_class_t {
/**
* Nota bene: naming convention.
- * For static API, when the name contains proxy, it applies to proxies.
- * When the name contains noxy, it applies to non proxies only.
- * When the name contains node, weel it depends...
+ * For static API, when the name contains "proxy", it applies to proxies.
+ * When the name contains "noxy", it applies to non proxies only.
+ * When the name contains "node", well it depends...
*/
typedef synctex_node_p synctex_proxy_p;
@@ -2391,7 +2391,7 @@ SYNCTEX_INLINE static synctex_node_p __synctex_new_proxy_from_ref_to(synctex_nod
return NULL;
}
_synctex_data_set_h(proxy, _synctex_data_h(ref));
- _synctex_data_set_v(proxy, _synctex_data_v(ref));
+ _synctex_data_set_v(proxy, _synctex_data_v(ref)-_synctex_data_height(to_node));
_synctex_tree_set_target(proxy,to_node);
# if defined(SYNCTEX_USE_CHARINDEX)
proxy->line_index=to_node?to_node->line_index:0;
@@ -5194,9 +5194,11 @@ content_loop:
synctex_node_p node = _synctex_tree_child(parent);
synctex_node_p sibling = NULL;
/* Ignore the first node (a box_bdry) */
- if (node && (node = __synctex_tree_sibling(node))) {
+ if (node && (sibling = __synctex_tree_sibling(node))) {
unsigned int node_weight = 0;
unsigned int cumulated_line_numbers = 0;
+ _synctex_data_set_line(node, _synctex_data_line(sibling));
+ node = sibling;
do {
if (synctex_node_type(node)==synctex_node_type_hbox) {
if (_synctex_data_weight(node)) {
@@ -6752,12 +6754,19 @@ int synctex_node_column(synctex_node_p node) {
* - author: JL
*/
int synctex_node_mean_line(synctex_node_p node) {
- synctex_node_p target = _synctex_tree_target(node);
- if (target) {
- node = target;
+ synctex_node_p other = _synctex_tree_target(node);
+ if (other) {
+ node = other;
+ }
+ if (_synctex_data_has_mean_line(node)) {
+ return _synctex_data_mean_line(node);
+ }
+ if ((other = synctex_node_parent(node))) {
+ if (_synctex_data_has_mean_line(other)) {
+ return _synctex_data_mean_line(other);
+ }
}
- return _synctex_data_has_mean_line(node)?
- _synctex_data_mean_line(node):_synctex_data_line(node);
+ return synctex_node_line(node);
}
/**
* The weight of the node.
diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser.h b/Build/source/texk/web2c/synctexdir/synctex_parser.h
index 3224ddec35e..65cc181a213 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_parser.h
+++ b/Build/source/texk/web2c/synctexdir/synctex_parser.h
@@ -274,13 +274,18 @@ extern "C" {
* When the tag is known, the scanner of the node
* will also give that same file name, see
* synctex_scanner_get_name below.
+ * For an hbox node, the mean line is the mean
+ * of all the lines of the child nodes.
+ * Sometimes, when synchronization form pdf to source
+ * fails with the line, one should try with the
+ * mean line.
*/
int synctex_node_tag(synctex_node_p node);
int synctex_node_line(synctex_node_p node);
+ int synctex_node_mean_line(synctex_node_p node);
int synctex_node_column(synctex_node_p node);
const char * synctex_node_get_name(synctex_node_p node);
-
/**
This is the page where the node appears.
* This is a 1 based index as given by TeX.
diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser_advanced.h b/Build/source/texk/web2c/synctexdir/synctex_parser_advanced.h
index e395aaff778..758cfb57e5e 100644
--- a/Build/source/texk/web2c/synctexdir/synctex_parser_advanced.h
+++ b/Build/source/texk/web2c/synctexdir/synctex_parser_advanced.h
@@ -369,7 +369,6 @@ extern "C" {
int synctex_node_form_tag(synctex_node_p node);
- int synctex_node_mean_line(synctex_node_p node);
int synctex_node_weight(synctex_node_p node);
int synctex_node_child_count(synctex_node_p node);