diff options
| author | Tony Zorman | 2023-06-03 14:23:19 +0200 |
|---|---|---|
| committer | Jim Porter | 2023-06-15 09:40:12 -0700 |
| commit | f2aae8b879baa4986b69af7ee54fe4eb987b99d6 (patch) | |
| tree | 86a96b1f93059937fa570485f09395ed2da57d88 /lisp/eshell | |
| parent | 1acce3b5c7fdf0b2a7301db25dfc2a616df36744 (diff) | |
| download | emacs-f2aae8b879baa4986b69af7ee54fe4eb987b99d6.tar.gz emacs-f2aae8b879baa4986b69af7ee54fe4eb987b99d6.zip | |
eshell-next-prompt: More precisely navigate to the prompt (bug#63748)
* lisp/eshell/em-prompt.el (eshell-next-prompt): Navigate to the
current prompt more accurately by using text properties instead of
going to the beginning of the line. This is important for multiline
prompts, as they don't necessarily start at the beginning of the
current line.
* test/lisp/eshell/em-prompt-tests.el
(em-prompt-test--with-multiline):
Execute a given body with a multiline prompt.
(em-prompt-test/next-previous-prompt-with):
(em-prompt-test/forward-backward-matching-input-with):
Helper functions for code reuse.
(em-prompt-test/forward-backward-matching-input):
(em-prompt-test/next-previous-prompt):
Rewrite in terms of the appropriate helper functions.
(em-prompt-test/next-previous-prompt-multiline):
(em-prompt-test/forward-backward-matching-input-multiline):
Add multiline variants of existing tests.
Diffstat (limited to 'lisp/eshell')
| -rw-r--r-- | lisp/eshell/em-prompt.el | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lisp/eshell/em-prompt.el b/lisp/eshell/em-prompt.el index 9f9e58e83d7..42f8f273b52 100644 --- a/lisp/eshell/em-prompt.el +++ b/lisp/eshell/em-prompt.el | |||
| @@ -180,7 +180,8 @@ negative, find the Nth next match." | |||
| 180 | (text-property-search-forward 'field 'prompt t)) | 180 | (text-property-search-forward 'field 'prompt t)) |
| 181 | (setq n (1- n))) | 181 | (setq n (1- n))) |
| 182 | (let (match this-match) | 182 | (let (match this-match) |
| 183 | (forward-line 0) ; Don't count prompt on current line. | 183 | ;; Don't count the current prompt. |
| 184 | (text-property-search-backward 'field 'prompt t) | ||
| 184 | (while (and (< n 0) | 185 | (while (and (< n 0) |
| 185 | (setq this-match (text-property-search-backward | 186 | (setq this-match (text-property-search-backward |
| 186 | 'field 'prompt t))) | 187 | 'field 'prompt t))) |