This commit is contained in:
@@ -35,4 +35,6 @@ Lisp editorDelRow_L(Lisp args, LispError *e, LispContext ctx);
|
|||||||
|
|
||||||
Lisp editorFind_L(Lisp args, LispError *e, LispContext ctx);
|
Lisp editorFind_L(Lisp args, LispError *e, LispContext ctx);
|
||||||
|
|
||||||
|
Lisp editorReadChar_L(Lisp args, LispError *e, LispContext ctx);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -166,3 +166,9 @@ Lisp editorFind_L(Lisp args, LispError *e, LispContext ctx) {
|
|||||||
editorFind();
|
editorFind();
|
||||||
return lisp_null();
|
return lisp_null();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Lisp editorReadChar_L(Lisp args, LispError *e, LispContext ctx) {
|
||||||
|
fprintf(stderr, "char read : %c\n", E.row[E.cursor_y].render[E.cursor_x]);
|
||||||
|
return lisp_make_char(E.row[E.cursor_y].render[E.cursor_x]);
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ void initBuiltins() {
|
|||||||
registerBuiltin("ADD-PACKAGE", addPackage);
|
registerBuiltin("ADD-PACKAGE", addPackage);
|
||||||
registerBuiltin("EDITOR-DEL-ROW", editorDelRow_L);
|
registerBuiltin("EDITOR-DEL-ROW", editorDelRow_L);
|
||||||
registerBuiltin("EDITOR-FIND", editorFind_L);
|
registerBuiltin("EDITOR-FIND", editorFind_L);
|
||||||
|
registerBuiltin("EDITOR-READ-CHAR", editorReadChar_L);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initEditor() {
|
void initEditor() {
|
||||||
|
|||||||
+7
-2
@@ -18,7 +18,11 @@ char * file_completion(const char *path) {
|
|||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
char directory[128];
|
char directory[128];
|
||||||
char predict[128];
|
char predict[128];
|
||||||
size_t predict_len;
|
int predict_len = 0;
|
||||||
|
|
||||||
|
if (path[strlen(path) - 1] == '/') {
|
||||||
|
return path;
|
||||||
|
}
|
||||||
|
|
||||||
// Find dir name
|
// Find dir name
|
||||||
char * last_slash = strrchr(path, '/');
|
char * last_slash = strrchr(path, '/');
|
||||||
@@ -28,12 +32,13 @@ char * file_completion(const char *path) {
|
|||||||
predict_len = strlen(path) - dir_len - 1;
|
predict_len = strlen(path) - dir_len - 1;
|
||||||
strncpy(predict, last_slash + 1, predict_len);
|
strncpy(predict, last_slash + 1, predict_len);
|
||||||
directory[dir_len] = '\0';
|
directory[dir_len] = '\0';
|
||||||
fprintf(stderr, "%s %s\n", directory, predict);
|
|
||||||
predict[predict_len] = '\0';
|
predict[predict_len] = '\0';
|
||||||
|
fprintf(stderr, "%s %s\n", directory, predict);
|
||||||
} else {
|
} else {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
dir = opendir(directory);
|
dir = opendir(directory);
|
||||||
if (!dir)
|
if (!dir)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user