From 93ee18ce4777b88b007a704d58d45e75b287938f Mon Sep 17 00:00:00 2001 From: eknauel Date: Tue, 27 Sep 2005 08:59:55 +0000 Subject: [PATCH] Try to get result window size stuff right part of darcs patch Sun Sep 18 14:32:07 EEST 2005 Eric Knauel --- scheme/browse-directory-list.scm | 3 ++- scheme/job-viewer.scm | 4 ++-- scheme/job.scm | 4 ++-- scheme/process.scm | 1 + scheme/std-command.scm | 22 ++++++++++++++++++++++ scheme/win.scm | 10 ++++++++-- 6 files changed, 37 insertions(+), 7 deletions(-) diff --git a/scheme/browse-directory-list.scm b/scheme/browse-directory-list.scm index 164c63c..546185f 100644 --- a/scheme/browse-directory-list.scm +++ b/scheme/browse-directory-list.scm @@ -164,7 +164,8 @@ (select-list (make-file-select-list fs-objects working-dir - (- (result-buffer-num-lines buffer) 2) + ;; we need one line for the header + (- (result-buffer-num-lines buffer) 1) (result-buffer-num-cols buffer)))) (define (handle-return-key self selected-entry num-lines) diff --git a/scheme/job-viewer.scm b/scheme/job-viewer.scm index 384bd70..92a8427 100644 --- a/scheme/job-viewer.scm +++ b/scheme/job-viewer.scm @@ -70,7 +70,7 @@ (make-unmarked-element job #t (format-job job num-cols))) jobs) - (- (result-buffer-num-lines buffer) 1)))) + (- (result-buffer-num-lines buffer) 2)))) (define get-selection-as-ref (make-get-selection-as-ref-method select-list)) @@ -216,7 +216,7 @@ ,@(if (job-with-console? job) `((,console-viewer "" "")) '()))) - (- (result-buffer-num-lines buffer) 1))) + (- (result-buffer-num-lines buffer) 3))) (define (handle-key-press self key control-x-pressed?) (cond diff --git a/scheme/job.scm b/scheme/job.scm index 1169b10..58a3d88 100644 --- a/scheme/job.scm +++ b/scheme/job.scm @@ -304,8 +304,8 @@ (make-job-with-console s-expr proc pty-in pty-out (make-terminal-buffer - (- (result-buffer-num-cols (result-buffer)) 1) - (- (result-buffer-num-lines (result-buffer)) 1)))))) + (result-buffer-num-cols (result-buffer)) + (result-buffer-num-lines (result-buffer))))))) ;; for use in Scheme mode (define-syntax run/console diff --git a/scheme/process.scm b/scheme/process.scm index 77a5e65..653d3a8 100644 --- a/scheme/process.scm +++ b/scheme/process.scm @@ -57,6 +57,7 @@ (select-list (make-process-selection-list (result-buffer-num-cols buffer) + ;; we need one line for the header (- (result-buffer-num-lines buffer) 1) processes)) (header (make-header-line (result-buffer-num-cols buffer)))) diff --git a/scheme/std-command.scm b/scheme/std-command.scm index 461251f..067b605 100644 --- a/scheme/std-command.scm +++ b/scheme/std-command.scm @@ -302,3 +302,25 @@ (completions-for cs (or (to-complete-prefix to-complete) "")))) just-run-in-foreground)) +(define (make-debug-plugin val buffer) + (lambda (message) + (case message + ((paint) + (lambda (self win buffer have-focus?) + (let ((cols (+ 0 (result-buffer-num-cols buffer))) + (lines (+ 0 (result-buffer-num-lines buffer)))) + (wmove win 0 0) + (waddstr win "A") + (wmove win 0 cols) + (waddstr win "B") + (wmove win lines cols) + (waddstr win "C") + (wmove win lines 0) + (waddstr win "D") + (wrefresh win)))) + (else + (lambda (self . more) + self))))) + +(register-plugin! + (make-view-plugin make-debug-plugin (lambda (v) (eq? v 'debug)))) diff --git a/scheme/win.scm b/scheme/win.scm index 330d48d..247d472 100644 --- a/scheme/win.scm +++ b/scheme/win.scm @@ -86,23 +86,29 @@ (make-app-window 1 1 (- (COLS) 2) 2 #f)) + (debug-message '*bar-1* *bar-1*) (set! *active-command-window* (make-app-window 1 (+ (round (/ (LINES) 3)) 2) (- (COLS) 2) 3 #f)) + (debug-message '*active-command-window* *active-command-window*) (set! *command-frame-window* (make-app-window 1 2 (- (COLS) 2) (- (app-window-y (active-command-window)) 2) #f)) + (debug-message '*command-frame-window* *command-frame-window*) (set! *command-window* (make-inlying-app-window (command-frame-window))) + (debug-message '*command-window* *command-window*) (set! *result-frame-window* (make-app-window 1 (+ (app-window-y (active-command-window)) 3) (- (COLS) 2) (- (- (LINES) 6) (app-window-height (command-frame-window))) #f)) + (debug-message '*result-frame-window* *result-frame-window*) (set! *result-window* (make-inlying-app-window (result-frame-window))) + (debug-message '*result-window* *result-window*) (let ((all-windows (list (bar-1) (active-command-window) @@ -113,9 +119,9 @@ (set-result-buffer-num-lines! *result-buffer* (- (app-window-height (result-window)) 2)) (set-result-buffer-num-cols! - *result-buffer* (- (app-window-width (result-window)) 3)) + *result-buffer* (- (app-window-width (result-window)) 1)) - (for-each wclear + (for-each wclear (map app-window-curses-win all-windows)))) ;; result-buffer-object-change-channel