Better comments, again
This commit is contained in:
parent
58fa6d7049
commit
af6f449b19
17
src/node.c
17
src/node.c
|
@ -86,24 +86,28 @@ enum cursorMoveResult TeX_node_cursor_enter(struct TeX_Node *node, struct editCo
|
|||
{
|
||||
enum cursorMoveResult skipPast = action == CURSOR_MOVE_RIGHT ? CURSOR_PAST_END : CURSOR_PAST_START;
|
||||
|
||||
// Text
|
||||
if (node->type == 0)
|
||||
{
|
||||
int len = strlen(node->text);
|
||||
if (len == 1) return skipPast;
|
||||
// Text
|
||||
context->elementIsText = true;
|
||||
context->cursorText = node;
|
||||
context->offset = action == CURSOR_MOVE_RIGHT ? 0 : len - 2;
|
||||
return SUCCESS;
|
||||
}
|
||||
if (node->type > 1)
|
||||
// Regular nodes
|
||||
else if (node->type > 1)
|
||||
{
|
||||
if (action == CURSOR_MOVE_RIGHT)
|
||||
{
|
||||
// Enter the numerator
|
||||
// Enter the first child flow
|
||||
|
||||
// If there is no child, skip past this node
|
||||
if (node->args[0] == NULL)
|
||||
return CURSOR_PAST_END;
|
||||
|
||||
// Update the cursor to be in the right place
|
||||
context->elementIsText = false;
|
||||
context->cursorFlow = node->args[0];
|
||||
context->offset = 0;
|
||||
|
@ -111,14 +115,19 @@ enum cursorMoveResult TeX_node_cursor_enter(struct TeX_Node *node, struct editCo
|
|||
}
|
||||
else if (action == CURSOR_MOVE_LEFT)
|
||||
{
|
||||
// Enter the denominator
|
||||
// Enter the last child flow
|
||||
|
||||
struct TeX_Flow *denom = node->args[1];
|
||||
|
||||
// If there is only one child, go to it instead
|
||||
if (denom == NULL)
|
||||
denom = node->args[0];
|
||||
|
||||
// If there is no child, skip past this node
|
||||
if (denom == NULL)
|
||||
return CURSOR_PAST_START;
|
||||
|
||||
// Update the cursor to be in the right place
|
||||
context->elementIsText = false;
|
||||
context->cursorFlow = denom;
|
||||
context->offset = denom->elements;
|
||||
|
|
Loading…
Reference in New Issue