Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

102
Views
Hiding Cursor in Xterm Tektronix 4014 Mode

I wrote the following program to test the Xterm Tektronix 4014 mode:

#define _BSD_SOURCE
#include <stdio.h>
#include <assert.h>
#include <unistd.h>

#define GS ((char)0x1D)
#define ESC ((char)0x1B)
#define FF ((char)0x0C)

static void xy (int x,  int y, char* restrict xy) {
  xy[3] = (x % 32) + 64; // x low
  xy[2] = (x >> 5) + 32; // x high
  xy[1] = (y % 32) + 96; // y low
  xy[0] = (y >> 5) + 32; // y high
  assert (x == 32 * (xy[2] - 32) + xy[3] - 64);
  assert (y == 32 * (xy[0] - 32) + xy[1] - 96);
}

static void enter_graphic () {
  printf("%c", GS);
}

static void leave_graphic () {
  printf("\n");
}


static char pt[] = { ESC, 0, 0, 0, 0, 0, 0 };

/* This function is NOT threadsafe! (but why should it be ...) */
static void line_to (int x, int y, char pattern) {
  pt[1] = pattern ? pattern : '`';
  xy(x, y, pt + 2);
  printf("%s", pt);
}

static void clear () {
  printf("%c%c", ESC, FF);
}

static void randgrph (int dx, int dy) {
  int x, y;
  enter_graphic ();

  for (int i = 0; i < 10; ++i) {
    for (int j = 0; j < 10; ++j) {
      x = (x + 7) % 200;
      y = (y + 39) % 200;
      line_to(x + dx, y + dy, 'b');
    }
  }

  leave_graphic();
}

int main (void) {
  int i, j;
  for (i = 0; i < 200; ++i) {
    for (j = 0; j < 200; ++j) {
      clear();
      randgrph(i, j);
      usleep(1000000/25);
    }
  }
}

This seems to work fine. xy creates a coordinate pair, and line_to draws a line. This will clear the screen, draw some dotted lines, in a loop. At least on Xterm, it looks "animated" (I'd guess a real Tektronix would not be fast enough, but it's just for testing).

However: It always shows the textcursor. How can I stop it from doing so? I could not find a Tek control sequence to hide the text cursor, there are only possibilities to hide the graphic cursor, which is not shown in xterm anyway.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

The solution was that the control terminal needs to be set to not echoing input. This can be done with noecho() from libncurses.

over 4 years ago · Santiago Trujillo Report

0

The VT100 sequence ESC [ ? 2 5 l might work.

over 4 years ago · Santiago Trujillo Report

0

The VT100 escapes do not apply to the Tek4014 display. Tek4014 has only two cursor modes:

  • normal (the arrow)
  • graphics GIN mode (also referred to as the cross-hairs cursor).

The graphics cursor is activated by an escape sequence escapecontrolZ and deactivated by a mouse click, e.g., the gin-press action used in the translations resource.

For reference:

  • Tektronix 4014 Mode (XTerm Control Sequences)
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!