unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#12017: term-mode: allow reflowable text
@ 2012-07-20 22:14 Michael Hoffman
  2013-06-13  5:27 ` Glenn Morris
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Hoffman @ 2012-07-20 22:14 UTC (permalink / raw)
  To: 12017

[-- Attachment #1: Type: text/plain, Size: 943 bytes --]

In term-mode, when the terminal process supplies more text than can fit 
on a line, term-emulate-terminal puts text into the buffer up to the 
current number of columns, inserts a hard newline, and starts again on 
the next line.

The included patch modifies term-emulate-terminal to just keep putting 
text into the buffer without these hard breaks. This allows one to 
resize the window later and text produced in this way will reflow 
dynamically, which is very convenient for most programs I run, avoiding 
new awkward soft line breaks when the window becomes smaller later.

Previously described on emacs-devel:
http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00252.html

2012-07-20  Michael Hoffman  <mmh1@uw.edu>

         * term.el (term-suppress-hard-newline): New customizable
         variable.
         (term-emulate-terminal): Don't add hard newlines when
         term-suppress-hard-newline is non-nil.

Michael Hoffman

[-- Attachment #2: term.diff --]
[-- Type: text/x-patch, Size: 1474 bytes --]

*** /net/gs/vol3/software/modules-sw/emacs/24.1/Linux/RHEL6/x86_64/share/emacs/24.1/lisp/term.el.gz
--- term.el	2012-07-20 14:59:24.835658472 -0700
***************
*** 561,566 ****
--- 561,573 ----
    :type 'boolean
    :group 'term)
  
+ (defcustom term-suppress-hard-newline nil
+   "Controls whether interpreter adds newlines where text exceeds a single line.
+ If non-nil, then don't add these newlines, so that text is automatically
+ reflowed when window is resized."
+   :type 'boolean
+   :group 'term)
+ 
  ;; Where gud-display-frame should put the debugging arrow.  This is
  ;; set by the marker-filter, which scans the debugger's output for
  ;; indications of the current pc.
***************
*** 2797,2804 ****
  			  (setq count (length decoded-substring))
  			  (setq temp (- (+ (term-horizontal-column) count)
  					term-width))
! 			  (cond ((<= temp 0)) ;; All count chars fit in line.
! 				((> count temp)	;; Some chars fit.
  				 ;; This iteration, handle only what fits.
  				 (setq count (- count temp))
  				 (setq count-bytes
--- 2804,2812 ----
  			  (setq count (length decoded-substring))
  			  (setq temp (- (+ (term-horizontal-column) count)
  					term-width))
! 			  (cond ((or term-suppress-hard-newline (<= temp 0)))
!                                 ;; All count chars fit in line.
! 				((> count temp) ;; Some chars fit.
  				 ;; This iteration, handle only what fits.
  				 (setq count (- count temp))
  				 (setq count-bytes

^ permalink raw reply	[flat|nested] 2+ messages in thread

* bug#12017: term-mode: allow reflowable text
  2012-07-20 22:14 bug#12017: term-mode: allow reflowable text Michael Hoffman
@ 2013-06-13  5:27 ` Glenn Morris
  0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2013-06-13  5:27 UTC (permalink / raw)
  To: 12017-done

Version: 24.4

Thanks; applied.





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-06-13  5:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-20 22:14 bug#12017: term-mode: allow reflowable text Michael Hoffman
2013-06-13  5:27 ` Glenn Morris

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).