BUGS:
-* no copy indent
-* characters missing from riscmd: |+-
* no analysis of line-endings or tabs in document
-* no trimming of trailing whitespace
+* no copy indent
+* add arguments to keybindings
+* mouse selection handling when mouse moves outside region
* no magic right click
-* Ctrl+Up,Dn not bound or not working
* gap buffer does not handle UTF-8 currently
-* mouse selection handling when mouse moves outside region
+* no trimming of trailing whitespace
Up Next:
void buf_getcol(Buf* buf);
void buf_setcol(Buf* buf);
+size_t buf_selbeg(Buf* buf);
size_t buf_selsz(Buf* buf);
void buf_selclr(Buf* buf, int dir);
bool buf_insel(Buf* buf, size_t off);
buf->selection = sel;
}
+size_t buf_selbeg(Buf* buf) {
+ Sel sel = buf_getsel(buf);
+ return (sel.beg < sel.end ? sel.beg : sel.end);
+}
+
size_t buf_selsz(Buf* buf) {
Sel sel = buf_getsel(buf);
return sel.end - sel.beg;
/* ignore non-printable control characters */
if (!isspace(rune) && (rune >= 0 && rune < 0x20))
return;
- buf_putc(BUF, rune);
+ if (ExpandTabs && rune == '\t') {
+ size_t off = buf_selbeg(BUF);
+ size_t n = (TabWidth - ((off - buf_bol(BUF, off)) % TabWidth));
+ for (; n > 0; n--) buf_putc(BUF, ' ');
+ } else {
+ buf_putc(BUF, rune);
+ }
move_to(view, false, CSRPOS);
}