home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 October / usenetsourcesnewsgroupsinfomagicoctober1994disk2.iso / x / volume13 / kterm / patch1 next >
Internet Message Format  |  1991-05-25  |  16KB

  1. Path: uunet!uunet!elroy.jpl.nasa.gov!lll-winken!sun-barr!newstop!exodus!NMSU.Edu!mleisher
  2. From: mleisher@NMSU.Edu
  3. Newsgroups: comp.sources.x
  4. Subject: v13i040: kterm  - kanji xterm, Patch1, Part01/01
  5. Message-ID: <14025@exodus.Eng.Sun.COM>
  6. Date: 25 May 91 22:02:46 GMT
  7. References: <csx-13i040:kterm@uunet.UU.NET>
  8. Sender: news@exodus.Eng.Sun.COM
  9. Lines: 418
  10. Approved: argv@sun.com
  11.  
  12. Submitted-by: mleisher@NMSU.Edu
  13. Posting-number: Volume 13, Issue 40
  14. Archive-name: kterm/patch1
  15. Patch-To: kterm: Volume XXX, Issue XXX
  16.  
  17. Submitted-By: mleisher@nmsu.edu
  18. Patch-To: kterm  - kanji xterm: Volume 12, Issue 82-99
  19.  
  20. Because of the potentially annoying side-effects of tab and newline
  21. preservation, I've added a command line switch and a VT menu option to
  22. turn the preservation on or off.
  23.  
  24. This brings kterm 4.1.2 to patchlevel 7.
  25.  
  26. [ Moderator's Note: this is the *first* patch since the original submission! ]
  27.  
  28. *** KTerm.ad.ORIG    Mon May 13 19:42:13 1991
  29. --- KTerm.ad    Mon May 13 20:19:08 1991
  30. ***************
  31. *** 35,40 ****
  32. --- 35,41 ----
  33.   *vtMenu*cursesemul*Label:    Enable Curses Emulation
  34.   *vtMenu*visualbell*Label:    Enable Visual Bell
  35.   *vtMenu*marginbell*Label:    Enable Margin Bell
  36. + *vtMenu*tabnlpres*Label:    Enable TAB/NL Preservation
  37.   *vtMenu*altscreen*Label:    Show Alternate Screen
  38.   *vtMenu*softreset*Label:    Do Soft Reset
  39.   *vtMenu*hardreset*Label:    Do Full Reset
  40. *** button.c.ORIG    Mon May 13 19:41:55 1991
  41. --- button.c    Mon May 13 21:35:08 1991
  42. ***************
  43. *** 1594,1606 ****
  44.       else {
  45.               lp = SaveText(screen, crow, ccol, screen->max_col, lp);
  46.   
  47. !             for(i = crow +1; i < row; i++)
  48. !               /*
  49. !                * If any real EOL's occur in the text, SaveText takes care
  50. !                * of inserting them into the saved line.
  51. !                * TAB's are also preserved in SaveText.
  52. !                */
  53. !               lp = SaveText(screen, i, 0, screen->max_col, lp);
  54.   
  55.               if (col >= 0)
  56.                 lp = SaveText(screen, row, 0, col, lp);
  57. --- 1594,1628 ----
  58.       else {
  59.               lp = SaveText(screen, crow, ccol, screen->max_col, lp);
  60.   
  61. !             /*
  62. !              * Only preserve tabs and newlines if the flag is set, otherwise
  63. !              * act in the normal fashion.
  64. !              */
  65. !             if (screen->tabnlpres != True) {
  66. ! #ifdef KTERM
  67. !         lp->code = '\n';    /* put in newline at end of line */
  68. !         lp++->gset = GSET_ASCII;
  69. ! #else /* !KTERM */
  70. !         *lp ++ = '\n';    /* put in newline at end of line */
  71. ! #endif /* !KTERM */
  72. !             }
  73. !             for(i = crow +1; i < row; i++) {
  74. !                 lp = SaveText(screen, i, 0, screen->max_col, lp);
  75. !                 /*
  76. !                  * Only preserve tabs and newlines if the flag is set,
  77. !                  * otherwise act in the normal fashion.
  78. !                  */
  79. !                 if (screen->tabnlpres != True) {
  80. ! #ifdef KTERM
  81. !                     lp->code = '\n';
  82. !                     lp++->gset = GSET_ASCII;
  83. ! #else /* !KTERM */
  84. !                     *lp ++ = '\n';
  85. ! #endif /* !KTERM */
  86. !                 }
  87. !             }
  88.   
  89.               if (col >= 0)
  90.                 lp = SaveText(screen, row, 0, col, lp);
  91. ***************
  92. *** 1956,1961 ****
  93. --- 1978,1984 ----
  94.   #ifdef KTERM
  95.       register Bchr *ch = screen->buf[row + screen->topline];
  96.       register Char g;
  97. +         register int tabnlpres = screen->tabnlpres;
  98.   # ifdef KTERM_HANZI
  99.           /*
  100.            * Need to check to see if a Big5 font is in use also.
  101. ***************
  102. *** 1975,1987 ****
  103.            * Just hoping that there will always be enough space allocated for
  104.            * new lines.
  105.            */
  106. !         if (ch[ecol].attr & NL_TAG)
  107.             ecol++;
  108.       for (i = scol; i < ecol; i++) {
  109.   #ifdef KTERM
  110.           c = ch[i].code & ~NEEDMAP;
  111.           g = ch[i].gset;
  112. !                 if (ch[i].attr & TAB_TAG) {
  113.                       lp->code = '\t';
  114.                       lp->gset = GSET_ASCII;
  115.               i++;
  116. --- 1998,2010 ----
  117.            * Just hoping that there will always be enough space allocated for
  118.            * new lines.
  119.            */
  120. !         if (tabnlpres != False && ch[ecol].attr & NL_TAG)
  121.             ecol++;
  122.       for (i = scol; i < ecol; i++) {
  123.   #ifdef KTERM
  124.           c = ch[i].code & ~NEEDMAP;
  125.           g = ch[i].gset;
  126. !                 if (tabnlpres != False && ch[i].attr & TAB_TAG) {
  127.                       lp->code = '\t';
  128.                       lp->gset = GSET_ASCII;
  129.               i++;
  130. ***************
  131. *** 1991,1997 ****
  132.                       if (i < ecol &&
  133.               (ch[i].code != '\0' || ch[i].attr & (TAB_TAG|NL_TAG)))
  134.                         i--;
  135. !                 } else if (ch[i].attr & NL_TAG) {
  136.                       lp->code = '\n';
  137.                       lp->gset = GSET_ASCII;
  138.           } else if (c < ' ' || c == 0x7f && !(g & CS96)) {
  139. --- 2014,2020 ----
  140.                       if (i < ecol &&
  141.               (ch[i].code != '\0' || ch[i].attr & (TAB_TAG|NL_TAG)))
  142.                         i--;
  143. !                 } else if (tabnlpres != False && ch[i].attr & NL_TAG) {
  144.                       lp->code = '\n';
  145.                       lp->gset = GSET_ASCII;
  146.           } else if (c < ' ' || c == 0x7f && !(g & CS96)) {
  147. *** charproc.c.ORIG    Mon May 13 19:43:39 1991
  148. --- charproc.c    Mon May 13 19:58:13 1991
  149. ***************
  150. *** 119,124 ****
  151. --- 119,125 ----
  152.   #define    XtNlogInhibit        "logInhibit"
  153.   #define    XtNloginShell        "loginShell"
  154.   #define    XtNmarginBell        "marginBell"
  155. + #define XtNtabNlPreserve    "tabNlPreserve"
  156.   #define    XtNpointerColor        "pointerColor"
  157.   #define XtNpointerColorBackground "pointerColorBackground"
  158.   #define    XtNpointerShape        "pointerShape"
  159. ***************
  160. *** 183,188 ****
  161. --- 184,190 ----
  162.   #define    XtCLogging        "Logging"
  163.   #define    XtCLogInhibit        "LogInhibit"
  164.   #define    XtCLoginShell        "LoginShell"
  165. + #define XtCTabNlPreserve    "TabNlPreserve"
  166.   #define    XtCMarginBell        "MarginBell"
  167.   #define XtCMultiClickTime    "MultiClickTime"
  168.   #define    XtCMultiScroll        "MultiScroll"
  169. ***************
  170. *** 396,401 ****
  171. --- 398,404 ----
  172.       { "set-allow132",        HandleAllow132 },
  173.       { "set-cursesemul",        HandleCursesEmul },
  174.       { "set-marginbell",        HandleMarginBell },
  175. +     { "set-tabnlpres",        HandleTabNlPreserve },
  176.       { "set-altscreen",        HandleAltScreen },
  177.       { "soft-reset",        HandleSoftReset },
  178.       { "hard-reset",        HandleHardReset },
  179. ***************
  180. *** 579,584 ****
  181. --- 582,590 ----
  182.   {XtNmarginBell, XtCMarginBell, XtRBoolean, sizeof(Boolean),
  183.       XtOffset(XtermWidget, screen.marginbell),
  184.       XtRBoolean, (caddr_t) &defaultFALSE},
  185. + {XtNtabNlPreserve, XtCTabNlPreserve, XtRBoolean, sizeof(Boolean),
  186. +     XtOffset(XtermWidget, screen.tabnlpres),
  187. +     XtRBoolean, (caddr_t) &defaultFALSE},
  188.   {XtNpointerColor, XtCForeground, XtRPixel, sizeof(Pixel),
  189.       XtOffset(XtermWidget, screen.mousecolor),
  190.       XtRString, "XtDefaultForeground"},
  191. ***************
  192. *** 3463,3468 ****
  193. --- 3469,3475 ----
  194.      new->screen.jumpscroll = request->screen.jumpscroll;
  195.      new->screen.logfile = request->screen.logfile;
  196.      new->screen.marginbell = request->screen.marginbell;
  197. +    new->screen.tabnlpres = request->screen.tabnlpres;
  198.      new->screen.mousecolor = request->screen.mousecolor;
  199.      new->screen.mousecolorback = request->screen.mousecolorback;
  200.      new->screen.multiscroll = request->screen.multiscroll;
  201. *** main.c.ORIG    Mon Mar 18 19:21:48 1991
  202. --- main.c    Mon May 13 21:18:58 1991
  203. ***************
  204. *** 490,495 ****
  205. --- 490,497 ----
  206.   {"+t",        "*tekStartup",    XrmoptionNoArg,        (caddr_t) "off"},
  207.   {"-tm",        "*ttyModes",    XrmoptionSepArg,    (caddr_t) NULL},
  208.   {"-tn",        "*termName",    XrmoptionSepArg,    (caddr_t) NULL},
  209. + {"-tnp",    "*tabNlPreserve", XrmoptionNoArg,    (caddr_t) "on"},
  210. + {"+tnp",    "*tabNlPreserve", XrmoptionNoArg,    (caddr_t) "off"},
  211.   {"-ut",        "*utmpInhibit",    XrmoptionNoArg,        (caddr_t) "on"},
  212.   {"+ut",        "*utmpInhibit",    XrmoptionNoArg,        (caddr_t) "off"},
  213.   {"-vb",        "*visualBell",    XrmoptionNoArg,        (caddr_t) "on"},
  214. *** menu.c.ORIG    Mon May 13 19:30:24 1991
  215. --- menu.c    Mon May 13 21:18:54 1991
  216. ***************
  217. *** 30,36 ****
  218.     do_terminate(), do_kill(), do_quit(), do_scrollbar(), do_jumpscroll(),
  219.     do_reversevideo(), do_autowrap(), do_reversewrap(), do_autolinefeed(),
  220.     do_appcursor(), do_appkeypad(), do_scrollkey(), do_scrollttyoutput(),
  221. !   do_allow132(), do_cursesemul(), do_marginbell(), do_tekshow(), 
  222.     do_altscreen(), do_softreset(), do_hardreset(), do_tekmode(), do_vthide(), 
  223.     do_tektextlarge(), do_tektext2(), do_tektext3(), do_tektextsmall(), 
  224.     do_tekpage(), do_tekreset(), do_tekcopy(), do_vtshow(), do_vtmode(), 
  225. --- 30,37 ----
  226.     do_terminate(), do_kill(), do_quit(), do_scrollbar(), do_jumpscroll(),
  227.     do_reversevideo(), do_autowrap(), do_reversewrap(), do_autolinefeed(),
  228.     do_appcursor(), do_appkeypad(), do_scrollkey(), do_scrollttyoutput(),
  229. !   do_allow132(), do_cursesemul(), do_marginbell(), do_tekshow(),
  230. !   do_tabnlpres(),
  231.     do_altscreen(), do_softreset(), do_hardreset(), do_tekmode(), do_vthide(), 
  232.     do_tektextlarge(), do_tektext2(), do_tektext3(), do_tektextsmall(), 
  233.     do_tekpage(), do_tekreset(), do_tekcopy(), do_vtshow(), do_vtmode(), 
  234. ***************
  235. *** 85,100 ****
  236.       { "cursesemul",    do_cursesemul, NULL },        /* 11 */
  237.       { "visualbell",    do_visualbell, NULL },        /* 12 */
  238.       { "marginbell",    do_marginbell, NULL },        /* 13 */
  239. !     { "altscreen",    do_altscreen, NULL },        /* 14 */
  240. !     { "line1",        NULL, NULL },            /* 15 */
  241. !     { "softreset",    do_softreset, NULL },        /* 16 */
  242. !     { "hardreset",    do_hardreset, NULL },        /* 17 */
  243. !     { "line2",        NULL, NULL },            /* 18 */
  244. !     { "tekshow",    do_tekshow, NULL },        /* 19 */
  245. !     { "tekmode",    do_tekmode, NULL },        /* 20 */
  246.   #if defined(STATUSLINE) || defined(KTERM_KANJI)
  247. !     { "vthide",        do_vthide, NULL },        /* 21 */
  248. !     { "line3",        NULL, NULL },            /* 22 */
  249.   #ifdef STATUSLINE
  250.       { "statusline",    do_statusline, NULL },
  251.       { "reversestatus",    do_reversestatus, NULL },
  252. --- 86,102 ----
  253.       { "cursesemul",    do_cursesemul, NULL },        /* 11 */
  254.       { "visualbell",    do_visualbell, NULL },        /* 12 */
  255.       { "marginbell",    do_marginbell, NULL },        /* 13 */
  256. !     { "tabnlpres",    do_tabnlpres, NULL },        /* 14 */
  257. !     { "altscreen",    do_altscreen, NULL },        /* 15 */
  258. !     { "line1",        NULL, NULL },            /* 16 */
  259. !     { "softreset",    do_softreset, NULL },        /* 17 */
  260. !     { "hardreset",    do_hardreset, NULL },        /* 18 */
  261. !     { "line2",        NULL, NULL },            /* 19 */
  262. !     { "tekshow",    do_tekshow, NULL },        /* 20 */
  263. !     { "tekmode",    do_tekmode, NULL },        /* 21 */
  264.   #if defined(STATUSLINE) || defined(KTERM_KANJI)
  265. !     { "vthide",        do_vthide, NULL },        /* 22 */
  266. !     { "line3",        NULL, NULL },            /* 23 */
  267.   #ifdef STATUSLINE
  268.       { "statusline",    do_statusline, NULL },
  269.       { "reversestatus",    do_reversestatus, NULL },
  270. ***************
  271. *** 221,226 ****
  272. --- 223,229 ----
  273.           update_visualbell();
  274.   #endif
  275.           update_marginbell();
  276. +             update_tabnlpres();
  277.   #ifdef STATUSLINE
  278.           update_statusline();
  279.           set_reversestatus_sensitivity();
  280. ***************
  281. *** 682,688 ****
  282. --- 685,700 ----
  283.       update_marginbell();
  284.   }
  285.   
  286. + static void do_tabnlpres (gw, closure, data)
  287. +      Widget gw;
  288. +      caddr_t closure, data;
  289. + {
  290. +     register TScreen *screen = &term->screen;
  291.   
  292. +     screen->tabnlpres = !screen->tabnlpres;
  293. +     update_tabnlpres();
  294. + }
  295.   static void handle_tekshow (gw, allowswitch)
  296.       Widget gw;
  297.       Bool allowswitch;
  298. ***************
  299. *** 1347,1352 ****
  300. --- 1359,1374 ----
  301.       Cardinal *param_count;
  302.   {
  303.       handle_toggle (do_marginbell, (int) term->screen.marginbell,
  304. +            params, *param_count, w, NULL, NULL);
  305. + }
  306. + void HandleTabNlPreserve(w, event, params, param_count)
  307. +     Widget w;
  308. +     XEvent *event;
  309. +     String *params;
  310. +     Cardinal *param_count;
  311. + {
  312. +     handle_toggle (do_tabnlpres, (int) term->screen.tabnlpres,
  313.              params, *param_count, w, NULL, NULL);
  314.   }
  315.   
  316. *** menu.h.ORIG    Mon May 13 19:30:18 1991
  317. --- menu.h    Mon May 13 20:54:21 1991
  318. ***************
  319. *** 26,32 ****
  320.     HandleAutoWrap(), HandleReverseWrap(), HandleAutoLineFeed(), 
  321.     HandleAppCursor(), HandleAppKeypad(), HandleScrollKey(), 
  322.     HandleScrollTtyOutput(), HandleAllow132(), HandleCursesEmul(), 
  323. !   HandleMarginBell(), HandleAltScreen(), HandleSoftReset(), 
  324.     HandleHardReset(), HandleSetTerminalType(), HandleVisibility(), 
  325.     HandleSetTekText(), HandleTekPage(), HandleTekReset(), HandleTekCopy();
  326.   #ifdef STATUSLINE
  327. --- 26,32 ----
  328.     HandleAutoWrap(), HandleReverseWrap(), HandleAutoLineFeed(), 
  329.     HandleAppCursor(), HandleAppKeypad(), HandleScrollKey(), 
  330.     HandleScrollTtyOutput(), HandleAllow132(), HandleCursesEmul(), 
  331. !   HandleMarginBell(), HandleTabNlPreserve(), HandleAltScreen(), HandleSoftReset(), 
  332.     HandleHardReset(), HandleSetTerminalType(), HandleVisibility(), 
  333.     HandleSetTekText(), HandleTekPage(), HandleTekReset(), HandleTekCopy();
  334.   #ifdef STATUSLINE
  335. ***************
  336. *** 78,93 ****
  337.   #define vtMenu_cursesemul 11
  338.   #define vtMenu_visualbell 12
  339.   #define vtMenu_marginbell 13
  340. ! #define vtMenu_altscreen 14
  341. ! #define vtMenu_line1 15
  342. ! #define vtMenu_softreset 16
  343. ! #define vtMenu_hardreset 17
  344. ! #define vtMenu_line2 18
  345. ! #define vtMenu_tekshow 19
  346. ! #define vtMenu_tekmode 20
  347. ! #define vtMenu_vthide 21
  348.   #if defined(STATUSLINE) || defined(KTERM_KANJI)
  349. ! # define vtMenu_line3 22
  350.   #endif /* STATUSLINE || KTERM_KANJI */
  351.   #ifdef STATUSLINE
  352.   #  define vtMenu_statusline (vtMenu_line3+1)
  353. --- 78,94 ----
  354.   #define vtMenu_cursesemul 11
  355.   #define vtMenu_visualbell 12
  356.   #define vtMenu_marginbell 13
  357. ! #define vtMenu_tabnlpres 14
  358. ! #define vtMenu_altscreen 15
  359. ! #define vtMenu_line1 16
  360. ! #define vtMenu_softreset 17
  361. ! #define vtMenu_hardreset 18
  362. ! #define vtMenu_line2 19
  363. ! #define vtMenu_tekshow 20
  364. ! #define vtMenu_tekmode 21
  365. ! #define vtMenu_vthide 22
  366.   #if defined(STATUSLINE) || defined(KTERM_KANJI)
  367. ! # define vtMenu_line3 23
  368.   #endif /* STATUSLINE || KTERM_KANJI */
  369.   #ifdef STATUSLINE
  370.   #  define vtMenu_statusline (vtMenu_line3+1)
  371. ***************
  372. *** 260,265 ****
  373. --- 261,271 ----
  374.               vtMenuEntries[vtMenu_marginbell].widget, \
  375.               term->screen.marginbell)
  376.   
  377. + #define update_tabnlpres() \
  378. +   update_menu_item (term->screen.vtMenu, \
  379. +                     vtMenuEntries[vtMenu_tabnlpres].widget, \
  380. +                     term->screen.tabnlpres)
  381.   #define update_altscreen() \
  382.     update_menu_item (term->screen.vtMenu, \
  383.               vtMenuEntries[vtMenu_altscreen].widget, \
  384. ***************
  385. *** 287,297 ****
  386. --- 293,305 ----
  387.     update_menu_item (term->screen.vtMenu, \
  388.               vtMenuEntries[vtMenu_statusline].widget, \
  389.               term->screen.statusline)
  390.   #define update_reversestatus() \
  391.     update_menu_item (term->screen.vtMenu, \
  392.               vtMenuEntries[vtMenu_reversestatus].widget, \
  393.               term->screen.reversestatus)
  394.   #endif /* STATUSLINE */
  395.   #ifdef KTERM_KANJI
  396.   #define update_eucmode() \
  397.     update_menu_item (term->screen.vtMenu, \
  398. *** patchlevel.h.ORIG    Wed May 15 03:55:46 1991
  399. --- patchlevel.h    Wed May 15 03:55:48 1991
  400. ***************
  401. *** 1 ****
  402. ! #define patchlevel 6
  403. --- 1 ----
  404. ! #define patchlevel 7
  405. *** ptyx.h.ORIG    Mon May 13 19:35:57 1991
  406. --- ptyx.h    Mon May 13 19:47:56 1991
  407. ***************
  408. *** 390,395 ****
  409. --- 390,396 ----
  410.       Boolean        marginbell;    /* true if margin bell on    */
  411.       int        nmarginbell;    /* columns from right margin    */
  412.       int        bellarmed;    /* cursor below bell margin    */
  413. +     Boolean        tabnlpres;    /* true if TAB/NL preserved    */
  414.       Boolean     multiscroll;    /* true if multi-scroll        */
  415.       int        scrolls;    /* outstanding scroll count    */
  416.       SavedCursor    sc;        /* data for restore cursor    */
  417.  
  418. --
  419. Dan Heller
  420. O'Reilly && Associates       Z-Code Software    Comp-sources-x:
  421. Senior Writer                President          comp-sources-x@uunet.uu.net
  422. argv@ora.com                 argv@zipcode.com
  423.