Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

307 lines
8.9 KiB

  1. /* $Header: /nw/tony/src/stevie/src/RCS/help.c,v 1.9 89/08/06 09:50:09 tony Exp $
  2. *
  3. * Routine to display a command summary.
  4. */
  5. #include "stevie.h"
  6. extern char *Version;
  7. static int helprow;
  8. #ifdef HELP
  9. static void longline();
  10. bool_t
  11. help()
  12. {
  13. /***********************************************************************
  14. * First Screen: Positioning within file, Adjusting the Screen
  15. ***********************************************************************/
  16. ClearDisplay();
  17. windgoto(helprow = 0, 0);
  18. longline(
  19. " Positioning within file\n"
  20. " =======================\n"
  21. " ^F Forward screenfull Developed by:\n"
  22. " ^B Backward screenfull Tony Andrews\n");
  23. longline(
  24. " ^D scroll down half screen\n"
  25. " ^U scroll up half screen Based on a program by:\n");
  26. longline(
  27. " G Goto line (end default) Tim Thompson\n"
  28. " ]] next function\n"
  29. " [[ previous function\n"
  30. " /re next occurence of regular expression 're'\n");
  31. longline(
  32. " ?re prior occurence of regular expression 're'\n"
  33. " n repeat last / or ?\n"
  34. " N reverse last / or ?\n"
  35. " % find matching (, ), {, }, [, or ]\n");
  36. longline(
  37. "\n"
  38. " Adjusting the screen\n"
  39. " ====================\n"
  40. " ^L Redraw the screen\n"
  41. " ^E scroll window down 1 line\n"
  42. " ^Y scroll window up 1 line\n");
  43. longline(
  44. " z<RETURN> redraw, current line at top\n"
  45. " z- ... at bottom\n"
  46. " z. ... at center\n");
  47. windgoto(0, 52);
  48. longline(Version);
  49. windgoto(helprow = Rows-2, 47);
  50. longline("<Press space bar to continue>\n");
  51. windgoto(helprow = Rows-1, 47);
  52. longline("<Any other key will quit>");
  53. if ( vgetc() != ' ' )
  54. return TRUE;
  55. /***********************************************************************
  56. * Second Screen: Character positioning
  57. ***********************************************************************/
  58. ClearDisplay();
  59. windgoto(helprow = 0, 0);
  60. longline(
  61. " Character Positioning\n"
  62. " =====================\n"
  63. " ^ first non-white\n"
  64. " 0 beginning of line\n"
  65. " $ end of line\n"
  66. " h backward\n");
  67. longline(
  68. " l forward\n"
  69. " ^H same as h\n"
  70. " space same as l\n"
  71. " fx find 'x' forward\n");
  72. longline(
  73. " Fx find 'x' backward\n"
  74. " tx upto 'x' forward\n"
  75. " Tx upto 'x' backward\n"
  76. " ; Repeat last f, F, t, or T\n");
  77. longline(
  78. " , inverse of ;\n"
  79. " | to specified column\n"
  80. " % find matching (, ), {, }, [, or ]\n");
  81. windgoto(helprow = Rows-2, 47);
  82. longline("<Press space bar to continue>\n");
  83. windgoto(helprow = Rows-1, 47);
  84. longline("<Any other key will quit>");
  85. if ( vgetc() != ' ' )
  86. return TRUE;
  87. /***********************************************************************
  88. * Third Screen: Line Positioning, Marking and Returning
  89. ***********************************************************************/
  90. ClearDisplay();
  91. windgoto(helprow = 0, 0);
  92. longline(
  93. " Line Positioning\n"
  94. " ================\n"
  95. " H home window line\n"
  96. " L last window line\n"
  97. " M middle window line\n");
  98. longline(
  99. " + next line, at first non-white\n"
  100. " - previous line, at first non-white\n"
  101. " CR return, same as +\n"
  102. " j next line, same column\n"
  103. " k previous line, same column\n");
  104. longline(
  105. "\n"
  106. " Marking and Returning\n"
  107. " =====================\n"
  108. " `` previous context\n"
  109. " '' ... at first non-white in line\n");
  110. longline(
  111. " mx mark position with letter 'x'\n"
  112. " `x to mark 'x'\n"
  113. " 'x ... at first non-white in line\n");
  114. longline("\n"
  115. " Undo & Redo\n"
  116. " =============\n"
  117. " u undo last change\n"
  118. " U restore current line\n"
  119. " . repeat last change\n");
  120. windgoto(helprow = Rows-2, 47);
  121. longline("<Press space bar to continue>\n");
  122. windgoto(helprow = Rows-1, 47);
  123. longline("<Any other key will quit>");
  124. if ( vgetc() != ' ' )
  125. return TRUE;
  126. /***********************************************************************
  127. * Fourth Screen: Insert & Replace,
  128. ***********************************************************************/
  129. ClearDisplay();
  130. windgoto(helprow = 0, 0);
  131. longline(
  132. " Insert and Replace\n"
  133. " ==================\n"
  134. " a append after cursor\n"
  135. " i insert before cursor\n"
  136. " A append at end of line\n"
  137. " I insert before first non-blank\n");
  138. longline(
  139. " o open line below\n"
  140. " O open line above\n"
  141. " rx replace single char with 'x'\n"
  142. " R replace characters\n");
  143. longline(
  144. "\n"
  145. " Words, sentences, paragraphs\n"
  146. " ============================\n"
  147. " w word forward\n"
  148. " b back word\n"
  149. " e end of word\n"
  150. " ) to next sentence (not yet)\n"
  151. " } to next paragraph (not yet)\n");
  152. longline(
  153. " ( back sentence (not yet)\n"
  154. " { back paragraph (not yet)\n"
  155. " W blank delimited word\n"
  156. " B back W\n"
  157. " E to end of W\n");
  158. windgoto(helprow = Rows-2, 47);
  159. longline("<Press space bar to continue>\n");
  160. windgoto(helprow = Rows-1, 47);
  161. longline("<Any other key will quit>");
  162. if ( vgetc() != ' ' )
  163. return TRUE;
  164. /***********************************************************************
  165. * Fifth Screen: Misc. operations,
  166. ***********************************************************************/
  167. ClearDisplay();
  168. windgoto(helprow = 0, 0);
  169. longline(
  170. " Miscellaneous Commands\n"
  171. " ======================\n");
  172. longline(
  173. " :w write back changes\n"
  174. " :wq write and quit\n"
  175. " :x write if modified, and quit\n"
  176. " :q quit\n"
  177. " :q! quit, discard changes\n"
  178. " :e name edit file 'name'\n");
  179. longline(
  180. " :e! reedit, discard changes\n"
  181. " :e # edit alternate file\n"
  182. " :w name write file 'name'\n");
  183. longline(
  184. " :n edit next file in arglist\n"
  185. " :N edit prior file in arglist\n"
  186. " :n args specify new arglist (not yet)\n"
  187. " :rew rewind arglist\n"
  188. " :f show current file and lines\n");
  189. longline(
  190. " :f file change current file name\n"
  191. " :g/pat/p|d global command (print or delete only)\n"
  192. " :s/p1/p2/ text substitution (trailing 'g' optional)\n"
  193. "");
  194. longline(
  195. " :ta tag to tag file entry 'tag'\n"
  196. " ^] :ta, current word is tag\n"
  197. " :sh run an interactive shell\n"
  198. " :!cmd execute a shell command\n"
  199. "");
  200. windgoto(helprow = Rows-2, 47);
  201. longline("<Press space bar to continue>\n");
  202. windgoto(helprow = Rows-1, 47);
  203. longline("<Any other key will quit>");
  204. if ( vgetc() != ' ' )
  205. return TRUE;
  206. /***********************************************************************
  207. * Sixth Screen: Operators, Misc. operations, Yank & Put
  208. ***********************************************************************/
  209. ClearDisplay();
  210. windgoto(helprow = 0, 0);
  211. longline(
  212. " Operators (double to affect lines)\n"
  213. " ==================================\n"
  214. " d delete\n"
  215. " c change\n");
  216. longline(
  217. " < left shift\n"
  218. " > right shift\n"
  219. " y yank to buffer\n"
  220. " ! filter lines\n");
  221. longline("\n"
  222. " Miscellaneous operations\n"
  223. " ========================\n"
  224. " C change rest of line\n"
  225. " D delete rest of line\n"
  226. " s substitute chars\n");
  227. longline(
  228. " S substitute lines (not yet)\n"
  229. " J join lines\n"
  230. " x delete characters\n"
  231. " X ... before cursor\n");
  232. longline("\n"
  233. " Yank and Put\n"
  234. " ============\n"
  235. " p put back text\n"
  236. " P put before\n"
  237. " Y yank lines");
  238. windgoto(helprow = Rows-1, 47);
  239. longline("<Press any key>");
  240. (void) vgetc();
  241. return TRUE;
  242. }
  243. static void
  244. longline(p)
  245. char *p;
  246. {
  247. register char *s;
  248. for ( s = p; *s ;s++ ) {
  249. if ( *s == '\n' )
  250. windgoto(++helprow, 0);
  251. else
  252. outchar(*s);
  253. }
  254. }
  255. #else
  256. bool_t
  257. help()
  258. {
  259. msg("Sorry, help not configured");
  260. return FALSE;
  261. }
  262. #endif