changeset 54290:fbd1a5a744ac

(gdb-assembler-mode): Create a second overlay arrow for the assembler buffer. (gdb-assembler-custom): Position the overlay arrow. (gdb-put-arrow, gdb-remove-arrow): Delete functions.
author Nick Roberts <nickrob@snap.net.nz>
date Sat, 06 Mar 2004 00:00:21 +0000
parents 5acba3a0b094
children bf240c02022c b1f57ac99be5
files lisp/gdb-ui.el
diffstat 1 files changed, 11 insertions(+), 31 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/gdb-ui.el	Fri Mar 05 23:59:08 2004 +0000
+++ b/lisp/gdb-ui.el	Sat Mar 06 00:00:21 2004 +0000
@@ -1807,32 +1807,6 @@
 			    left-margin-width
 			    right-margin-width))))
 
-(defun gdb-put-arrow (putstring pos)
-  "Put arrow string PUTSTRING in the left margin in front of POS
-in the current buffer.  PUTSTRING is displayed by putting an
-overlay into the current buffer with a `before-string'
-\"gdb-arrow\" that has a `display' property whose value is
-PUTSTRING. POS may be an integer or marker."
-  (let ((gdb-string "gdb-arrow")
-	(buffer (current-buffer)))
-    (let ((overlay (make-overlay pos pos buffer))
-	  (prop (list (list 'margin 'left-margin) putstring)))
-      (put-text-property 0 (length gdb-string) 'display prop gdb-string)
-      (overlay-put overlay 'put-arrow t)
-      (overlay-put overlay 'before-string gdb-string))))
-
-(defun gdb-remove-arrow (&optional buffer)
-  "Remove arrow in BUFFER.
-Remove only images that were put in BUFFER with calls to `put-arrow'.
-BUFFER nil or omitted means use the current buffer."
-  (unless buffer
-    (setq buffer (current-buffer)))
-  (let ((overlays (overlays-in (point-min) (point-max))))
-    (while overlays
-      (let ((overlay (car overlays)))
-	(when (overlay-get overlay 'put-arrow)
-	  (delete-overlay overlay)))
-      (setq overlays (cdr overlays)))))
 
 ;;
 ;; Assembler buffer.
@@ -1849,16 +1823,20 @@
 
 (defun gdb-assembler-custom ()
   (let ((buffer (gdb-get-buffer 'gdb-assembler-buffer))
-	(gdb-arrow-position 1) (address) (flag))
+	(pos 1) (address) (flag))
     (with-current-buffer buffer
       (if (not (equal gdb-current-address "main"))
 	  (progn
-	    (gdb-remove-arrow)
 	    (goto-char (point-min))
 	    (if (re-search-forward gdb-current-address nil t)
 		(progn
-		  (setq gdb-arrow-position (point))
-		  (gdb-put-arrow "=>" (point))))))
+		  (setq pos (point))
+		  (setq gdb-overlay-arrow-string "=>")
+		  (beginning-of-line)
+		  (or gdb-overlay-arrow-position
+		      (setq gdb-overlay-arrow-position (make-marker)))
+		  (set-marker gdb-overlay-arrow-position
+			      (point) (current-buffer))))))
       ;; remove all breakpoint-icons in assembler buffer before updating.
       (gdb-remove-breakpoint-icons (point-min) (point-max)))
     (with-current-buffer (gdb-get-buffer 'gdb-breakpoints-buffer)
@@ -1879,7 +1857,7 @@
 		  (if (re-search-forward address nil t)
 		      (gdb-put-breakpoint-icon (eq flag ?y))))))))
     (if (not (equal gdb-current-address "main"))
-	(set-window-point (get-buffer-window buffer) gdb-arrow-position))))
+	(set-window-point (get-buffer-window buffer) pos))))
 
 (defvar gdb-assembler-mode-map
   (let ((map (make-sparse-keymap)))
@@ -1892,6 +1870,8 @@
 \\{gdb-assembler-mode-map}"
   (setq major-mode 'gdb-assembler-mode)
   (setq mode-name "Machine")
+  (push 'gdb-overlay-arrow-position overlay-arrow-variable-list)
+  (setq gdb-overlay-arrow-position nil)
   (setq fringes-outside-margins t)
   (setq buffer-read-only t)
   (use-local-map gdb-assembler-mode-map)