# Internals and Miscellaneous
-* Re-work column tracking to keep the cursor reasonably close to where expected
* Calculate line numbers and keep up to date while editing
* Support multiple buffers
* Implement undo/redo log
# Unicode
* Fix display of asian scripts and combining characters
-* Read the file in bytewise and detect the encoding and line endings. Use that info to perform cursor movements and redisplay.
# Graphical User Interface
TargetCol = buf_getcol(&Buffer, CursorPos);
}
+static void cursor_home(void) {
+ CursorPos = buf_bol(&Buffer, CursorPos);
+ TargetCol = 0;
+}
+
+static void cursor_end(void) {
+ CursorPos = buf_eol(&Buffer, CursorPos);
+ TargetCol = (unsigned)-1;
+}
+
void handle_key(Rune key) {
/* ignore invalid keys */
if (key == RUNE_ERR) return;
case KEY_INSERT: Buffer.insert_mode = !Buffer.insert_mode; break;
case KEY_F1: Buffer.insert_mode = !Buffer.insert_mode; break;
case KEY_DELETE: buf_del(&Buffer, CursorPos); break;
- case KEY_HOME: CursorPos = buf_bol(&Buffer, CursorPos); break;
- case KEY_END: CursorPos = buf_eol(&Buffer, CursorPos); break;
+ case KEY_HOME: cursor_home(); break;
+ case KEY_END: cursor_end(); break;
}
}
/* flush the screen buffer */
unsigned nrows, ncols;
screen_getsize(&nrows, &ncols);
- screen_status(" %s %s%s",
+ screen_status(" %s %c %s",
(Buffer.charset == BINARY ? "BIN" : "UTF-8"),
- (Buffer.modified ? " * " : " "),
- Buffer.path);
+ (Buffer.modified ? '*' : ' '),
+ Buffer.path
+ );
for (unsigned y = 0; y < nrows; y++) {
Row* row = screen_getrow(y);
XftDrawString32(X.xft, (y==0 ? &bkgclr : &txtclr), X.font, 0, (y+1) * fheight, (FcChar32*)(row->cols), (row->len));
}
redraw();
}
- deinit();
return 0;
}