tweaks and updates

This commit is contained in:
Kyle Isom 2020-02-12 06:46:35 -08:00
parent 50200a3303
commit a72621c77f
4 changed files with 14 additions and 7 deletions

View File

@ -1,5 +1,7 @@
[ ] goto-line [X] goto-line
[ ] text-corruption bug [ ] text-corruption bug
[ ] alt-modifiers [ ] alt-modifiers
[ ] refresh-screen [ ] refresh-screen
[ ] functions -> keymapping? [ ] functions -> keymapping?
[X] rendering: need to skip over control characters like we do with tabs
[X] control-d -> delete

View File

@ -23,12 +23,12 @@ byte_to_hihex(char c)
static char static char
byte_to_lohex(char c) byte_to_lohex(char c)
{ {
c &= 0x0f; c = c & 0x0f;
if (c < 10) { if (c < 10) {
return c + 0x30; return c + 0x30;
} }
return c + 0x41; return c + 0x37;
} }
@ -41,6 +41,8 @@ erow_render_to_cursor(struct erow *row, int cx)
for (j = 0; j < cx; j++) { for (j = 0; j < cx; j++) {
if (row->line[j] == '\t') { if (row->line[j] == '\t') {
rx += (TAB_STOP-1) - (rx%TAB_STOP); rx += (TAB_STOP-1) - (rx%TAB_STOP);
} else if (row->line[j] < 0x20) {
rx += 2;
} }
rx++; rx++;
} }
@ -58,6 +60,8 @@ erow_cursor_to_render(struct erow *row, int rx)
for (curx = 0; curx < row->size; curx++) { for (curx = 0; curx < row->size; curx++) {
if (row->line[curx] == '\t') { if (row->line[curx] == '\t') {
cur_rx += (TAB_STOP - 1) - (cur_rx % TAB_STOP); cur_rx += (TAB_STOP - 1) - (cur_rx % TAB_STOP);
} else if (row->line[curx] < 0x20) {
cur_rx += 2;
} }
cur_rx++; cur_rx++;

View File

@ -21,7 +21,7 @@
#include "defs.h" #include "defs.h"
#define KE_VERSION "0.0.1-pre" #define KE_VERSION "0.9.0"
#define ESCSEQ "\x1b[" #define ESCSEQ "\x1b["
#define CTRL_KEY(key) ((key)&0x1f) #define CTRL_KEY(key) ((key)&0x1f)
#define TAB_STOP 8 #define TAB_STOP 8
@ -761,8 +761,9 @@ process_normal(int16_t c)
return; return;
case BACKSPACE: case BACKSPACE:
case CTRL_KEY('h'): case CTRL_KEY('h'):
case CTRL_KEY('d'):
case DEL_KEY: case DEL_KEY:
if (c == DEL_KEY) { if (c == DEL_KEY || c == CTRL_KEY('d')) {
move_cursor(ARROW_RIGHT); move_cursor(ARROW_RIGHT);
} }
@ -901,7 +902,7 @@ draw_rows(struct abuf *ab)
if (filerow >= editor->nrows) { if (filerow >= editor->nrows) {
if ((editor->nrows == 0) && (y == editor->rows / 3)) { if ((editor->nrows == 0) && (y == editor->rows / 3)) {
buflen = snprintf(buf, sizeof(buf), buflen = snprintf(buf, sizeof(buf),
"ke k%s", KE_VERSION); "ke v%s", KE_VERSION);
padding = (editor->rows - buflen) / 2; padding = (editor->rows - buflen) / 2;
if (padding) { if (padding) {

View File

@ -1 +1 @@
hello world s ome tex t for you hello world s ome tex t for you