Use sunterlib's INSPECT-EXCEPTION package for debugging. Fix a crash
when switching from result buffer to command buffer.
This commit is contained in:
		
							parent
							
								
									03ffcf8280
								
							
						
					
					
						commit
						0a2c373bc0
					
				| 
						 | 
				
			
			@ -211,7 +211,19 @@
 | 
			
		|||
      
 | 
			
		||||
;;start the whole thing
 | 
			
		||||
(define (nuit)
 | 
			
		||||
  (run))
 | 
			
		||||
  (with-inspecting-handler
 | 
			
		||||
   8888
 | 
			
		||||
   (lambda (condition)
 | 
			
		||||
     (with-current-output-port*
 | 
			
		||||
      (error-output-port)
 | 
			
		||||
      (lambda ()
 | 
			
		||||
	(display "starting remote handler for condition") 
 | 
			
		||||
	(display condition)
 | 
			
		||||
	(newline)
 | 
			
		||||
	(display "Please connect to port 8888")
 | 
			
		||||
	(newline)
 | 
			
		||||
	#t)))
 | 
			
		||||
   run))
 | 
			
		||||
 | 
			
		||||
;;handle input
 | 
			
		||||
(define (run)
 | 
			
		||||
| 
						 | 
				
			
			@ -273,7 +285,6 @@
 | 
			
		|||
	   
 | 
			
		||||
	   ;;Ctrl-x o ->switch buffer
 | 
			
		||||
	   ((= ch 111)
 | 
			
		||||
	    (begin
 | 
			
		||||
	    (if (focus-on-command-buffer?)
 | 
			
		||||
		(let ((key-message 
 | 
			
		||||
		       (make-key-pressed-message active-command
 | 
			
		||||
| 
						 | 
				
			
			@ -287,7 +298,7 @@
 | 
			
		|||
		  (paint-command-window-contents)
 | 
			
		||||
		  (move-cursor command-buffer)))
 | 
			
		||||
	    (set! c-x-pressed #f)
 | 
			
		||||
	      (loop (wait-for-input))))
 | 
			
		||||
	    (loop (wait-for-input)))
 | 
			
		||||
 | 
			
		||||
	   ;;C-x r -> redo
 | 
			
		||||
	   ((= ch 114)
 | 
			
		||||
| 
						 | 
				
			
			@ -435,9 +446,7 @@
 | 
			
		|||
  (paint-command-window)
 | 
			
		||||
  (paint-command-window-contents)
 | 
			
		||||
  (paint-result-window)
 | 
			
		||||
  
 | 
			
		||||
  (set! command-buffer 
 | 
			
		||||
	(move-cursor command-buffer)))
 | 
			
		||||
  (move-cursor command-buffer))
 | 
			
		||||
 | 
			
		||||
(define (wait-for-input)
 | 
			
		||||
  (noecho)
 | 
			
		||||
| 
						 | 
				
			
			@ -633,7 +642,7 @@
 | 
			
		|||
  (lambda (string)
 | 
			
		||||
    (let loop ((str string))
 | 
			
		||||
      (if (equal? str "")
 | 
			
		||||
	  values
 | 
			
		||||
	  (values)
 | 
			
		||||
	  (let ((first-ch (string-ref str 0)))
 | 
			
		||||
	    (begin
 | 
			
		||||
	      (add-to-command-buffer (char->ascii first-ch))
 | 
			
		||||
| 
						 | 
				
			
			@ -656,7 +665,7 @@
 | 
			
		|||
(define print-active-command-win
 | 
			
		||||
  (lambda (win width)
 | 
			
		||||
    (if (<= width 25)
 | 
			
		||||
	values
 | 
			
		||||
	(values)
 | 
			
		||||
	(let ((active-command (string-append active-command 
 | 
			
		||||
					     active-parameters)))
 | 
			
		||||
	(if (> (string-length active-command) (- width 25))
 | 
			
		||||
| 
						 | 
				
			
			@ -698,7 +707,7 @@
 | 
			
		|||
    (let ((lines (get-right-result-lines)))
 | 
			
		||||
      (let loop ((pos 1))
 | 
			
		||||
	(if (> pos result-lines)
 | 
			
		||||
	    values
 | 
			
		||||
	    (values)
 | 
			
		||||
	    (let ((line (list-ref lines (- pos 1))))
 | 
			
		||||
	      (begin
 | 
			
		||||
		(if (not (standard-result-obj? current-result-object))
 | 
			
		||||
| 
						 | 
				
			
			@ -934,7 +943,7 @@
 | 
			
		|||
     ((key-pressed-message? message)
 | 
			
		||||
      (key-pressed-message-result-model message))
 | 
			
		||||
     ((restore-message? message)
 | 
			
		||||
      values)
 | 
			
		||||
      (values))
 | 
			
		||||
     ((selection-message? message)
 | 
			
		||||
      ""))))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -991,7 +1000,7 @@
 | 
			
		|||
     ((key-pressed-message? message)
 | 
			
		||||
      (key-pressed-message-result-model message))
 | 
			
		||||
     ((restore-message? message)
 | 
			
		||||
      values)
 | 
			
		||||
      (values))
 | 
			
		||||
     ((selection-message? message)
 | 
			
		||||
      ""))))
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -10,6 +10,7 @@
 | 
			
		|||
	handle
 | 
			
		||||
	ncurses
 | 
			
		||||
	srfi-6
 | 
			
		||||
	inspect-exception
 | 
			
		||||
	rt-modules)
 | 
			
		||||
  (files nuit-engine
 | 
			
		||||
	 handle-fatal-error
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue