Skip to content

Commit

Permalink
fix glitch with \t tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
c committed Nov 14, 2024
1 parent 547c37e commit 33f2dd4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*~
*.elc
28 changes: 28 additions & 0 deletions tests/bench11.el
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
;;; uniline.el --- Draw lines, boxes, & arrows with the keyboard -*- coding:utf-8; lexical-binding: t; -*-

;; Copyright (C) 2024 Thierry Banel

;; Author: Thierry Banel tbanelwebmin at free dot fr
;; Version: 1.0
;; URL: https://github.com/tbanel/uniline

;; Uniline is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.

;; Uniline is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with this program. If not, see <http://www.gnu.org/licenses/>.

(uniline-bench
"C-q <tab> t a b s SPC ? <return> <down> C-a C-q <tab> C-q <tab> 2 SPC t a b s <down> <home> <kp-subtract> <right> <right> <up> <up> <right> <right> <right> <right> <right> <right> <right> <right> <right> <right> <down> <down> <insert> s"
"\
╭─────tabs╮?
│ │ 2 tabs
╶─╯ □
")
5 changes: 3 additions & 2 deletions uniline.el
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,9 @@ Exchange left with right, up with down."
Add blanks if line is too short: ensure that cursor
points to a character, not \\n.
Move to 0 if X negative."
(move-to-column (1+ (max x 0)) t)
(backward-char))
(let ((x (max x 0))) ;; let is faster than setq when byte-compiled
(move-to-column (1+ x) t)
(move-to-column x t)))

(defun uniline--move-to-delta-column (x)
"Move X characters, staying on the same line.
Expand Down

0 comments on commit 33f2dd4

Please sign in to comment.