diff options
author | Jérôme Laurens <jerome.laurens@u-bourgogne.fr> | 2010-01-10 10:12:32 +0000 |
---|---|---|
committer | Jérôme Laurens <jerome.laurens@u-bourgogne.fr> | 2010-01-10 10:12:32 +0000 |
commit | a667e260d631798c2b7718afa9c64f2bc267fae3 (patch) | |
tree | 74c1d5661faace9ba1b3cbd0ad1f5ec703d14127 /Build/source/texk/web2c/synctexdir | |
parent | 48c0936e72e99b7c8a7b97672c9391b08ad3fa0c (diff) |
Bug fix in synctex_parser.c to solve a synchronization problem with amsmath's gather environment. Concerns the synctex tool.
git-svn-id: svn://tug.org/texlive/trunk@16661 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/web2c/synctexdir')
-rw-r--r-- | Build/source/texk/web2c/synctexdir/ChangeLog | 8 | ||||
-rw-r--r-- | Build/source/texk/web2c/synctexdir/synctex_parser.c | 24 | ||||
-rw-r--r-- | Build/source/texk/web2c/synctexdir/synctex_parser_version.txt | 2 |
3 files changed, 25 insertions, 9 deletions
diff --git a/Build/source/texk/web2c/synctexdir/ChangeLog b/Build/source/texk/web2c/synctexdir/ChangeLog index 2aeba920ac9..838aa043b6f 100644 --- a/Build/source/texk/web2c/synctexdir/ChangeLog +++ b/Build/source/texk/web2c/synctexdir/ChangeLog @@ -1,3 +1,11 @@ +2010-01-10 Jérôme Laurens <jerome.laurens@u-bourgogne.fr> + + * synctex_parser.c: in the _synctex_smallest_container() function, + SYNCTEX_WIDTH is replaced with SYNCTEX_ABS_WIDTH + to take into account h boxes with negative width. + Solves a problem with amsmath's gather environment + * synctex_parser.c: enhancements in comments to better explain the code + 2009-12-30 Jérôme Laurens <jerome.laurens@u-bourgogne.fr> * synctex_parser_utils.c: in the _synctex_malloc() function, diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser.c b/Build/source/texk/web2c/synctexdir/synctex_parser.c index 151a553ada1..7caafe88513 100644 --- a/Build/source/texk/web2c/synctexdir/synctex_parser.c +++ b/Build/source/texk/web2c/synctexdir/synctex_parser.c @@ -212,7 +212,7 @@ struct __synctex_class_t { SYNCTEX_GETTER(NODE,friend)[0]=NEW_FRIEND;\ } -/* Next box getter and setter. The box tree can be traversed from one horizontal boxes to the other. +/* Next box getter and setter. The box tree can be traversed from one horizontal box to the other. * Navigation starts with the deeper boxes. */ # define SYNCTEX_NEXT_HORIZ_BOX(NODE) SYNCTEX_GET(NODE,next_box) @@ -2481,6 +2481,8 @@ bail: goto next_sheet; } +int _synctex_open(const char * output, const char * build_directory, char ** synctex_name_ref, gzFile * file_ref, synctex_bool_t add_quotes, synctex_io_mode_t * io_modeRef); + /* Where the synctex scanner is created. */ synctex_scanner_t synctex_scanner_new_with_output_file(const char * output, const char * build_directory, int parse) { gzFile file = NULL; @@ -2650,8 +2652,6 @@ return_on_error: # undef io_mode } -int _synctex_open(const char * output, const char * build_directory, char ** synctex_name_ref, gzFile * file_ref, synctex_bool_t add_quotes, synctex_io_mode_t * io_modeRef); - /* Opens the ouput file, taking into account the eventual build_directory. * 0 on success, non 0 on error. */ int _synctex_open(const char * output, const char * build_directory, char ** synctex_name_ref, gzFile * file_ref, synctex_bool_t add_quotes, synctex_io_mode_t * io_modeRef) { @@ -3396,7 +3396,7 @@ int synctex_edit_query(synctex_scanner_t scanner,int page,float h,float v) { synctex_node_t other_node = NULL; /* placeholder */ synctex_point_t hitPoint = {0,0}; /* placeholder */ synctex_node_set_t bestNodes = {NULL,NULL}; /* holds the best node */ - synctex_distances_t bestDistances = {INT_MAX,INT_MAX}; + synctex_distances_t bestDistances = {INT_MAX,INT_MAX}; /* holds the best distances for the best node */ synctex_node_t bestContainer = NULL; /* placeholder */ if(NULL == (scanner = synctex_scanner_parse(scanner)) || 0 >= scanner->unit) {/* scanner->unit must be >0 */ return 0; @@ -3434,6 +3434,7 @@ end: } } while((other_node = SYNCTEX_NEXT_HORIZ_BOX(other_node))); } + /* node is the smallest horizontal box that contains hitPoint. */ if((bestContainer = _synctex_eq_deepest_container(hitPoint,node,synctex_YES))) { node = bestContainer; } @@ -3476,6 +3477,9 @@ end: return SYNCTEX_STATUS_ERROR; } } while ((node = SYNCTEX_NEXT_HORIZ_BOX(node))); + /* All the horizontal boxes have been tested, + * None of them contains the hit point. + */ } /* We are not lucky */ if((node = SYNCTEX_CHILD(sheet))) { @@ -3661,10 +3665,10 @@ int _synctex_point_v_distance(synctex_point_t hitPoint, synctex_node_t node,sync SYNCTEX_INLINE static synctex_node_t _synctex_smallest_container(synctex_node_t node, synctex_node_t other_node) { float height, other_height; - if(SYNCTEX_WIDTH(node)<SYNCTEX_WIDTH(other_node)) { + if(SYNCTEX_ABS_WIDTH(node)<SYNCTEX_ABS_WIDTH(other_node)) { return node; } - if(SYNCTEX_WIDTH(node)>SYNCTEX_WIDTH(other_node)) { + if(SYNCTEX_ABS_WIDTH(node)>SYNCTEX_ABS_WIDTH(other_node)) { return other_node; } height = SYNCTEX_ABS_DEPTH(node) + SYNCTEX_ABS_HEIGHT(node); @@ -3825,7 +3829,10 @@ static synctex_node_t _synctex_eq_deepest_container(synctex_point_t hitPoint,syn } /* is the hit point inside the box? */ if(_synctex_point_in_box(hitPoint,node,visible)) { - if(node && (node->class->type == synctex_node_type_vbox) && (child = SYNCTEX_CHILD(node))) { + /* for vboxes we try to use some node inside. + * Walk through the list of siblings until we find the closest one. + * Only consider siblings with children. */ + if((node->class->type == synctex_node_type_vbox) && (child = SYNCTEX_CHILD(node))) { int bestDistance = INT_MAX; do { if(SYNCTEX_CHILD(child)) { @@ -3871,11 +3878,12 @@ SYNCTEX_INLINE static int __synctex_eq_get_closest_children_in_hbox(synctex_poin } } } else if(off7 == 0) { + /* hitPoint is inside node. */ bestDistancesRef->left = bestDistancesRef->right = 0; bestNodesRef->left = node; bestNodesRef->right = NULL; result |= SYNCTEX_MASK_LEFT; - } else { /* here off7 < 0 */ + } else { /* here off7 < 0, hitPoint is to the right of node */ off7 = -off7; if(bestDistancesRef->left > off7) { bestDistancesRef->left = off7; diff --git a/Build/source/texk/web2c/synctexdir/synctex_parser_version.txt b/Build/source/texk/web2c/synctexdir/synctex_parser_version.txt index 872765e5f28..578c71bd558 100644 --- a/Build/source/texk/web2c/synctexdir/synctex_parser_version.txt +++ b/Build/source/texk/web2c/synctexdir/synctex_parser_version.txt @@ -1 +1 @@ -1.9
\ No newline at end of file +1.10
\ No newline at end of file |