[Top][All Lists]

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

Re: 23.0.50; Display bug with vline.el and viper

From: Vinicius Jose Latorre
Subject: Re: 23.0.50; Display bug with vline.el and viper
Date: Wed, 23 Jan 2008 20:07:24 -0300
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv: Gecko/20071128 SeaMonkey/1.1.7

Strange. I just tested again with the latest vline.el from EmacsWiki and inserted (redisplay t) as the last thing in vline-show. Same bug.

When I tested I had (window-height) => 4, ie 3 lines are shown, and (window-height) => 46. I had vline.el in the buffer. Cursor at left side (is it column 0 or 1?;-). Just hold down arrow-down.

It does not get past the row starting with

 ;; Author: Taiki SUGAWARA <address@hidden>

The vline.el that I'm using is attached to this email.

Please, check if we are using the same file and patch.

I'm using:

GNU Emacs (i686-pc-linux-gnu, GTK+ Version 2.12.1)
of 2008-01-12 on debian-hillux

These are the steps I've done:

1. emacs -Q vline.el

2. shrink Emacs until display 27 columns;
   (So you have a lot of long lines)

3. M-x eval-buffer RET

4. M-x vline-mode RET

5. C-n (several, well, you can hold the key pressed)
    It's all right until here.

6. shrink Emacs until display 3 lines;

7. C-n (several, again, you can hold the key pressed)
   Continue all right.

Without the patch, it has some problems.

;;; vline.el --- show vertical line mode.

;; Copyright (C) 2002, 2008 by Taiki SUGAWARA <address@hidden>

;; Author: Taiki SUGAWARA <address@hidden>
;; Keywords: faces, editing, emulating
;; Version: 1.03
;; Time-stamp: <2008/01/23 16:31:56 vinicius>
;; URL: http://www.emacswiki.org/cgi-bin/wiki/vline.el

;; This file 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 2, or (at your option)
;; any later version.

;; This file is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; GNU General Public License for more details.

;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING.  If not, write to
;; the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
;; Boston, MA 02110-1301, USA.

;;; Usage
;; put followings your .emacs
;;   (require 'vline)
;; if you display a vertical line, type M-x vline-mode. `vline-mode' doesn't
;; effect other buffers, because it is a buffer local minor mode. if you hide
;; a vertical line, type M-x vline-mode again.
;; if you display a vertical line in all buffers, type M-x vline-global-mode.
;; `vline-style' provides a display style of vertical line. see `vline-style' 

;;; Changes
;; 2008-01-22 taiki
;; applied patch from Lennart Borgman
;; - Added :group 'vline
;; - Added defcustom vline-current-window-only
;; - Added header items to simplify for users

;;; Code:

(defvar vline-overlay-table-size 200)
(defvar vline-overlay-table (make-vector vline-overlay-table-size nil))
(defvar vline-line-char ?|)

(defcustom vline-style 'face
  "*This variable holds vertical line display style.
Available values are followings:
`face'      : use face.
`compose'   : use composit char.
`mixed'     : use face and composit char."
  :type '(radio
          (const face)
          (const compose)
          (const mixed))
  :group 'vline)

(defface vline
  '((t (:background "gray90")))
  "*A default face for vertical line highlighting."
  :group 'vline)

(defcustom vline-face 'vline
  "*A face for vertical line highlighting."
  :type 'face
  :group 'vline)

(defcustom vline-current-window-only nil
  "*If non-nil then show column in current window only.
If the buffer is shown in several windows then show column only
in the currently selected window."
  :type 'boolean
  :group 'vline)

(define-minor-mode vline-mode
  "Display vertical line mode."
  :global nil
  :lighter " VL"
  :group 'vline
  (if vline-mode
      (add-hook 'post-command-hook 'vline-post-command-hook nil t)
    (remove-hook 'post-command-hook 'vline-post-command-hook t)))

(define-minor-mode vline-global-mode
  "Display vertical line mode as globally."
  :global t
  :lighter " VL"
  :group 'vline
  (if vline-global-mode
      (add-hook 'post-command-hook 'vline-global-post-command-hook)
    (remove-hook 'post-command-hook 'vline-global-post-command-hook)))

(defun vline-post-command-hook ()
  (when (and vline-mode (not (minibufferp)))

(defun vline-global-post-command-hook ()
  (when (and vline-global-mode (not (minibufferp)))

(defun vline-clear ()
  (mapcar (lambda (ovr)
            (and ovr (delete-overlay ovr)))

(defun vline-show (&optional point)
    (if point
        (goto-char point)
      (setq point (point)))
    (let* ((column (current-column))
           (i 0)
           (compose-p (memq vline-style '(compose mixed)))
           (face-p (memq vline-style '(face mixed)))
           (line-char (if compose-p vline-line-char ? ))
           (line-str (make-string 1 line-char)))
      (when face-p
        (setq line-str (propertize line-str 'face vline-face)))
      (goto-char (window-start))
      (while (and (< i (1- (window-height)))
                  (< i (length vline-overlay-table))
                  (not (eobp)))
        (move-to-column column)
        ;; non-cursor line only (workaround of eol probrem.
        (unless (= (point) point)
          ;; if column over the cursor's column (when tab or wide char is 
          (when (> (current-column) column)
          (let ((ovr (aref vline-overlay-table i))
                ;; consider a newline, tab and wide char.
                (str (concat (make-string (- column (current-column)) ? )
                (char (char-after)))
            ;; create overlay if not found.
            (unless ovr
              (setq ovr (make-overlay 0 0))
              (overlay-put ovr 'rear-nonsticky t)
              (aset vline-overlay-table i ovr))

            ;; initialize overlay.
            (overlay-put ovr 'face nil)
            (overlay-put ovr 'before-string nil)
            (overlay-put ovr 'after-string nil)
            (overlay-put ovr 'invisible nil)
            (overlay-put ovr 'window
                         (if vline-current-window-only

             ;; tab, wide-space.
             ((memq char '(?\t ? ))
              (setq str
                    (concat str
                            (make-string (- (save-excursion (forward-char)
                                            (string-width str))
                                         ? )))
              (move-overlay ovr (point) (1+ (point)))
              (overlay-put ovr 'invisible t)
              (overlay-put ovr 'after-string str))
             ;; eol
              (move-overlay ovr (point) (point))
              (overlay-put ovr 'after-string str))
                (let (str)
                  (when char
                    (setq str (compose-chars
                               (cond ((= (char-width char) 1)
                                      '(tc . tc))
                                     ((= (current-column) column)
                                      '(tc . tr))
                                      '(tc . tl)))
                    (when face-p
                      (setq str (propertize str 'face vline-face)))
                    (move-overlay ovr (point) (1+ (point)))
                    (overlay-put ovr 'invisible t)
                    (overlay-put ovr 'after-string str))))
                (move-overlay ovr (point) (1+ (point)))
                (overlay-put ovr 'face vline-face)))))))
        (setq i (1+ i))
      (redisplay t))))

(provide 'vline)

;;; vline.el ends here

reply via email to

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