On Wednesday, February 18th, 2026 at 4:39 PM, Udi Fogiel <[email protected]> 
wrote:

> 
> 
> 
> Hello, 
> 
> with the following I get an orphan enddir node
> 
> ==============================
> run \linedirection=1 run \linedirection=0 run
> run \linedirection=1 run
> 
> \bye
> =============================
> 
> The enddir node is inserted in 
> https://gitlab.lisn.upsaclay.fr/texlive/luatex/-/blob/master/source/texk/web2c/luatexdir/tex/maincontrol.c#L3079
> 
> or (with \textdirection) in 
> https://gitlab.lisn.upsaclay.fr/texlive/luatex/-/blob/master/source/texk/web2c/luatexdir/tex/maincontrol.c#L3084
> 

The problem is that new_graf might not inject dir nodes even if 
no_local_dirs_par is positive, which break the synchronization between the open 
dir nodes and no_local_dirs_par.

Like at the start of boxes, no_local_dirs_par should be reset, but then if dir 
nodes are injected it should be incremented.

I attached a fix.

thanks,
Udi
diff --git a/source/texk/web2c/luatexdir/tex/maincontrol.c b/source/texk/web2c/luatexdir/tex/maincontrol.c
index 173e462a3..036ea8a24 100644
--- a/source/texk/web2c/luatexdir/tex/maincontrol.c
+++ b/source/texk/web2c/luatexdir/tex/maincontrol.c
@@ -1857,11 +1857,13 @@ void new_graf(boolean indented)
         q = tail;
     }
     dir_rover = text_dir_ptr;
+    eq_word_define(int_base + no_local_dirs_code, 0);
     while (dir_rover != null) {
         if ((vlink(dir_rover) != null) || (dir_dir(dir_rover) != par_direction_par)) {
             dir_graf_tmp = new_dir(dir_dir(dir_rover));
             try_couple_nodes(dir_graf_tmp,vlink(q));
             couple_nodes(q,dir_graf_tmp);
+            eq_word_define(int_base + no_local_dirs_code, no_local_dirs_par + 1);
         }
         dir_rover = vlink(dir_rover);
     }
_______________________________________________
dev-luatex mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to