SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: ewjax on July 14, 2006, 02:50:00 am

Title: Same Line Braces macro - insert {} on current line
Post by: ewjax on July 14, 2006, 02:50:00 am
From the source file (see attached):

Code: [Select]
#include "slick.sh"


// 
// simple macro to put two braces in the file, without auto-expanding them
// this is useful for one-line functions in .h files, for example
//   
// original author:  Elliott W. Jackson
//
_command SameLineBraces()
{
   // save insert mode, and set mode to insert
   int insertstate;
   insertstate = _insert_state();
   _insert_state(1);

   _insert_text("{}"); 
   cursor_left();

   // restore original insert mode
   _insert_state(insertstate);
}