fix `select-list-get-selection' and avoid copying the list in `elements'
This commit is contained in:
		
							parent
							
								
									4e5a41db3d
								
							
						
					
					
						commit
						9b72181b54
					
				| 
						 | 
					@ -31,9 +31,7 @@
 | 
				
			||||||
		  (num-lines ,(select-list-num-lines r)))))
 | 
							  (num-lines ,(select-list-num-lines r)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (make-select-list elements num-lines)
 | 
					(define (make-select-list elements num-lines)
 | 
				
			||||||
  (if (and (proper-list? elements) (every element? elements))
 | 
					  (really-make-select-list elements 0 0 num-lines))
 | 
				
			||||||
      (really-make-select-list elements 0 0 num-lines)
 | 
					 | 
				
			||||||
      (error "wrong argument type" elements)))
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define key-m 109)
 | 
					(define key-m 109)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -102,17 +100,6 @@
 | 
				
			||||||
     (else
 | 
					     (else
 | 
				
			||||||
      (values (index-move cursor-index) view-index)))))
 | 
					      (values (index-move cursor-index) view-index)))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (copy-element-list elements)
 | 
					 | 
				
			||||||
  (fold-right
 | 
					 | 
				
			||||||
   (lambda (el result)
 | 
					 | 
				
			||||||
     (cons 
 | 
					 | 
				
			||||||
      (make-element (element-markable? el)
 | 
					 | 
				
			||||||
		    (element-marked? el)
 | 
					 | 
				
			||||||
		    (element-value el)
 | 
					 | 
				
			||||||
		    (element-text el))
 | 
					 | 
				
			||||||
      result))
 | 
					 | 
				
			||||||
   '() elements))
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
(define (move-cursor-maker index-move)
 | 
					(define (move-cursor-maker index-move)
 | 
				
			||||||
  (lambda (select-list)
 | 
					  (lambda (select-list)
 | 
				
			||||||
    (let* ((elements (select-list-elements select-list))
 | 
					    (let* ((elements (select-list-elements select-list))
 | 
				
			||||||
| 
						 | 
					@ -127,7 +114,7 @@
 | 
				
			||||||
			    num-lines))
 | 
								    num-lines))
 | 
				
			||||||
      (lambda (cursor-index view-index)
 | 
					      (lambda (cursor-index view-index)
 | 
				
			||||||
	(really-make-select-list
 | 
						(really-make-select-list
 | 
				
			||||||
	 (copy-element-list elements)
 | 
						 elements
 | 
				
			||||||
	 view-index
 | 
						 view-index
 | 
				
			||||||
	 cursor-index 
 | 
						 cursor-index 
 | 
				
			||||||
	 num-lines))))))
 | 
						 num-lines))))))
 | 
				
			||||||
| 
						 | 
					@ -177,8 +164,8 @@
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (select-list-get-selection select-list)
 | 
					(define (select-list-get-selection select-list)
 | 
				
			||||||
  (map element-value
 | 
					  (map element-value
 | 
				
			||||||
       (filter-map element-marked? 
 | 
					       (filter element-marked? 
 | 
				
			||||||
		   (select-list-elements select-list))))
 | 
						       (select-list-elements select-list))))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
(define (select-list-selected-entry select-list)
 | 
					(define (select-list-selected-entry select-list)
 | 
				
			||||||
  (element-value
 | 
					  (element-value
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue