REBOL [
    title: "Editor with Undo"
    date: 4-Oct-2010
    file: %editor-with-undo.r
    author:  "Romano Paolo Tenca, (incorporated by Nick Antonaccio)"
    purpose: {

        Demonstrates how alter REBOL's built in text editor.  Romano Paolo
        Tenca's "edit-text-undo" (http://www.rebol.it/romano/edit-text-undo.txt)
        is incorporated.  The color scheme and help text in the editor are also
        adjusted.  The key to making the changes is in the lines:

        ctx-edit: mold :ctx-edit
        (make changes to the code in ctx-edit)
        ctx-edit: do ctx-edit

    }
]

do undo: decompress #{
789CAD58DD6EA33A10BEA64F61F55C546A85C856DA1BBAE7F441908FE4829358
4B2002A709FBF4677E6C6C2034ED9E8DD406EC99F137BF9E49D936565FAC7833
4DC5FF8ABBE4D4546D7A50975C7CDB6C3642BC88A66DB4F85B9C9ADA1C8CD595
7044AAAA72B13D35A528B6AAD412B913B315AAAE45611A818BE20149418415DB
5AED525C7BE59DBDA9B44496C434BDEEAC286BAD3ADACB8849C1527B1C788580
02447D7915A5EAB425467798C72CC6871FA2D6CDCEEE5FC55EAB2A0805909D3E
B4EF7ABE8EE2C6B75C5865EAB00B9B40209DDE3B6D977A8F2073964C1881CC74
BD9D08A2E7DA343AAD4D0F14685D5876A8169495E9ECF00A80BA932608CE5804
F0A71E0EEA48E7FF75FFEFAF7BE138E165B8179DF62F27DE49C15824E365DB76
42F7E55DD26B2B1EF6A636BBBDC56DA7973B5D646D530FC0422BDAD8BD06BEC3
1110455E293032901FDFD8A37B78E7B5DEAACEDB64649992E8A68A0DEE086414
4C183E88448C5105E025593F83A77C1627E4ABBB040DEA1DA5DF7503E164BB5A
1C6B659AA946B899F57BB3056554338862865F2CF421F74A39551D243AB74F04
9790665D5B47A7B36A93631D07F143B2CD01CC6C3C339E4313D44E87384245A5
6BAB4456B7A502046D2FECE1887FCFE42D78C845BBDD422CA4B64D1942C4F784
2CEE10246052A6F0A988C25648602B981AE9B241FCF80765C243010BB260FC0C
9F22525786559DC523BB5195D6B46844A711A481C08C1A447F5647E6F31A8AA3
DAE9F474E4EFAA3D7304A5BDF9A57D608F0B39C7103E8AD43B91A3ACDA69513C
8BC7F04A64B2D8A0DB0141EEFC098FECDE6BF52E00CCE964B67D48A5A88A70F6
2BB0FFF8943B5BCEA3ACEBDAEE152AC48065375448594C934A16CAAE1453E912
0E374CB36D193155297ADDC01E59380F8BA47FE6942DF70A20A023482D6F3ABC
5360B1C79870856BA4192F113A8C56982445618C808D99C8820CDCEB5A97D657
3DF892A14E9CDBAE8A0038AF8395391D58DCE868F02E078CFF7E149B4BFA4D8E
AC18283799918979E0B672E058B55A634E5345E7902DDE54F9334590DE37B810
12173E1DE6F394A901774C987061C204811D73F8609F009F68C86C94070BC6B0
BA64F59C93133CCE70E3490F21A25E1CC67119D3230973ECDB835E155EBCE91D
D49614614DCCA0B1775939A180CDAB4CE4128A3576DA95804CE836E0C704AAA1
B61002E4685DA5FE2643D48031EA4B92D9D5E26F002F89D33E2677F77F76C462
EFD23B848C2B668E56FA1626A20B699C704A2457FB87711374F943AAA3A53FA3
FA4241B188EE58ADCFAB02A7E8518F2B7517849DBA6654E5666576747CC984D4
A70ABC2EC3AAB737688D8B6D5B9E7A566D6B74CD0695DE321763277A5D31FBA2
0636FA8CA11B690C3D115F7245D4B951AB169D862D91A30A8F2470DEB300EDC9
DDB6EBD1403226FE8F36D7C3E323C71D550F4C37CEBD217AD948AF1EEA6F4D3F
6D500C76545C6A737C6B5557E55916E1A37924A54AB28E6F19D68B7273DB1210
3C936CFC20BEA63936F6C39DE6C01B2B0C1DE757A34E73AC2151297A9E35ACAE
25A5FA130571B112D59F4EA90F732A61A808C763FC3F5903F68A0CFC024934F6
1C91955746552EE761381C6B0787CE5746D464325652A98E67BC519D9D8E134A
46D8718CBB0D99CBF0127274F8EFA1BF81CECF95AB08613E5B4407C5D008319A
FBA360F9EA0F09B35F0F6410D3DBCE343B671C8453C496087D37CE945FBC24FE
D44540FFA56B775D478BF43006E08443F2D9C26BC8D898EF469F1FB3C5B43A5F
A6A171AC976C8DAC82AE2E32228D1EF78FF7E30F29530761C71B1B03400BF709
CDCDCAB418113EBB4107EAA7CAFA123A853AECFB1000BA0C7FD2D9F0F8488F92
47DB9831BBE49E2015C423AFCB1A82AC614DD6907B02963544B2B88CE5938980
DAB3F830A221ACDF3F84FA144853F15D5E138220B913FF08E7532077030A4555
BF6FCF3E7769C49602AF8D7E80CBF79061648807B85DB7B858DA0BDFC7B4F21F
C9601ECC1F140000
}
base-color: 230.230.255  base-effect: []
ctx-edit: mold :ctx-edit
changes: [
    {style tx vtext bold 40x22 font [colors: [0.0.0 200.200.200]]} 
    {style tx text 40x22 font [colors: [0.0.0 170.170.170]]}
    {vtext} {text}
    {btn-enter} {btn} {btn-cancel} {btn} {btn green} {btn} {btn red + 50} {btn}
    {[tabs: 28 origin: 4x4]}
    {[tabs: 28 origin: 4x4] with [
        undo: []
        colors: [254.254.254 255.255.255]
    ]}
    {Ctrl-V - paste text}
    {Ctrl-V - paste text^/^-^-Ctrl-Z - undo^/^-^-Ctrl-Y - redo}
]
foreach [original changed] changes [replace/all ctx-edit original changed]
ctx-edit: do ctx-edit
editor none