• R/O
  • HTTP
  • SSH
  • HTTPS

luatexja: Commit

ソースコードの管理場所


Commit MetaInfo

Revision56de3d1bdee072fe1428afcb164769cfeb56e198 (tree)
Time2022-08-03 18:14:17
AuthorHironori Kitagawa <h_kitagawa2001@yaho...>
CommiterHironori Kitagawa

Log Message

small reformatting

Change Summary

Incremental Difference

--- a/src/ltj-direction.lua
+++ b/src/ltj-direction.lua
@@ -92,11 +92,12 @@ end
9292
9393 local get_dir_count, get_adjust_dir_count
9494 do
95+ local node_attr = node.has_attribute
9596 local function get_dir_count_inner(h)
9697 if h then
9798 if h.id==id_whatsit and h.subtype==sid_user and h.user_id==DIR then
98- return ((node.has_attribute(h, attr_icflag) or 0)<PROCESSED_BEGIN_FLAG)
99- and (node.has_attribute(h,attr_dir)%dir_node_auto) or 0
99+ return ((node_attr(h, attr_icflag) or 0)<PROCESSED_BEGIN_FLAG)
100+ and (node_attr(h,attr_dir)%dir_node_auto) or 0
100101 else
101102 return 0
102103 end
@@ -263,13 +264,12 @@ local function create_dir_whatsit(hd, gc, new_dir)
263264 return hd
264265 else
265266 local w = dir_pool[new_dir]()
266- setfield(w, 'next', hd)
267267 set_attr(w, attr_icflag, PROCESSED_BEGIN_FLAG)
268268 set_attr(hd, attr_icflag,
269269 get_attr_icflag(hd) + PROCESSED_BEGIN_FLAG)
270270 ensure_tex_attr(attr_icflag, 0)
271271 ensure_tex_attr(attr_dir, 0)
272- return w
272+ return insert_before(hd, hd, w)
273273 end
274274 end
275275
@@ -329,11 +329,12 @@ do
329329 end
330330 end
331331 if hd==wh[1] then
332- ltjs.list_dir =has_attr(hd,attr_dir)
332+ ltjs.list_dir = has_attr(hd, attr_dir)
333333 local x = node_next(hd)
334334 while x and getid(x)==id_glue and getsubtype(x)==3 do
335335 node_remove(hd,x); node_free(x); x = node_next(hd)
336336 end
337+ if #wh>1 then wh[#wh], wh[1]=nil, wh[#wh] end
337338 end
338339 for i=1,#wh do
339340 hd = node_remove(hd, wh[i]); node_free(wh[i]); wh[i] = nil
@@ -344,17 +345,14 @@ do
344345 ensure_tex_attr(attr_icflag, 0)
345346 end
346347 return hd
347- else
348+ elseif gc=='vtop' then
348349 local n = node_next(hd)
349- if gc=='vtop' then
350- local w = create_dir_whatsit(hd, gc, ltjs.list_dir)
351- -- move dir whatsit after hd
352- setfield(hd, 'next', w); setfield(w, 'next', n)
353- return hd
354- else
355- hd = create_dir_whatsit(hd, gc, ltjs.list_dir)
356- return hd
357- end
350+ local w = create_dir_whatsit(hd, gc, ltjs.list_dir)
351+ -- move dir whatsit after hd
352+ setfield(hd, 'next', w); setfield(w, 'next', n)
353+ return hd
354+ else
355+ return create_dir_whatsit(hd, gc, ltjs.list_dir)
358356 end
359357 end
360358 end
@@ -1036,23 +1034,12 @@ do
10361034 end
10371035
10381036 do
1039- -- supply direction whatsit to the main vertical list "of the next page"
10401037 local function dir_adjust_pre_output(h, gc)
1038+ -- ここがメモリリークの原因? けど削除すると縦書きができない
10411039 return to_node(create_dir_whatsit_vbox(to_direct(h), gc))
10421040 end
1043- ltjb.add_to_callback('pre_output_filter',
1044- dir_adjust_pre_output,
1041+ ltjb.add_to_callback('pre_output_filter', dir_adjust_pre_output,
10451042 'ltj.direction', 10000)
1046-
1047- function luatexja.direction.remove_end_whatsit()
1048- local h=tex.lists.page_head
1049- if h and (not h.next) and
1050- h.id==id_whatsit and h.subtype==sid_user and
1051- h.user_id == DIR then
1052- tex.lists.page_head = nil
1053- node.free(h)
1054- end
1055- end
10561043 end
10571044
10581045 -- append_to_vlist filter: done in ltj-lineskip.lua
Show on old repository browser