bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#18282: 24.3.93; Tab completion in gud-gdb at the start of a line ove


From: Stefan Monnier
Subject: bug#18282: 24.3.93; Tab completion in gud-gdb at the start of a line overwrites the prompt.
Date: Tue, 02 Sep 2014 14:17:10 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

>> 1. emacs -Q
>> 2. M-: (gud-gdb "gdb")
>> 3. Type the following at the gdb prompt "hel<TAB><RET>"
>> 
>> What happens is the command "help" is correctly completed, but the
>> prompt "(gdb)" is overwritten.

I installed the patch below which seems to fix it for now.


        Stefan


=== modified file 'lisp/progmodes/gud.el'
--- lisp/progmodes/gud.el       2014-02-10 01:34:22 +0000
+++ lisp/progmodes/gud.el       2014-09-02 18:14:45 +0000
@@ -809,18 +809,6 @@
                                           (current-buffer)
                                           ;; From string-match above.
                                           (length context))))
-    ;; `gud-gdb-run-command-fetch-lines' has some nasty side-effects on the
-    ;; buffer (via `gud-delete-prompt-marker'): it removes the prompt and then
-    ;; re-adds it later, thus messing up markers and overlays along the way.
-    ;; This is a problem for completion-in-region which uses an overlay to
-    ;; create a field.
-    ;; So we restore completion-in-region's field if needed.
-    ;; FIXME: change gud-gdb-run-command-fetch-lines so it doesn't modify the
-    ;; buffer at all.
-    (when (/= start (- (point) (field-beginning)))
-      (dolist (ol (overlays-at (1- (point))))
-        (when (eq (overlay-get ol 'field) 'completion)
-          (move-overlay ol (- (point) start) (overlay-end ol)))))
     ;; Protect against old versions of GDB.
     (and complete-list
         (string-match "^Undefined command: \"complete\"" (car complete-list))
@@ -859,7 +847,14 @@
          (save-excursion
            (skip-chars-backward "^ " (comint-line-beginning-position))
            (point))))
-    (list start end
+    ;; FIXME: `gud-gdb-run-command-fetch-lines' has some nasty side-effects on
+    ;; the buffer (via `gud-delete-prompt-marker'): it removes the prompt and
+    ;; then re-adds it later, thus messing up markers and overlays along the
+    ;; way (bug#18282).
+    ;; We use an "insert-before" marker for `start', since it's typically right
+    ;; after the prompt, which works around the problem, but is a hack (and
+    ;; comes with other downsides, e.g. if completion adds text at `start').
+    (list (copy-marker start t) end
           (completion-table-dynamic
            (apply-partially gud-gdb-completion-function
                             (buffer-substring (comint-line-beginning-position)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]