[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/coterm a983b5e 02/80: New function for approximately mo
From: |
ELPA Syncer |
Subject: |
[elpa] externals/coterm a983b5e 02/80: New function for approximately moving pmark |
Date: |
Wed, 13 Oct 2021 18:57:24 -0400 (EDT) |
branch: externals/coterm
commit a983b5efc47aea3e9df05781157c481640091162
Author: m <>
Commit: m <>
New function for approximately moving pmark
---
coterm.el | 45 +++++++++++++++++++++++----------------------
1 file changed, 23 insertions(+), 22 deletions(-)
diff --git a/coterm.el b/coterm.el
index ad14a30..3437776 100644
--- a/coterm.el
+++ b/coterm.el
@@ -114,6 +114,25 @@ non-whitespace text."
(setq coterm--t-pmark-in-sync t)
(coterm--t-normalize-home-offset)))
+;; Moves pmark
+(defun coterm--t-approximate-pmark (pmark)
+ "Sets PMARK to point close to `coterm--t-row' and col.
+Don't modify buffer. If `coterm--t-row' and `coterm--t-col'
+point to an unreachable location, locate PMARK as close to it as
+possible and return nil. Otherwise, locate PMARK exactly and
+return t."
+ (or coterm--t-pmark-in-sync
+ (save-excursion
+ (goto-char coterm--t-home-marker)
+ (setq coterm--t-pmark-in-sync
+ (prog1
+ (and
+ (zerop (forward-line
+ (+ coterm--t-home-offset coterm--t-row)))
+ (bolp)
+ (<= coterm--t-col (move-to-column coterm--t-col)))
+ (set-marker pmark (point)))))))
+
;; Moves pmark and inserts
(defun coterm--t-insert (proc-filt process str newlines)
"Insert STR using PROC-FILT and PROCESS.
@@ -293,14 +312,7 @@ initialize it sensibly."
(dirty))
(?J ;; \E[J - clear to end of screen (terminfo: ed,
clear)
(ins)
- (save-excursion
- (goto-char coterm--t-home-marker)
- (and
- (zerop (forward-line
- (+ coterm--t-home-offset coterm--t-row)))
- (bolp)
- (move-to-column coterm--t-col))
- (set-marker pmark (point)))
+ (coterm--t-approximate-pmark pmark)
(pcase (car ctl-params)
(0
(delete-region pmark (point-max)))
@@ -335,23 +347,12 @@ initialize it sensibly."
;; and `coterm--t-col' may point to a not yet existent location
;; after (point-max). First, we move `pmark' as close to this
;; position as possible.
- (if (or coterm--t-pmark-in-sync
- (equal
- '(0 . t)
- (save-excursion
- (goto-char coterm--t-home-marker)
- (prog1
- (cons
- (let ((newlines (forward-line
- (+ coterm--t-row
coterm--t-home-offset))))
- (if (bolp) newlines nil))
- (unless (eobp)
- (>= coterm--t-col (move-to-column
coterm--t-col))))
- (set-marker pmark (point))))))
+ (if (coterm--t-approximate-pmark pmark)
;; If we succeed, clear `coterm--t-row' and col. On next
;; output, we will initialize them to point to `pmark'.
(setq coterm--t-row nil
- coterm--t-col nil)
+ coterm--t-col nil
+ coterm--t-pmark-in-sync nil)
;; If we don't succeed, leave the variables unchanged. They will
;; be used to handle next output.
(ignore)))
- [elpa] externals/coterm 9e3e19b 05/80: Add support for \e[L, (continued)
- [elpa] externals/coterm 9e3e19b 05/80: Add support for \e[L, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm aa4a7f9 08/80: Support \e[M, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm 29ef3ad 07/80: Fix scrolling, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm ba74fb8 10/80: Simplify, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm f1cc63e 12/80: Support \e[6n for reporting cursor position, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm cfc9f03 13/80: Fix some escape params defaulting to 1, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm cf9217d 09/80: Support \e[P and \e[@, ELPA Syncer, 2021/10/13
- [elpa] externals/coterm e22fe83 17/80: Adjust column after resizing window, ELPA Syncer, 2021/10/13
- [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 <=
- [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, 2021/10/13
- [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