vtm icon indicating copy to clipboard operation
vtm copied to clipboard

Setting inheritance

Open sertonix opened this issue 3 years ago • 5 comments

Allow setting files to include other setting files. This would allow to have a base config and some that have small edits for specific uses. Also it should be possible to define partial configs.

<config parent="./base.xml">
  <term parent="./term/long-history.xml"/>
</config>
<!-- `./term/long-history.xml` -->
<term>
  <scrollback size=20000000 />
</term>

sertonix avatar Jan 02 '23 19:01 sertonix

It also makes sense to place reusable pieces directly in the current configuration, for example, directly in <config/set>. Use a colon to point to a base block from the <config/set> namespace. If the name is in quotes, then this is a link to the file.

<config:"./base.xml">
    <menu>
        <item:dtvt_term:no_reset:rich_selection id=T1/>
        <item:dtvt_term:html_selection id=T2/>
    </menu>
    <term:"./term/long-history.xml"/>
    <set>
        <blackdk   = 0xFF101010 />
        <reddk     = 0xFF1f0fc4 />
        <greendk   = 0xFF0ea112 />
        ...
        <dtvt_term type=DirectVT cmd="$0 -r term"/>
        <no_reset>
            <config>
                <term>
                    <scrollback><reset onkey=off/></scrollback>
                </term>
            </config>
        </no_reset>
        <rich_selection>
            <config>
                <term>
                    <selection mode="rich"/>
                </term>
            </config>
        </rich_selection>
        <html_selection>
            <config>
                <term>
                    <selection mode="html"/>
                </term>
            </config>
        </html_selection>
    </set>
</config>

o-sdn-o avatar Jan 03 '23 10:01 o-sdn-o

We can also do inline nested blocks for brevity

<config:"./base.xml">
    <menu>
        <item:dtvt_term:no_reset:rich_selection id=T1/>
        <item:dtvt_term:html_selection id=T2/>
    </menu>
    <term:"./term/long-history.xml"/>
    <set>
        <blackdk   = 0xFF101010 />
        <reddk     = 0xFF1f0fc4 />
        <greendk   = 0xFF0ea112 />
        ...
        <dtvt_term type=DirectVT cmd="$0 -r term"/>
        <no_reset/config/term/scrollback/reset onkey=off/>
        <rich_selection/config/term/selection mode="rich"/>
        <html_selection/config/term/selection mode="html"/>
    </set>
</config>

o-sdn-o avatar Jan 03 '23 11:01 o-sdn-o

More special syntax will make #326 harder but I really like the ideas.

sertonix avatar Jan 03 '23 11:01 sertonix

Without involving the "Set" block and with the support of relative and absolute paths

<config:"./base.xml">
    <menu>
        <base>
            <dtvt_term type=DirectVT param="$0 -r term"/>
            <no_reset/config/term/scrollback/reset onkey=off/>
            <rich_selection/config/term/selection mode="rich"/>
            <html_selection/config/term/selection mode="html"/>
        </base>
        <item:/config/menu/base/dtvt_term:base/no_reset id=T1/> <!-- Absolute path -->
        <item:base/dtvt_term:base/no_reset:base/rich_selection id=T2/> <!-- Relative path -->
        <item:base/dtvt_term:base/no_reset:base/html_selection id=T3/>
    </menu>
    <term:"./term/long-history.xml"/>
    <set>
        <blackdk   = 0xFF101010 />
        <reddk     = 0xFF1f0fc4 />
        <greendk   = 0xFF0ea112 />
        ...
    </set>
</config>

o-sdn-o avatar May 25 '23 05:05 o-sdn-o

The following declarations are equivalent

<list item*>
    <item param=value/>
    <item param1=value1 param2=value2 param=value/>
    <item param3=value3 param=value/>
    <item param2=value2/>
</list>
<base>
    <block1 param1=value1 />
    <block2 param2=value2 />
</base>
<list item*>
    <block3 param3=value3 />
    <item param=value/>
    <item:/base/block1:/base/block2 param=value/>
    <item:block3 param=value/>
    <item:/base/block2 />
</list>

o-sdn-o avatar May 25 '23 07:05 o-sdn-o