Changing cursor style

Hello, I would like to change the cursor style based on the mode I’m in. Is it possible to change the cursor style? Shape, color etc? Thanks.

No. It is hardcoded in the C++ part.

Thanks for the answer. Do you know in which file/s?

It is implemented in src/Edit/Interface/edit_repaint.cpp in particular the method edit_interface_rep::draw_cursor (renderer ren) which I reproduce below. It also seems that you can programmatically changes the colours by changing the environment variables cursor-color and math-cursor-color.

void
  edit_interface_rep::draw_cursor (renderer ren) {
  if (get_preference ("draw cursor") == "on" &&
      !temp_invalid_cursor && (got_focus || full_screen)) {
    cursor cu= get_cursor();
    if (!inside_active_graphics ()) {
      SI dw= 0;
      if (tremble_count > 3) dw= min (tremble_count - 3, 25) * pixel;
      cu->y1 -= 2*zpixel + dw; cu->y2 += 2*zpixel + dw;
      SI x1= cu->ox + ((SI) (cu->y1 * cu->slope)), y1= cu->oy + cu->y1;
      SI x2= cu->ox + ((SI) (cu->y2 * cu->slope)), y2= cu->oy + cu->y2;
      string mode= get_env_string (MODE);
      string family, series;
      color cuc= get_env_color (CURSOR_COLOR);
      if (!cu->valid) cuc= green;
      else if (mode == "math") cuc= get_env_color (MATH_CURSOR_COLOR);
      ren->set_pencil (pencil (cuc, zpixel + dw));
      if ((mode == "text") || (mode == "src")) {
        family= get_env_string (FONT_FAMILY);
        series= get_env_string (FONT_SERIES);
      }
      else if (mode == "math") {
        family= get_env_string (MATH_FONT_FAMILY);
        series= get_env_string (MATH_FONT_SERIES);
      }
      else if (mode == "prog") {
        family= get_env_string (PROG_FONT_FAMILY);
        series= get_env_string (PROG_FONT_SERIES);
      }
      SI lserif= (series=="bold"? 2*zpixel: zpixel) + dw;
      SI rserif= zpixel + dw;
      if (family == "ss") lserif= rserif= 0;
      ren->line (x1-lserif, y1, x1+rserif, y1);
      if (y1<=y2-zpixel) {
        ren->line (x1, y1, x2, y2-zpixel);
        if (series == "bold") ren->line (x1-zpixel, y1, x2-zpixel, y2-zpixel);
        ren->line (x2-lserif, y2-zpixel, x2+rserif, y2-zpixel);
      }
    }
  }
}

Awesome! Thanks. I was just looking at this file this morning, unintentionally, for a different reason. Nice coincidence. :smiley: