Region and paragraph commands: indent, reflow, counted deletes

- Indent-region skips empty lines. With the whole buffer selected, the
  empty row after the final newline became a tab-only last line.
- Reflow no longer wraps before a line's first word: a first word longer
  than the width (a URL) got a prefix-only line before it, a blank line
  or a bullet marker split from its text, and another on every reflow.
- A whitespace-only line (spaces, tabs, a CR) separates paragraphs for
  reflow; such paragraphs were merged.
- Reflow of CRLF lines strips the CR before wrapping and restores it on
  every output line; the CRs ended up in the middle of joined lines.
- A counted backspace or delete-char is one undo step even when it joins
  lines.
- The C++ highlighter stops looking for a raw-string '(' after 16
  delimiter characters; scanning the whole line at every R" was
  quadratic.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
Claude
2026-09-24 09:16:04 -07:00
committed by Kyle Isom
parent b9f91b0ed2
commit 790fbc90e1
4 changed files with 152 additions and 16 deletions
+5 -2
View File
@@ -163,11 +163,14 @@ CppHighlighter::HighlightLineStateful(const Buffer &buf,
if (c == 'R' && i + 1 < n && s[i + 1] == '"') {
int k = i + 2;
std::string delim;
while (k < n && s[k] != '(') {
// A raw-string delimiter is at most 16 characters (and has no
// spaces, backslashes or parentheses); scanning the rest of the
// line for '(' at every R" made long lines quadratic.
while (k < n && s[k] != '(' && delim.size() <= 16) {
delim.push_back(s[k]);
++k;
}
if (k < n && s[k] == '(') {
if (k < n && s[k] == '(' && delim.size() <= 16) {
int body_start = k + 1;
std::string needle = ")" + delim + "\"";
auto pos = s.find(needle, static_cast<std::size_t>(body_start));