Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e079726ced |
@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.15)
|
|||||||
project(ke C) # Specify C language explicitly
|
project(ke C) # Specify C language explicitly
|
||||||
|
|
||||||
set(CMAKE_C_STANDARD 99)
|
set(CMAKE_C_STANDARD 99)
|
||||||
set(KE_VERSION "1.5.4")
|
set(KE_VERSION "1.5.5")
|
||||||
|
|
||||||
set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -Wshadow -Werror -std=c99 -g")
|
set(CMAKE_C_FLAGS "-Wall -Wextra -pedantic -Wshadow -Werror -std=c99 -g")
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DEFAULT_SOURCE -D_XOPEN_SOURCE")
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_DEFAULT_SOURCE -D_XOPEN_SOURCE")
|
||||||
|
|||||||
40
main.c
40
main.c
@@ -97,6 +97,30 @@ typedef struct erow {
|
|||||||
} erow;
|
} erow;
|
||||||
|
|
||||||
|
|
||||||
|
typedef enum undo_kind {
|
||||||
|
UNDO_INSERT = 1 << 0,
|
||||||
|
UNDO_UNKNOWN = 1 << 1,
|
||||||
|
} undo_kind;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct undo_node {
|
||||||
|
undo_kind op;
|
||||||
|
size_t row, col;
|
||||||
|
abuf text;
|
||||||
|
|
||||||
|
struct undo_node *next;
|
||||||
|
struct undo_node *parent;
|
||||||
|
|
||||||
|
} undo_node;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct undo_tree {
|
||||||
|
undo_node *root; /* the start of the undo sequence */
|
||||||
|
undo_node *current; /* where we are currently at */
|
||||||
|
undo_node *pending; /* the current undo operations being built */
|
||||||
|
} undo_tree;
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* editor is the global editor state; it should be broken out
|
* editor is the global editor state; it should be broken out
|
||||||
* to buffers and screen state, probably.
|
* to buffers and screen state, probably.
|
||||||
@@ -3053,10 +3077,11 @@ install_signal_handlers(void)
|
|||||||
int
|
int
|
||||||
main(int argc, char *argv[])
|
main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
char *arg;
|
char *arg = NULL;
|
||||||
int lineno = 0;
|
int lineno = 0;
|
||||||
int opt;
|
int opt;
|
||||||
int debug = 0;
|
int debug = 0;
|
||||||
|
int jump = 0;
|
||||||
|
|
||||||
install_signal_handlers();
|
install_signal_handlers();
|
||||||
|
|
||||||
@@ -3092,13 +3117,16 @@ main(int argc, char *argv[])
|
|||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
lineno = atoi(arg);
|
lineno = atoi(arg);
|
||||||
|
jump = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
editor_set_status("C-k q to exit / C-k d to dump core");
|
editor_set_status("C-k q to exit / C-k d to dump core");
|
||||||
if (lineno < 1) {
|
if (jump) {
|
||||||
editor_set_status("Invalid line number %s", arg);
|
if (lineno < 1) {
|
||||||
} else {
|
editor_set_status("Invalid line number %s", arg);
|
||||||
jump_to_position(0, lineno - 1);
|
} else {
|
||||||
|
jump_to_position(0, lineno - 1);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
display_clear(NULL);
|
display_clear(NULL);
|
||||||
|
|||||||
Reference in New Issue
Block a user