Fix painting of completions window, remove loop parameter

part of darcs patch Fri Sep 23 22:15:31 EEST 2005  Martin Gasbichler <gasbichl@informatik.uni-tuebingen.de>
This commit is contained in:
eknauel 2005-09-27 16:37:12 +00:00
parent de78de0050
commit 96973d961c
1 changed files with 28 additions and 40 deletions

View File

@ -404,10 +404,9 @@
(release-lock paint-lock)
(lp (cml-receive statistics-channel))))))
;;Loop
(paint)
(let loop ((ch (wait-for-input)) (c-x-pressed? #f)
(completion-selector #f))
(let loop ((ch (wait-for-input))
(c-x-pressed? #f))
(cond
(maybe-modal-window
@ -418,75 +417,69 @@
(when (current-history-item)
(paint-result-window (entry-data (current-history-item)))
(refresh-result-window))))
(loop (wait-for-input) c-x-pressed? completion-selector))
(loop (wait-for-input) c-x-pressed?))
;; Ctrl-x -> wait for next input
((= ch key-control-x)
(loop (wait-for-input) #t completion-selector))
(loop (wait-for-input) #t))
;; tab pressed twice, select completion using select-list
((and (focus-on-command-buffer?)
completion-selector
(= ch key-tab))
(focus-result-buffer!)
(loop (wait-for-input) #f completion-selector))
;; tab is pressed in the first place, offer completions
;; tab is pressed, offer completions
((and (focus-on-command-buffer?)
(command-buffer-in-command-mode?)
(= ch key-tab))
(offer-completions (last (buffer-text (command-buffer))))
(loop (wait-for-input) #f #f))
(loop (wait-for-input) #f))
((and (focus-on-command-buffer?)
(command-buffer-in-command-mode?)
c-x-pressed?
(= ch (config 'main 'switch-command-buffer-mode-key)))
(toggle-command/scheme-mode-with-conversion)
(loop (wait-for-input) #f #f))
(loop (wait-for-input) #f))
((= ch (config 'main 'switch-command-buffer-mode-key))
(toggle-command/scheme-mode)
(loop (wait-for-input) #f #f))
(loop (wait-for-input) #f))
((= ch key-end)
(show-shell-screen)
(paint)
(loop (wait-for-input) #f #f))
(loop (wait-for-input) #f))
;; C-x o --- toggle buffer focus
((and c-x-pressed? (= ch key-o))
(toggle-buffer-focus)
(loop (wait-for-input) #f #f))
(loop (wait-for-input) #f))
;; C-x p --- insert selection
((and c-x-pressed? (current-history-item)
(= ch 112))
(paste-selection/refresh (current-viewer))
(loop (wait-for-input) #f #f))
(loop (wait-for-input) #f))
;; C-x P --- insert focus object(s)
((and c-x-pressed? (current-history-item)
(= ch 80))
(paste-focus-object/refresh (current-viewer))
(loop (wait-for-input) #f #f))
(loop (wait-for-input) #f))
((and c-x-pressed? (focus-on-result-buffer?))
(update-current-viewer!
(send (current-viewer)
'key-press ch key-control-x))
(loop (wait-for-input) #f #f))
(loop (wait-for-input) #f))
;; C-x r --- redo
((and c-x-pressed? (focus-on-command-buffer?)
(= ch 114))
(debug-message "Eric should re-implement redo..."))
(debug-message "Eric should re-implement redo...")
(loop (wait-for-input) #f))
((= ch key-f1)
(endwin))
((= ch key-f2)
(paint)
(loop (wait-for-input) c-x-pressed? #f))
(loop (wait-for-input) c-x-pressed?))
;; forward in result history
((= ch key-npage)
@ -498,7 +491,7 @@
(paint-result-window (entry-data (current-history-item))))
(refresh-result-window)
(release-lock paint-lock)
(loop (wait-for-input) c-x-pressed? #f))
(loop (wait-for-input) c-x-pressed?))
;; back in result history
((= ch key-ppage)
@ -510,7 +503,7 @@
(paint-result-window (entry-data (current-history-item))))
(refresh-result-window)
(release-lock paint-lock)
(loop (wait-for-input) c-x-pressed? #f))
(loop (wait-for-input) c-x-pressed?))
((and (focus-on-command-buffer?) (= ch 10))
(input (command-buffer) ch)
@ -522,7 +515,7 @@
(refresh-command-window)
(release-lock paint-lock)
(handle-return-key)
(loop (wait-for-input) c-x-pressed? #f))
(loop (wait-for-input) c-x-pressed?))
(else
(cond
@ -536,7 +529,7 @@
(move-cursor (command-buffer) (result-buffer))
(refresh-result-window)
(release-lock paint-lock))
(loop (wait-for-input) #f #f))
(loop (wait-for-input) #f))
(else
(input (command-buffer) ch)
(obtain-lock paint-lock)
@ -546,7 +539,7 @@
(move-cursor (command-buffer) (result-buffer))
(refresh-command-window)
(release-lock paint-lock)
(loop (wait-for-input) c-x-pressed? #f)))))))
(loop (wait-for-input) c-x-pressed?)))))))
(define (paint-bar-1)
(mvwaddstr (app-window-curses-win (bar-1)) 0 1 "Commander S")
@ -799,16 +792,6 @@
(move-cursor (command-buffer) (result-buffer))
(refresh-command-window))
(define (paint-completion-select-list win width select-list command)
(wclear win)
(wattron win (A-BOLD))
(mvwaddstr win 0 0
(string-append "Possible completions for " command))
(wattrset win (A-NORMAL))
(paint-selection-list-at select-list 0 2
win width #t)
(wrefresh win))
(define (current-cursor-index)
;; #### No, I will not comment on this.
(- (buffer-pos-col (command-buffer)) 2))
@ -868,11 +851,16 @@
0
(+ 1 (quotient (- inner-width header-length) 2))
header-line)
(paint-completion-select-list dialog-win inner-width select-list command)
(paint-selection-list-at select-list 1 1
dialog-win inner-width #t)
(wrefresh dialog-win))
(paint)
(lambda (key)
(cond
((= key 27)
(delete-app-window! dialog)
(close-modal-window!)
#t)
((= key 10)
(let ((completion
(select-list-selected-entry select-list)))