[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/coterm 9d532fb 22/80: Refactor some more
From: |
ELPA Syncer |
Subject: |
[elpa] externals/coterm 9d532fb 22/80: Refactor some more |
Date: |
Wed, 13 Oct 2021 18:57:29 -0400 (EDT) |
branch: externals/coterm
commit 9d532fb28056687254cdb53fe353006a96daf5d0
Author: m <>
Commit: m <>
Refactor some more
---
coterm.el | 43 ++++++++++++++++++++++++++++++-------------
1 file changed, 30 insertions(+), 13 deletions(-)
diff --git a/coterm.el b/coterm.el
index d2329a0..92694d2 100644
--- a/coterm.el
+++ b/coterm.el
@@ -103,24 +103,41 @@ which case `point-max' is assumed"
(setq row row2 col col2
h (- row1 row2)))
(delete-region p1 p2)
- (coterm--t-open-space proc-filt process row col h (abs (- col2 col1)))
+ (coterm--t-open-space-at-point
+ proc-filt process
+ h (cond ((> row2 row1) col2)
+ ((< row2 row1) col1)
+ (t (abs (- col2 col1)))))
(setq coterm--t-pmark-in-sync nil))))
+(defun coterm--t-open-space-at-point (proc-filt process newlines spaces)
+ "Insert NEWLINES newlines and SPECES spaces at point.
+Insert them using PROC-FILT and PROCESS. Afterwards, remove
+characters that were moved after the column specified by
+`coterm--t-width'."
+ (unless (eobp)
+ (set-marker (process-mark process) (point))
+ (funcall
+ proc-filt process
+ (concat (make-string newlines ?\n)
+ (unless (eolp)
+ (make-string spaces ?\s))))
+ ;; Delete chars that are after the width of the terminal
+ (goto-char (process-mark process))
+ (move-to-column coterm--t-width)
+ (delete-region (point) (progn (forward-line 1) (1- (point))))
+ (setq coterm--t-pmark-in-sync nil)))
+
(defun coterm--t-open-space (proc-filt process row col height width)
+ "Open spce at position ROW and COL, preserving point.
+Use PROC-FILT and PROCESS to insert spaces and newlines.
+Whitespace is inserted such that the character at position ROW
+and COL is moved by HEIGHT rows down and WIDTH cols to the
+right."
(save-excursion
(coterm--t-goto row col)
- (unless (eobp)
- (set-marker (process-mark process) (point))
- (funcall
- proc-filt process
- (concat (make-string height ?\n)
- (unless (eolp)
- (make-string (+ width (if (= height 0) 0 col)) ?\s))))
- ;; Delete chars that are after the width of the terminal
- (goto-char (process-mark process))
- (move-to-column coterm--t-width)
- (delete-region (point) (progn (forward-line 1) (1- (point))))
- (setq coterm--t-pmark-in-sync nil))))
+ (coterm--t-open-space-at-point proc-filt process height
+ (+ width (if (= height 0) 0 col)))))
(defun coterm--t-normalize-home-offset ()
(save-excursion
- [elpa] externals/coterm 586ce4e 20/80: Delete off-screen rows when scrolling up, (continued)
- [elpa] externals/coterm 586ce4e 20/80: Delete off-screen rows when scrolling up, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 7b1e001 01/80: Initial commit, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm a983b5e 02/80: New function for approximately moving pmark, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 0647615 04/80: Plug marker leak, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 044b03e 06/80: Simplify, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm c48515c 11/80: Support \e[4h and \e[4l for insert mode, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm ab1dcd4 14/80: Fix typo, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm ba651c6 15/80: Fix negative and too high column positions, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 2403460 16/80: Make all coterm-t-* variables private, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 753fba8 21/80: Refactor line deletion and insertion, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 9d532fb 22/80: Refactor some more,
ELPA Syncer <=
- [elpa] externals/coterm e21bb54 18/80: Major refactor and started scroll region, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 4a23ae2 23/80: Further refactor some more, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 08cf379 19/80: Minor fixes, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 9e7720b 37/80: Use save-excursion more sparingly, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 4943e16 41/80: Footer and header, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm d6912da 42/80: Support sequences \eE[E, F and G (pacman uses them), ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 71d2dc1 30/80: Implement user-facing variables and minor mode, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm dfebb62 46/80: Add comint output filter function buffer locally, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm bd103f9 56/80: [auto-char] Fix searching in less, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm d5042f6 65/80: Inhibit Emacs from automatically decoding \r\n into \n, ELPA Syncer, 2021/10/13