Compare commits
2 Commits
master
...
kyle/word-
| Author | SHA1 | Date | |
|---|---|---|---|
| e69d63dd57 | |||
| 536a81bc02 |
@@ -2,24 +2,20 @@ 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.0.10")
|
set(KE_VERSION "1.0.11")
|
||||||
|
|
||||||
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")
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
||||||
|
|
||||||
# Optionally enable AddressSanitizer (ASan)
|
include(GNUInstallDirs)
|
||||||
option(ENABLE_ASAN "Enable AddressSanitizer for builds" OFF)
|
|
||||||
|
|
||||||
if (ENABLE_ASAN)
|
|
||||||
message(STATUS "ASan enabled")
|
|
||||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
|
|
||||||
# Ensure the sanitizer is linked too (especially important on some platforms)
|
|
||||||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fsanitize=address")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
|
|
||||||
# Add executable
|
# Add executable
|
||||||
add_executable(ke main.c)
|
add_executable(ke main.c)
|
||||||
|
|
||||||
# Define KE_VERSION for use in C code (e.g., #define KE_VERSION)
|
|
||||||
target_compile_definitions(ke PRIVATE KE_VERSION="ke version ${KE_VERSION}")
|
target_compile_definitions(ke PRIVATE KE_VERSION="ke version ${KE_VERSION}")
|
||||||
|
install(TARGETS ke RUNTIME DESTINATION bin)
|
||||||
|
install(FILES ke.1 TYPE MAN)
|
||||||
|
|
||||||
|
install(TARGETS ke RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
|
||||||
|
install(FILES ke.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||||
|
|
||||||
|
|||||||
@@ -11,4 +11,8 @@ It should be available via homebrew, even:
|
|||||||
brew tap kisom/homebrew-tap
|
brew tap kisom/homebrew-tap
|
||||||
brew install ke
|
brew install ke
|
||||||
|
|
||||||
|
To get verbose ASAN messages:
|
||||||
|
|
||||||
|
export LSAN_OPTIONS=verbosity=1:log_threads=1
|
||||||
|
|
||||||
Released under an ISC license.
|
Released under an ISC license.
|
||||||
25
main.c
25
main.c
@@ -122,6 +122,7 @@ void editor_set_status(const char *fmt, ...);
|
|||||||
void die(const char *s);
|
void die(const char *s);
|
||||||
int get_winsz(int *rows, int *cols);
|
int get_winsz(int *rows, int *cols);
|
||||||
void goto_line(void);
|
void goto_line(void);
|
||||||
|
int cursor_at_eol(void);
|
||||||
void delete_row(int at);
|
void delete_row(int at);
|
||||||
void row_append_row(struct erow *row, char *s, int len);
|
void row_append_row(struct erow *row, char *s, int len);
|
||||||
void row_insert_ch(struct erow *row, int at, int16_t c);
|
void row_insert_ch(struct erow *row, int at, int16_t c);
|
||||||
@@ -508,6 +509,30 @@ goto_line(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int
|
||||||
|
cursor_at_eol(int curx, int cury)
|
||||||
|
{
|
||||||
|
assert(curx >= 0);
|
||||||
|
assert(cury >= 0);
|
||||||
|
assert(cury < editor.nrows);
|
||||||
|
assert(curx < editor.row[cury].size);
|
||||||
|
|
||||||
|
return curx == editor.row[cury].size;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void
|
||||||
|
find_next_word()
|
||||||
|
{
|
||||||
|
int x = editor.curx;
|
||||||
|
int y = editor.cury;
|
||||||
|
|
||||||
|
while (1) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
delete_row(int at)
|
delete_row(int at)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user