# Implementation Tweaks and Bug Fixes
-* Indent on first line of buffer causes infinite loop
+* Should not be able to undo initial tag line text insertion
* block selection should handle brace-balancing
-* Add a GoTo tag for ctags lookup and line number jump
+* Indent on first line of buffer causes infinite loop
* Add a SaveAs tag that takes an argument for the filename to save as
+* Add a GoTo tag for ctags lookup and line number jump
* Add a ctrl+space shortcut to autocomplete ctag
* Use select to check for error strings in exec.c
-* Should not be able to undo initial tag line text insertion
* check for file changes on save
-* backspace should delete indent if preceded by whitespace
* context sensitive selection of words, commands, line numbers, or filenames.
Nice to haves:
-* focus should follow mouse between regions
* Expand tabs setting should be disabled if opened file contains tabs
* Add a tools dir to namespace utility scripts only useful inside the editor
* shift+click to extend selection
* implement command diffing logic to optimize the undo/redo log
* add command line flags to toggle options (Tabs, Indent, etc..)
* check for file changes when window regains focus
+* backspace should delete indent if preceded by whitespace
Need to reproduce:
void buf_undo(Buf* buf, Sel* sel);
void buf_redo(Buf* buf, Sel* sel);
void buf_loglock(Buf* buf);
+void buf_logclear(Buf* buf);
bool buf_iseol(Buf* buf, unsigned pos);
unsigned buf_bol(Buf* buf, unsigned pos);
MOUSE_BTN_WHEELUP = 3,
MOUSE_BTN_WHEELDOWN = 4,
MOUSE_BTN_NONE = 5,
- MOUSE_BTN_COUNT = 5
+ MOUSE_BTN_COUNT = 6
} MouseBtn;
typedef struct {
*buf = copy;
}
-static void clear_redo(Buf* buf) {
- Log* log = buf->redo;
- while (log) {
- Log* deadite = log;
- log = deadite->next;
- if (!deadite->insert)
- free(deadite->data.del.runes);
- free(deadite);
- }
- buf->redo = NULL;
-}
-
static void delete(Buf* buf, unsigned off) {
syncgap(buf, off);
buf->gapend++;
void buf_init(Buf* buf) {
/* cleanup old data if there is any */
if (buf->bufstart) free(buf->bufstart);
- if (buf->undo) log_clear(&(buf->undo));
- if (buf->redo) log_clear(&(buf->redo));
+ buf_logclear(buf);
/* reset the state to defaults */
buf->modified = false;
for (; beg < end; beg++)
off = buf_insert(buf, true, off, buf_get(buf, beg));
}
- clear_redo(buf);
+ log_clear(&(buf->redo));
return off;
}
unsigned buf_delete(Buf* buf, unsigned beg, unsigned end) {
buf->modified = true;
- clear_redo(buf);
+ log_clear(&(buf->redo));
for (unsigned i = end-beg; i > 0; i--) {
Rune r = buf_get(buf, beg);
log_delete(buf, &(buf->undo), beg, &r, 1);
buf->transid++;
}
+void buf_logclear(Buf* buf) {
+ log_clear(&(buf->redo));
+ log_clear(&(buf->undo));
+}
+
/*****************************************************************************/
bool buf_iseol(Buf* buf, unsigned off) {
| ButtonPressMask
| ButtonReleaseMask
| ButtonMotionMask
+ | PointerMotionMask
| KeyPressMask
| ExposureMask
| FocusChangeMask);
/* load the buffer views */
view_init(getview(TAGS), NULL);
view_putstr(getview(TAGS), DEFAULT_TAGS);
+ buf_logclear(getbuf(TAGS));
view_init(getview(EDIT), (argc > 1 ? argv[1] : NULL));
/* initialize the display engine */
x11_init(&Config);
size_t col = (x-Regions[id].x) / x11_font_width(Font);
if (act == MOUSE_ACT_MOVE) {
if (MouseBtns[MOUSE_BTN_LEFT].pressed) {
- view_setcursor(getview(id), row, col);
- MouseBtns[MOUSE_BTN_LEFT].pressed = false;
- MouseBtns[MOUSE_BTN_LEFT].count = 0;
- } else if (MouseBtns[MOUSE_BTN_LEFT].region < id) {
- //view_scroll(getview(MouseBtns[MOUSE_BTN_LEFT].region), +1);
- } else if (MouseBtns[MOUSE_BTN_LEFT].region > id) {
- //view_scroll(getview(MouseBtns[MOUSE_BTN_LEFT].region), -1);
- } else {
- view_selext(getview(id), row, col);
+ if (MouseBtns[MOUSE_BTN_LEFT].count == 1) {
+ view_setcursor(getview(id), row, col);
+ MouseBtns[MOUSE_BTN_LEFT].count = 0;
+ } else {
+ view_selext(getview(id), row, col);
+ }
}
} else {
MouseBtns[btn].pressed = (act == MOUSE_ACT_DOWN);