bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9664: (format #t "~3tX") fails in the REPL


From: Ian Price
Subject: bug#9664: (format #t "~3tX") fails in the REPL
Date: Tue, 04 Oct 2011 11:59:11 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux)

When an expression is evaluated, the port-column is not 0. You can see
this by typing (write (port-column (current-output-port))) at the
repl. This means that when you do ~3t, it will not generate any spaces
as it is already past column 3.

This can be fixed by resetting port-position before we evaluate the REPL
expression.

-- 
Ian Price

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"
>From 7a457be8c43051817b18d425a76b296f0f1fc730 Mon Sep 17 00:00:00 2001
From: Ian Price <address@hidden>
Date: Tue, 4 Oct 2011 00:30:39 +0100
Subject: [PATCH] Reset port column before evaluating at REPL.

* module/system/repl/repl.scm (run-repl): Column-dependant commands
  like the '~t' directive to format behave unexpectedly if column
  number isn't reset.
---
 module/system/repl/repl.scm |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/module/system/repl/repl.scm b/module/system/repl/repl.scm
index 1cffa71..d028f38 100644
--- a/module/system/repl/repl.scm
+++ b/module/system/repl/repl.scm
@@ -190,6 +190,7 @@
                                (run-hook before-eval-hook exp)
                                (call-with-error-handling
                                 (lambda ()
+                                  (set-port-column! (current-output-port) 0)
                                   (with-stack-and-prompt thunk))
                                 #:on-error (repl-option-ref repl 'on-error)))
                              (lambda (k) (values))))
-- 
1.7.6.4


reply via email to

[Prev in Thread] Current Thread [Next in Thread]