• Subject: rulers
  • From: Frank Richter <frichter@xxxxxxxx>
  • Date: Wed, 2 May 2001 12:27:45 +0200
  • Mail-Followup-To: Frank Richter <frichter@esda.com>, LINUX5250@midrange.com
  • User-Agent: Mutt/1.2.5i

As I'm a RPG programmer, I really needed the functionality of "rulers".
But it's not possible to implement them in a curses client. So I made a
workaround, which is a bit ugly but works for me: I patched cursesterm.c
to show the row and column of characters, which the cursor is in, in
bold. Maybe someone with a deeper knowledge of the source can make a
configurable option and a key binding for this.

Here it is:

--- cursesterm.c.orig   Wed May  2 12:16:19 2001
+++ cursesterm.c        Wed May  2 12:21:43 2001
@@ -49,6 +49,7 @@
 #define A_5250_YELLOW   ((attr_t)COLOR_PAIR(COLOR_YELLOW) | A_BOLD)
 #define A_5250_PINK     ((attr_t)COLOR_PAIR(COLOR_MAGENTA))
 #define A_5250_BLUE     ((attr_t)COLOR_PAIR(COLOR_CYAN) | A_BOLD)
+#define A_5250_RULER    (A_BOLD)
 
 /*@-globstate -nullpass@*/  /* lclint incorrectly assumes stdscr may be NULL */
 
@@ -605,7 +606,20 @@
         c = tn5250_display_char_at(display, y, x);
         if ((c & 0xe0) == 0x20) {      /* ATTRIBUTE */
            a = (c & 0xff);
-           addch(attribute_map[0] | ' ');
+           /* rulers */
+           if((tn5250_display_cursor_x(display)==x)&&
+                 (x<(tn5250_display_width(display)-1))&&
+                 (tn5250_display_cursor_y(display)!=y)) {
+              addch(attribute_map[0] | ' ' | A_5250_RULER  );
+           } else {
+              if((tn5250_display_cursor_y(display)==y)&&
+                    (tn5250_display_cursor_x(display)!=x)) {
+                 addch(attribute_map[0] | ' ' | A_5250_RULER  );
+              } else {
+                 addch(attribute_map[0] | ' ');
+              }
+           }
+           /* ~rulers */
         } else {               /* DATA */
            curs_attr = attribute_map[a - 0x20];
            if (curs_attr == 0x00) {    /* NONDISPLAY */
@@ -635,7 +649,20 @@
                        c = '_';
                  }
               }
-              addch((chtype)(c | curs_attr));
+              /* rulers */
+              if((tn5250_display_cursor_x(display)==x)&&
+                 (x<(tn5250_display_width(display)-1))&&
+                 (tn5250_display_cursor_y(display)!=y)) {
+                    addch((chtype)(c | curs_attr | A_5250_RULER  ));
+              } else {
+                 if((tn5250_display_cursor_y(display)==y)&&
+                    (tn5250_display_cursor_x(display)!=x)) {
+                    addch((chtype)(c | curs_attr | A_5250_RULER  ));
+                 } else {
+                    addch((chtype)(c | curs_attr));
+                 }
+              }
+              /* ~rulers */
            }
         }                      /* if ((c & 0xe0) ... */
       }                                /* for (int x ... */

-- 
Esda Feinstrumpffabrik GmbH
Frank Richter, Leiter EDV
Hauptstr. 76, D-09392 Auerbach
E-Mail: frichter@esda.com
+---
| This is the LINUX5250 Mailing List!
| To submit a new message, send your mail to LINUX5250@midrange.com.
| To subscribe to this list send email to LINUX5250-SUB@midrange.com.
| To unsubscribe from this list send email to LINUX5250-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.