Up Next:
-* refactor selection handling to buf.c to prepare fo rmultiple selections.
-* refactor x11.c and win.c
-* Make Fn keys execute nth command in the tags buffers
* Run commands in the background and don't block the main thread.
+* refactor selection handling to buf.c to prepare for multiple selections.
+* right click to fetch file or line
+* Make Fn keys execute nth command in the tags buffers
* check for file changes on save
* check for file changes when window regains focus
* 100% coverage with unit and unit-integration tests
-* right click to fetch file or line
+* refactor x11.c and win.c
* Status line should omit characters from beginning of path to make file path fit
Straight-up Bugs:
BufSize = 8192, /* default buffer size */
FontCacheSize = 16, /* Maximum number of fonts allowed in the font cache */
EventTimeout = 100, /* Maximum blocking wait time for events */
+ TrimOnSave = 1, /* Enable trimming of trailing whitespace on save */
#ifdef __MACH__
LineSpacing = 0, /* Number of pixels for spacing between lines */
#else
}
static void save(void) {
- buf_save(win_buf(EDIT));
+ Buf* buf = win_buf(EDIT);
+ if (TrimOnSave) {
+ View* view = win_view(EDIT);
+ unsigned off = 0;
+ while (buf_end(buf) && (off < buf_end(buf)-1)) {
+ off = buf_eol(buf, off);
+ Rune r = buf_get(buf, off-1);
+ for (; (r == ' ' || r == '\t'); r = buf_get(buf, off-1)) {
+ if (off <= view->selection.beg) {
+ view->selection.end--;
+ view->selection.beg--;
+ }
+ off = buf_delete(buf, off-1, off);
+ }
+ off = buf_byline(buf, off, +1);
+ }
+ }
+ buf_save(buf);
}
/* Mouse Handling