home *** CD-ROM | disk | FTP | other *** search
/ Aminet 10 / aminetcdnumber101996.iso / Aminet / text / edit / FrexxEdA.lha / FrexxEd / fpl / TabSpace.FPL < prev    next >
Text File  |  1995-07-19  |  1KB  |  39 lines

  1. /**************************************************************
  2.  *
  3.  *  Name:  TabSpace()
  4.  *
  5.  *  Function:  Construct a local bool environment variable  - 'tab_space'.
  6.  *             Assign the tab key to execute the TabSpace() function
  7.  *             if the variable is TRUE.
  8.  *  Addition:  now binds backspacing a tab stop to shift-tab as well. very
  9.  *             handy!
  10.  *
  11.  *  Author:  Kjell Ericson
  12.  *  added to by: Edd Dumbill ejad-a@minster.york.ac.uk
  13.  *********/
  14. export int TabSpace()
  15. {
  16.   string str="";
  17.   int tabsize=ReadInfo("tab_size");
  18.   int antal=tabsize-((ReadInfo("cursor_x")+ReadInfo("screen_x")-1)%tabsize);
  19.  
  20.   while (antal-->0)
  21.     str=joinstr(str, " ");
  22.  
  23.   Output(str);
  24.  
  25. }
  26.     
  27. /* stuff added by Edd Dumbill ejad-a@minster.york.ac.uk */
  28.  
  29. export int BackTabSpace()
  30. {
  31.     int tabsize=ReadInfo("tab_size");
  32.     int pos=tabsize-((ReadInfo("cursor_x")+ReadInfo("screen_x")-1)%tabsize);
  33.     Backspace(pos);
  34. }
  35.  
  36. ConstructInfo("tab_space", "", "", "BLW(display)", "", 0, 1);
  37. AssignKey("TabSpace();", "'tab'", "tab_space");
  38. AssignKey("BackTabSpace();", "shift 'tab'", "tab_space");
  39.