Disable auto-jumping between different graphics nodes

I have a recurring issue: I am editing a diagram in the graphics editor, and then I use one of the arrow keys (sometimes on purpose, sometimes on accident) and it begins searching for the “next” similar text node to jump to. Unfortunately what is happening is that the next node is in a diagram very far away, and this results in TeXmacs hanging for a very long time (minutes) while it searches for it.

I would just as well not have this behavior — I don’t mind it within a single diagram, but I do not want TeXmacs to jump me to a far away diagram.

Does anyone have a tip for how to achieve this? Thank you! :slight_smile:

I haven’t tried yet (not at the computer at the moment), but you can make a mode-dependent redefinition of kbd-right to do nothing. These two links can give you an idea. You can try to combine in-graphics? and in-text? as mode.


1 Like

I’m not sure to understand the problem. When I hit the arrow keys in a graphics it shifts the origin of the graphics wrt. the surrounds, it does not change the focus. I can hit “tab” to cycle between the focus on points nearby the cursor.

I believe @jonsterling is referring to text within graphics. If you are at the end of such a text field and press the right key, the cursor will move to the next such similar field. This may be in another graphic.

1 Like

Perhaps inside-graphical-text? can be used for this.

I had another look at this, as it is really annoying me.

A crude hack is to change the function kbd-horizontal in TeXmacs/progs/graphics/graphics-kbd.scm to the following, which makes the cursor simply move out of the text area without searching. It moves the cursor into the surrounding graphics area, so repeated arrow key presses will move the origin, which is not ideal, but better than having to kill TeXmacs :slight_smile:

(tm-define (kbd-horizontal t forwards?)
  (:require (graphical-text-context? t))
  (with-define (move) ((if forwards? go-right go-left))
    (with-define (next) (go-to-next-inside move inside-graphics-context?)
      (next))))

For reference:
https://savannah.gnu.org/bugs/index.php?62453

EDIT
This may be a somewhat better solution, which puts the cursor just after the graphics:

(define (inside-text-context? t)
  (if (in-active-graphics?) 
    (inside-graphical-text-context? t)
    t))

(tm-define (kbd-horizontal t forwards?)
  (:require (graphical-text-context? t))
  (with-define (move) ((if forwards? go-right go-left))
    (go-to-next-inside move inside-text-context?)))
1 Like