# Implementation Tweaks and Bug Fixes
+* Home key should toggle between beginning of line and beginning of non-ws data
* Expand tabs setting should be disabled if opened file contains tabs
* Add tag for ctags lookup and line number jump
* add a shortcut to autocomplete ctag
+* Add a tools dir to namespace utility scripts only useful inside the editor
* off by one error on scrolling up with wrapped lines
* block selection should handle brace-balancing
* Use select to check for error strings in exec.c
* track down double click bug for selecting whole line
* Implement minimal regex search (per Kernighan article)
* Implement fuzzy file/buffer/tag picker
+* check for file changes when window regains focus
+* check for file changes on save
# Auxillary Programs
void view_scroll(View* view, int move);
void view_scrollpage(View* view, int move);
void view_setln(View* view, size_t line);
+void view_indent(View* view, int dir);
/* Command Executions
*****************************************************************************/
view->sync_needed = true;
view->sync_center = true;
}
+
+void view_indent(View* view, int dir) {
+ Buf* buf = &(view->buffer);
+ unsigned indoff = (buf->expand_tabs ? TabWidth : 1);
+ view->selection.beg = buf_bol(buf, view->selection.beg);
+ view->selection.end = buf_eol(buf, view->selection.end);
+ unsigned off = buf_bol(buf, view->selection.end);
+ while (off >= view->selection.beg) {
+ if (dir == RIGHT) {
+ buf_ins(buf, true, off, '\t');
+ view->selection.end += indoff;
+ } else if (dir == LEFT) {
+ unsigned i = 4;
+ for (; i > 0; i--) {
+ if (' ' == buf_get(buf, off)) {
+ buf_del(buf, off);
+ view->selection.end--;
+ } else {
+ break;
+ }
+ }
+ if (i && '\t' == buf_get(buf, off)) {
+ buf_del(buf, off);
+ view->selection.end--;
+ }
+ }
+ off = buf_byline(buf, off, UP);
+ }
+}
\ No newline at end of file
static void goto_ctag(void);
static void tabs(void);
static void indent(void);
+static void del_indent(void);
+static void add_indent(void);
// Tag/Cmd Execution
static Tag* tag_lookup(char* cmd);
static View* currview(void);
static Buf* currbuf(void);
static enum RegionId getregion(size_t x, size_t y);
+static Sel* getsel(enum RegionId id);
+static Sel* currsel(void);
/* Global Data
*****************************************************************************/
{ ModCtrl, 'x', cut },
{ ModCtrl, 'c', copy },
{ ModCtrl, 'v', paste },
+
+ /* Block Indent */
+ { ModCtrl, '[', del_indent },
+ { ModCtrl, ']', add_indent },
/* Common Special Keys */
{ ModNone, KEY_PGUP, page_up },
getbuf(TAGS)->copy_indent = enabled;
}
+static void del_indent(void) {
+ view_indent(currview(), LEFT);
+}
+
+static void add_indent(void) {
+ view_indent(currview(), RIGHT);
+}
+
/* Tag/Cmd Execution
*****************************************************************************/
static Tag* tag_lookup(char* cmd) {
}
return NREGIONS;
}
+
+static Sel* getsel(enum RegionId id) {
+ return &(getview(id)->selection);
+}
+
+static Sel* currsel(void) {
+ return getsel(Focused);
+}