home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 10 / 10.iso / l / l460 / 2.ddi / GENERAL.DI$ / CEDIT.M < prev    next >
Encoding:
Text File  |  1993-03-07  |  3.3 KB  |  89 lines

  1. function cedit(s)
  2. %CEDIT    Set command line edit/recall facility parameters.
  3. %    CEDIT('off') turns off command line recall/edit.
  4. %    CEDIT('on') turns command line recall/edit back on.
  5. %    CEDIT('vms') chooses VMS key definitions.
  6. %    CEDIT('emacs') returns to the default Emacs key definitions.
  7. %    Here is a table that shows which keystrokes are available
  8. %    using the command line editor:
  9. %
  10. %    Previous line: ^p
  11. %    Next line: ^n
  12. %    One character left: ^b
  13. %    One character right: ^f
  14. %    Cursor word left: esc b, ^l
  15. %    Cursor word right: esc f, ^r
  16. %    Cursor to beginning of line: ^a
  17. %    Cursor to end of line: ^e
  18. %    Cancel line: ^u
  19. %    In place delete: ^d
  20. %    Insert toggle: ^t
  21. %    Delete to end of line: ^k
  22. %
  23. %    Type CEDIT.M for more information.
  24. %    The 'emacs' option is always in effect for MS-Windows, in
  25. %    addition to its normal fixed key bindings.
  26.  
  27. %    S.N. Bangert 12-1-89 
  28. %    Revised 1-12-90 JNL
  29. %    Copyright (c) 1984-93 by The MathWorks, Inc.
  30.  
  31. % Note: This M-file uses undocumented features of MATLAB that
  32. % are subject to change.
  33.  
  34. c = computer;
  35. if c(1:2) == 'PC'
  36.    return
  37. end
  38. if strcmp(s,'off')
  39.     system_dependent(2,0);
  40. elseif strcmp(s,'on')
  41.     system_dependent(2,1);
  42. end
  43.  
  44. if strcmp(s,'emacs')
  45. % Set up command line recall facility to respond to Emacs keystrokes
  46. system_dependent(4,  1,  20)     % Insert toggle: ^t
  47. system_dependent(4,  2,  1)      % Cursor to beginning of line: ^a
  48. system_dependent(4,  3,  5)      % Cursor to end of line: ^e
  49. system_dependent(4,  4, [27 'b'] ,12)% Cursor word left: esc b, ^l
  50. system_dependent(4,  5, [27 'f'], 18)% Cursor word right: esc f, ^r
  51. system_dependent(4,  6, 21)      % Cancel line: ^u
  52. system_dependent(4,  7,  4)      % In place delete: ^d
  53. system_dependent(4,  8,  0)      % Delete left: no additional
  54. system_dependent(4,  9, 16)      % Previous line: ^p
  55. system_dependent(4, 10, 14)      % Next line: ^n
  56. system_dependent(4, 11,  2)      % One character left: ^b
  57. system_dependent(4, 12,  6)      % One character right: ^f
  58. end
  59.  
  60. if strcmp(s,'vms')
  61. % Set up command line recall facility to respond to VMS keystrokes
  62. system_dependent(4,  1,  1) % Insert toggle: ^a 
  63. system_dependent(4,  2,  2) % Cursor to beginning of line: ^b
  64. system_dependent(4,  3,  5) % Cursor to end of line: ^e
  65. system_dependent(4,  4, 12) % Cursor word left: ^l
  66. system_dependent(4,  5, 18) % Cursor word right: ^r
  67. system_dependent(4,  6, 21) % Cancel line: ^u
  68. system_dependent(4,  7,  0) % In place delete: no additional
  69. system_dependent(4,  8,  0) % Delete left: no additional
  70. system_dependent(4,  9,  0) % Previous line: no additional
  71. system_dependent(4, 10,  0) % Next line: no additional
  72. system_dependent(4, 11,  0) % One character left: no additional
  73. system_dependent(4, 12,  0) % One character right: no additional
  74. system_dependent(4, 13,  4) % EOF key: ^d
  75.  
  76. end
  77.  
  78. % Note: In addition to the above definitions, the following functions 
  79. % are ALWAYS attached to standard keys via termcap:
  80. %  One character left - Left Arrow
  81. %  One character right - Right Arrow
  82. %  Previous line - Up Arrow
  83. %  Next line - Down Arrow
  84. %
  85. % The following functions are always attached to their 'stty' definitions:
  86. %   Delete Left (i.e. backspace operation) - STTY 'ERASE' Key
  87. %   If ERASE key is <BS> (stty ^H) then <DEL> does in-place delete.
  88. %   If ERASE key is <DEL> (stty ^?) then <BS> does in-place delete.
  89.