Up Next:
-* Status line should omit characters from beginning of path to make file path fit
+* fix crash on saving read-only file
+
* clipboard does not persist after exit
* Run commands in the background and don't block the main thread.
* Make Fn keys execute nth command in the tags buffer
* Add a GoTo tag for ctags lookup and line number jump (or right click magic?)
* Add keyboard shortcut to highlight the thing under the cursor
* right click to fetch file or line
+* Status line should omit characters from beginning of path to make file path fit
Straight-up Bugs:
void view_byrune(View* view, int move, bool extsel);
void view_byword(View* view, int move, bool extsel);
void view_byline(View* view, int move, bool extsel);
-char* view_fetchcmd(View* view, size_t row, size_t col);
-void view_findstr(View* view, int dir, char* str);
+char* view_fetch(View* view, size_t row, size_t col);
+bool view_findstr(View* view, int dir, char* str);
void view_insert(View* view, bool indent, Rune rune);
void view_delete(View* view, int dir, bool byword);
void view_bol(View* view, bool extsel);
return num_selected(view->selection);
}
-char* view_fetchcmd(View* view, size_t row, size_t col) {
+char* view_fetch(View* view, size_t row, size_t col) {
char* str = NULL;
size_t off = getoffset(view, row, col);
if (off != SIZE_MAX) {
return str;
}
-void view_findstr(View* view, int dir, char* str) {
+bool view_findstr(View* view, int dir, char* str) {
Sel sel = view->selection;
buf_findstr(&(view->buffer), dir, str, &sel.beg, &sel.end);
+ bool found = (0 != memcmp(&sel, &(view->selection), sizeof(Sel)));
view->selection = sel;
view->sync_needed = true;
view->sync_center = true;
+ return found;
}
void view_insert(View* view, bool indent, Rune rune) {
if (win_btnpressed(MOUSE_BTN_LEFT)) {
cut();
} else {
- char* str = view_fetchcmd(win_view(id), row, col);
+ char* str = view_fetch(win_view(id), row, col);
if (str) exec(str);
free(str);
}
} else {
SearchDir *= (x11_keymodsset(ModShift) ? -1 : +1);
free(SearchTerm);
- SearchTerm = view_getstr(win_view(id), NULL);
- Sel before = win_view(EDIT)->selection;
- view_findstr(win_view(EDIT), SearchDir, SearchTerm);
- Sel after = win_view(EDIT)->selection;
- if (memcmp(&before, &after, sizeof(Sel))) {
+ SearchTerm = view_fetch(win_view(id), row, col);
+ if (view_findstr(win_view(EDIT), SearchDir, SearchTerm)) {
win_setregion(EDIT);
win_warpptr(EDIT);
}