unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#47603: comint sets '(rear-nonsticky t) on entire prompt, disabling 'cursor-intangible
@ 2021-04-05 18:07 JD Smith
  2021-04-13  2:49 ` Stefan Monnier
  0 siblings, 1 reply; 2+ messages in thread
From: JD Smith @ 2021-04-05 18:07 UTC (permalink / raw)
  To: 47603

[-- Attachment #1: Type: text/plain, Size: 927 bytes --]


Comint sets ‘(rear-nonsticky t) on the entire detected prompt text, which prevents `cursor-intangible from functioning correctly when applied to the prompt.  As Stefan put it:

I suspect the issue comes from the difference between `get-pos-property` and `get-char-property`: positions (like `point`) are not placed on a character but between two characters.  But text properties only apply to characters.  So the properties that are "on a position" are based on what properties would a character inherit if it where inserted at that position.

By default text properties are front-nonstick and rear-sticky, so basically a position gets its properties from the char right before it. But if you set (rear-nonsticky t), then you get no properties at all at that position.

This causes issues when "applying (rear-nonsticky t) a bit too generously, e.g. to all the chars in the prompt rather than only to the last one."

[-- Attachment #2: Type: text/html, Size: 2600 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#47603: comint sets '(rear-nonsticky t) on entire prompt, disabling 'cursor-intangible
  2021-04-05 18:07 bug#47603: comint sets '(rear-nonsticky t) on entire prompt, disabling 'cursor-intangible JD Smith
@ 2021-04-13  2:49 ` Stefan Monnier
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Monnier @ 2021-04-13  2:49 UTC (permalink / raw)
  To: JD Smith; +Cc: 47603-done

> Comint sets ‘(rear-nonsticky t) on the entire detected prompt text, which
> prevents `cursor-intangible from functioning correctly when applied to the
> prompt.  As Stefan put it:

I fixed it a while back but forgot the `font-lock-face` property in the
list of properties to add to `rear-nonstick` so I just added the
patch below to `master`.
I believe this should now do it.


        Stefan


diff --git a/lisp/comint.el b/lisp/comint.el
index 2745c5a26f..b90e6354d8 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -1797,6 +1797,9 @@ comint-add-to-input-history
 			(min size (- comint-input-ring-size size)))))
     (ring-insert comint-input-ring cmd)))
 
+(defconst comint--prompt-rear-nonsticky
+  '(field inhibit-line-move-field-capture read-only font-lock-face))
+
 (defun comint-send-input (&optional no-newline artificial)
   "Send input to process.
 After the process output mark, sends all text from the process mark to
@@ -1916,8 +1919,8 @@ comint-send-input
             (unless (or no-newline comint-use-prompt-regexp)
               ;; Cover the terminating newline
               (add-text-properties end (1+ end)
-                                   '(rear-nonsticky
-                                     (field inhibit-line-move-field-capture read-only)
+                                   `(rear-nonsticky
+                                     ,comint--prompt-rear-nonsticky
                                      field boundary
                                      inhibit-line-move-field-capture t)))))
 
@@ -2124,10 +2127,10 @@ comint-output-filter
 	    (unless comint-use-prompt-regexp
               (with-silent-modifications
                 (add-text-properties comint-last-output-start (point)
-                                     '(front-sticky
+                                     `(rear-nonsticky
+				       ,comint--prompt-rear-nonsticky
+				       front-sticky
 				       (field inhibit-line-move-field-capture)
-				       rear-nonsticky
-				       (field inhibit-line-move-field-capture read-only)
 				       field output
 				       inhibit-line-move-field-capture t))))
 
@@ -2157,8 +2160,8 @@ comint-output-filter
 					       'font-lock-face
 					       'comint-highlight-prompt)
 	      (add-text-properties prompt-start (point)
-	                           '(rear-nonsticky
-	                             (field inhibit-line-move-field-capture read-only))))
+	                           `(rear-nonsticky
+	                             ,comint--prompt-rear-nonsticky)))
 	    (goto-char saved-point)))))))
 
 (defun comint-preinput-scroll-to-bottom ()






^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-04-13  2:49 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-05 18:07 bug#47603: comint sets '(rear-nonsticky t) on entire prompt, disabling 'cursor-intangible JD Smith
2021-04-13  2:49 ` Stefan Monnier

unofficial mirror of bug-gnu-emacs@gnu.org 

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://yhetil.org/emacs-bugs/0 emacs-bugs/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 emacs-bugs emacs-bugs/ https://yhetil.org/emacs-bugs \
		bug-gnu-emacs@gnu.org
	public-inbox-index emacs-bugs

Example config snippet for mirrors.
Newsgroups are available over NNTP:
	nntp://news.yhetil.org/yhetil.emacs.bugs
	nntp://news.gmane.io/gmane.emacs.bugs


code repositories for project(s) associated with this inbox:

	https://git.savannah.gnu.org/cgit/emacs.git

AGPL code for this site: git clone http://ou63pmih66umazou.onion/public-inbox.git