Author Topic: Same Line Braces macro - insert {} on current line  (Read 4262 times)

ewjax

  • Community Member
  • Posts: 10
  • Hero Points: 0
Same Line Braces macro - insert {} on current line
« 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);
}