Up Next:
* Tag line count should account for wrapped lines
-* Indent/Unindent on first line of buffer causes infinite loop
* block selection should handle brace-balancing
* context sensitive selection of words, commands, line numbers, or filenames.
* ctrl+f should move the pointer to the match
view->selection.end = buf_eol(buf, view->selection.end);
unsigned off = buf_bol(buf, view->selection.end);
if (num_selected(view->selection) == 0) return;
- while (off >= view->selection.beg) {
+
+ do {
if (dir == RIGHT) {
buf_insert(buf, true, off, '\t');
view->selection.end += indoff;
}
}
off = buf_byline(buf, off, UP);
- }
+
+ } while (off && off >= view->selection.beg);
}
CHECK(getsel(EDIT)->end == 0);
}
- //TEST(ctrl+[ should do nothing on empty buffer) {
- // setup_view(EDIT, "a", CRLF, 0);
- // send_keys(ModCtrl, '[');
- // CHECK(getsel(EDIT)->beg == 0);
- // CHECK(getsel(EDIT)->end == 0);
- //}
+ TEST(ctrl+[ should do nothing at beginning of buffer) {
+ setup_view(EDIT, "a", CRLF, 0);
+ send_keys(ModCtrl, '[');
+ CHECK(getsel(EDIT)->beg == 0);
+ CHECK(getsel(EDIT)->end == 1);
+ }
TEST(ctrl+] should do nothing on empty buffer) {
setup_view(EDIT, "", CRLF, 0);
CHECK(getsel(EDIT)->end == 0);
}
- //TEST(ctrl+] should indent the current line) {
- // setup_view(EDIT, "a", CRLF, 0);
- // send_keys(ModCtrl, ']');
- // CHECK(getsel(EDIT)->beg == 0);
- // CHECK(getsel(EDIT)->end == 0);
- //}
+ TEST(ctrl+] should indent the first line) {
+ setup_view(EDIT, "a", CRLF, 0);
+ send_keys(ModCtrl, ']');
+ CHECK(getsel(EDIT)->beg == 0);
+ CHECK(getsel(EDIT)->end == 5);
+ CHECK(verify_text(EDIT, " a"));
+ }
/* Key Handling - Special
*************************************************************************/