Opened 4 years ago

Closed 4 years ago

#1019 closed defect (fixed)

Modifying styles through automation truncates "spacing" field to int

Reported by: TheFluff Owned by: nielsm
Priority: low Milestone: 2.1.8
Component: Scripting Version: 2.1.7
Severity: minor Keywords:
Cc: mermaid.sea@… Platform: All
Sub Component:

Description

script_name = "Style Copy"
script_description = "Duplicates a style."
script_author = "Lexica-chan"
script_version = "1.0"

function do_style_copy(subs)
    local style = nil
    local stylepos = nil

    for i = 1, #subs do
        if subs[i].class == "style" then
            stylepos = i
            style = subs[i]
            break
        end
    end
    
    style.name = style.name .. " (Copy)"
    subs[-1 * stylepos] = style
    
    aegisub.set_undo_point(script_name)
end

aegisub.register_macro(script_name, script_description, do_style_copy)

The above code should do nothing to the style, but if the spacing field is noninteger, it gets truncated.

Attachments (1)

bug1019.patch (556 bytes) - added by nielsm 4 years ago.

Download all attachments as: .zip

Change History (4)

comment:1 Changed 4 years ago by nielsm

Attaching a patch that should fix this. I can't commit it myself right now due to working on a branch, and I can't bother switching back :)

Changed 4 years ago by nielsm

comment:2 Changed 4 years ago by verm

(In [85d3ea9]) Commit patch for #1019 for jfs' as he doesn't have the branch compiling locally, I'll merge this to milestone:2.1.8 after this, updates #1019.

comment:3 Changed 4 years ago by verm

  • Resolution set to fixed
  • Status changed from new to closed

(In [f4269de]) Merge r3644 into milestone:2.1.8 for jfs, closes #1019.

Note: See TracTickets for help on using tickets.