Regex replace prompt: say that Enter searches skipped long lines
The note added for search-as-you-type told the regex replace prompt to use Left/Right, which only step through matches in the search prompts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_015rcVQiiWyTzoNrsvLSaAfB
This commit is contained in:
+8
-2
@@ -2450,7 +2450,10 @@ cmd_insert_text(CommandContext &ctx)
|
|||||||
search_apply_match_regex(ctx.editor, *buf, rmatches);
|
search_apply_match_regex(ctx.editor, *buf, rmatches);
|
||||||
if (skipped > 0 && err.empty())
|
if (skipped > 0 && err.empty())
|
||||||
ctx.editor.SetStatus(ctx.editor.Status() + " [" + std::to_string(skipped) +
|
ctx.editor.SetStatus(ctx.editor.Status() + " [" + std::to_string(skipped) +
|
||||||
" long line(s) skipped; Left/Right search all]");
|
" long line(s) skipped; " +
|
||||||
|
(ctx.editor.CurrentPromptKind() == Editor::PromptKind::RegexSearch
|
||||||
|
? "Left/Right search all]"
|
||||||
|
: "Enter searches all]"));
|
||||||
} else {
|
} else {
|
||||||
auto matches = search_compute_matches(*buf, ctx.editor.SearchQuery());
|
auto matches = search_compute_matches(*buf, ctx.editor.SearchQuery());
|
||||||
// Keep index stable unless out of range
|
// Keep index stable unless out of range
|
||||||
@@ -3614,7 +3617,10 @@ cmd_backspace(CommandContext &ctx)
|
|||||||
search_apply_match_regex(ctx.editor, *buf2, rm);
|
search_apply_match_regex(ctx.editor, *buf2, rm);
|
||||||
if (skipped > 0 && err.empty())
|
if (skipped > 0 && err.empty())
|
||||||
ctx.editor.SetStatus(ctx.editor.Status() + " [" + std::to_string(skipped) +
|
ctx.editor.SetStatus(ctx.editor.Status() + " [" + std::to_string(skipped) +
|
||||||
" long line(s) skipped; Left/Right search all]");
|
" long line(s) skipped; " +
|
||||||
|
(ctx.editor.CurrentPromptKind() == Editor::PromptKind::RegexSearch
|
||||||
|
? "Left/Right search all]"
|
||||||
|
: "Enter searches all]"));
|
||||||
} else {
|
} else {
|
||||||
auto matches = search_compute_matches(*buf2, ctx.editor.SearchQuery());
|
auto matches = search_compute_matches(*buf2, ctx.editor.SearchQuery());
|
||||||
search_apply_match(ctx.editor, *buf2, matches);
|
search_apply_match(ctx.editor, *buf2, matches);
|
||||||
|
|||||||
@@ -1291,6 +1291,12 @@ TEST(Audit_RegexSearch_LongLineFoundByNext)
|
|||||||
ASSERT_TRUE(h.Exec(CommandId::MoveRight));
|
ASSERT_TRUE(h.Exec(CommandId::MoveRight));
|
||||||
ASSERT_EQ(h.Buf().Cury(), (std::size_t) 1);
|
ASSERT_EQ(h.Buf().Cury(), (std::size_t) 1);
|
||||||
ASSERT_EQ(h.Buf().Curx(), (std::size_t) 25000);
|
ASSERT_EQ(h.Buf().Curx(), (std::size_t) 25000);
|
||||||
|
ASSERT_TRUE(h.Exec(CommandId::Refresh));
|
||||||
|
ASSERT_TRUE(!ed.PromptActive());
|
||||||
|
// The replace prompt has no next/previous; its Enter searches all lines.
|
||||||
|
ASSERT_TRUE(h.Exec(CommandId::RegexpReplace));
|
||||||
|
ASSERT_TRUE(h.Exec(CommandId::InsertText, "NEE+DLE"));
|
||||||
|
ASSERT_TRUE(ed.Status().find("Enter searches all") != std::string::npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user