Author Topic: ISPF Copy/Overlay in CUA emulation  (Read 3941 times)

DaveyC

  • Senior Community Member
  • Posts: 146
  • Hero Points: 9
ISPF Copy/Overlay in CUA emulation
« on: April 23, 2007, 11:51:05 am »
ISPF has some nice features, copy overlay being one of them. How do I emulate copy and paste with overlay
in CUA mode easily without having to write a full function macro? I can handle a macro, just not a big one
(that I have to write myself) ;D.

DaveyC

  • Senior Community Member
  • Posts: 146
  • Hero Points: 9
Re: ISPF Copy/Overlay in CUA emulation
« Reply #1 on: April 24, 2007, 12:30:01 am »
I worked it out, overlay-clipboard. Fantastic!

DaveyC

  • Senior Community Member
  • Posts: 146
  • Hero Points: 9
Re: ISPF Copy/Overlay in CUA emulation
« Reply #2 on: April 24, 2007, 02:33:31 pm »
It didn't work as I expected. I wrote a macro, my very first one! I would appreciate a critique to see if there is a better way of doing it.

Code: [Select]
/**
 * Macro for emulating ISPF copy/overlay commands.
 */
_command paste_overlay()
{
    seltype = _select_type();

    if ( seltype == "LINE" )
    {
        // goto the beginning of the block
        begin_select();
        begin_line();

        numLines = count_lines_in_selection();

        // overlay the selected lines
        for ( count = 0; count < numLines; count++ )
        {
            overlay_clipboard();
            cursor_down();
        }

        deselect();
    }
    else
    {
        // no lines selected, overlay the line at the cursor position
        begin_line();
        overlay_clipboard();
    }
}