47 lines
1.1 KiB
C
47 lines
1.1 KiB
C
//---
|
|
// edit: Structures related to cursor movement and editing
|
|
//---
|
|
|
|
#ifndef TEX_EDIT
|
|
#define TEX_EDIT
|
|
|
|
#include <stdbool.h>
|
|
|
|
struct editContext {
|
|
bool elementIsText;
|
|
union {
|
|
struct TeX_Flow* cursorFlow;
|
|
struct TeX_Node* cursorText;
|
|
};
|
|
int offset;
|
|
|
|
int cursorX;
|
|
int cursorY;
|
|
};
|
|
|
|
// An enum for action that the cursor can take
|
|
enum cursorAction {
|
|
CURSOR_MOVE_LEFT,
|
|
CURSOR_MOVE_RIGHT
|
|
};
|
|
|
|
// An enum of return values for the move_cursor function
|
|
enum cursorMoveResult {
|
|
// The cursor was found and updated, and the recursive search can end
|
|
SUCCESS,
|
|
// The cursor was not found, and the recursive search should continue
|
|
CURSOR_NOT_HERE,
|
|
|
|
// For these values where the cursor exits, the parent is responsible for
|
|
// moving the cursor out of the flow or node.
|
|
// It may also choose to ingore the cursor exit and keep the cursor in the
|
|
// flow or node, for example if there is no parent to move the cursor to.
|
|
|
|
// The cursor exited the flow or node out of the right side
|
|
CURSOR_PAST_END,
|
|
// The cursor exited the flow or node out of the left side
|
|
CURSOR_PAST_START
|
|
};
|
|
|
|
#endif /* TEX_EDIT */
|