How to determine the position of cursor in a fraction

From https://www.douban.com/group/topic/150659046/?start=0

在数学模式中, 输入 \frac, 然后出现分子分母两个空给我填. 想请问, 怎么用 Scheme 代码判断鼠标是处于分子还是分母?

如果能判断好是分子还是分母, 那么可以写一个快捷键, 使得这个快捷键先跳到分母上, 然后在跳出整个分式, 这样设计的快捷键更加自然一些.

English Translation of the above:

In math mode, I hit \frac, Texmacs will give me the denominator and numerator to fill. Is there a way to tell whether the cursor is at the denominator or numerator using Scheme code?

If one can, then it is possible to write in Scheme code a shortcut to to jump from numerator, then to denominator, then out of the whole fraction. It would be nice to have such a shortcut.

Dig into the source code of:

(cursor-inside? (focus-tree))
(tree-label (focus-tree))

And then you may find the answer.

Acitvate the Developer menu, and you will find the most helpful Definition of xxx menu entry.

What I want to do is to determine the four positions in the fraction

(frac "<partial>" "<partial>")

and do the filling-in.

Thank you for the clues. If I’d found the solution, I will post here.