Skip to content

Commit

Permalink
pound: cosmetics, comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ivop committed Sep 11, 2024
1 parent 12e8f29 commit e1a85cd
Showing 1 changed file with 17 additions and 22 deletions.
39 changes: 17 additions & 22 deletions apps/pound.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,6 @@ void editorOpen(void) {

// -------------------- SCREEN OUTPUT --------------------

// skipped rendering tabs and slow cursor movement
// if rendering is added, we should only keep the currently drawn line as
// rendered in memory, not every line which takes way too much memory

void editorScroll() {
if (E.cy < E.rowoff) {
E.rowoff = E.cy;
Expand Down Expand Up @@ -381,8 +377,7 @@ void editorMoveCursor(uint8_t key) {
E.cx = E.row[E.cy].size;
}
break;
case CTRL('D'): // right
{
case CTRL('D'): { // right
struct erow *row = E.cy >= E.numrows ? NULL : &E.row[E.cy];
if (row && E.cx < row->size) {
E.cx++;
Expand Down Expand Up @@ -478,16 +473,15 @@ void editorProcessKeypress(void) {
editorInsertNewline();
break;

case CTRL('E'): // up
case CTRL('X'): // down
case CTRL('S'): // left
case CTRL('D'): // right
case CTRL('E'): // ^E up
case CTRL('X'): // ^X down
case CTRL('S'): // ^S left
case CTRL('D'): // ^D right
editorMoveCursor(c);
break;

case CTRL('R'): // page up
case CTRL('C'): // page down
{
case CTRL('R'): // ^R page up
case CTRL('C'): { // ^C page down
if (c == CTRL('R')) {
E.cy = E.rowoff;
} else {
Expand All @@ -500,9 +494,15 @@ void editorProcessKeypress(void) {
}
break;

case CTRL('A'): // ^A previous word
break;
case CTRL('F'): // ^F next word
editorFindNextWord();
break;

case 127:
case CTRL('G'): // ^G DEL
case CTRL('H'): // ^H BS
case CTRL('G'): // ^G DEL
case CTRL('H'): // ^H BS
if (c == CTRL('G')) editorMoveCursor(CTRL('D'));
editorDelChar();
break;
Expand All @@ -514,11 +514,9 @@ void editorProcessKeypress(void) {
ctrlq = true;
break;

case CTRL('I'):
{
case CTRL('I'): {
int n = 4 - (E.cx & 3);
for (uint8_t i=0; i < n; i++)
editorInsertChar(' ');
for (uint8_t i=0; i < n; i++) editorInsertChar(' ');
break;
}
default:
Expand All @@ -527,9 +525,6 @@ void editorProcessKeypress(void) {
}
}

// ^A word left, after first word, go to eol of previous line
// ^F word right, after last word, eol, if eol, goto next word on next line

// -------------------- INIT --------------------

void initEditor(void) {
Expand Down

0 comments on commit e1a85cd

Please sign in to comment.