[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Cursor Moving on Image Broken?
From: |
MJ Chan |
Subject: |
Re: Cursor Moving on Image Broken? |
Date: |
Thu, 14 Apr 2005 14:40:12 -0000 |
This is a follow-up to a bug report (included below) that I sent
yesterday regarding cursor moving on image. Kim, thank you for
pointing me to report-emacs-bug.
I did some further testing and found that the problem will take place
when the window width is less than the image. Below is a simplified
lisp code that I use to display an image file in multi-rows and
columns. I then call "(display-image "c:/tmp/pretest/pic.jpg")" to
display an image file. When the window is wider than the image itself,
cursor moving has no problem (see the first attachment). However, if I
resize the window to make it smaller than the image (red arrows will
be shown in the right fringe area, see the second attachment), then I
cannot go up (going down is fine). That is, the cursor will not move
if I do "previous-line" (^N).
There is also a similar problem when I move to the right side of the
image while it's being displayed in multi-columns. When trying to move
to the left, I won't be able to see the left side of the image.
Also, the 3rd attachment shows a corrupted display of the left fringe
when I tried to move up and down while the cursor is at the end of the
line.
Please let me know if you need additional information.
------------------- sample lisp code -----------------------------------------
(defun display-image (image-file &optional scale)
"Display the file as an image in the current buffer."
(interactive)
(let ((image-type nil))
(unless (or image-type
(setq image-type (image-type-from-file-header image-file)))
(let ((extension (file-name-extension image-file)))
(unless extension
(error "Cannot determine image type"))
(setq image-type (intern extension))))
(if (and (fboundp 'image-type-available-p) image-type
(image-type-available-p image-type))
(let (start (selective-display nil)
image work-buffer o width height (rows 1) (cols 1)
(x-margin 0)
(scale 1)
(image-buffer (get-buffer-create (concat "*Image: "
(file-name-nondirectory image-file))))
(buffer-read-only nil))
(set-buffer image-buffer)
(erase-buffer)
(setq truncate-lines t)
(setq cursor-type 1)
(setq start (point))
(make-variable-buffer-local 'images-current-image-filename)
(setq image (list 'image ':type image-type ':file image-file))
(setq width (car (image-size image t))
height (cdr (image-size image t)))
(if (> height (* 2 (frame-char-height)))
(setq rows (/ height (* 2 (frame-char-height)))))
(if (> width (frame-pixel-width))
(setq cols (/ (+ width (/ (frame-pixel-width) 2)) (/
(frame-pixel-width) 2))))
(if images-extra-centered-image
(setq image (list 'image ':type image-type ':file image-file
':pointer 'hand ':margin (cons x-margin 10))))
(insert-sliced-image image "z" nil rows cols)
(clear-image-cache t)
(setq o (make-overlay start (point) nil t nil))
(overlay-put o 'evaporate t)
(goto-char start)
(switch-to-buffer image-buffer)
t)
nil)))
(display-image "c:/tmp/pretest/pic.jpg")
>>>>> On Thursday, April 14 2005, Kim F Storm said:
> MJ Chan <address@hidden> writes:
>> First of all, I apologize if this is not the right mailing list to post
>> a possible problem with latest CVS Emacs. (I am not on the list).
> You should use M-x report-emacs-bug to report bugs with CVS Emacs.
>> However, today I checked out latest Emacs from CVS and I found that I
>> have a problem with ^P (previous line) when the cursor is on the
>> image. I can do ^N (next-line) without a problem, but ^P will not move
>> to the previous line. That is, I can only go down and cannot go up.
>>
>> Another problem is that when I scroll a wide image to the right (with
>> my multi-column image display), I no longer can scroll back to
>> beginning of the line (an image strip actually) with ^P.
> Can you post a specific test case (lisp code + image + step-by-step
> instructions) that shows the bogus behaviour, or at least some more
> specific instructions like "size of slices" etc...
>>
>> I looked through the mailing archive, and saw a similar post that
>> talks about partial image scrolling in January, but I am not sure if
>> it is related. I also learned that the new move-line lisp function is
>> also trying to help solve the scrolling of tall image. Would that have
>> something to do with the problem I reported?
> It could very well be a problem... Line scrolling now tries
> to scroll correctly in tall images -- but it may have broken
> something else.
> --
> Kim F. Storm <address@hidden> http://www.cua.dk
------------------------------------------------------------------------
In GNU Emacs 22.0.50.1 (i386-mingw-nt5.1.2600)
of 2005-04-12 on MCHANXP648L
Distributor `Microsoft Corp.', version 5.1.2600
configured using `configure --with-gcc (3.2) --cflags -I../../GnuWin32/include'
Important settings:
value of $LC_ALL: nil
value of $LC_COLLATE: nil
value of $LC_CTYPE: nil
value of $LC_MESSAGES: nil
value of $LC_MONETARY: nil
value of $LC_NUMERIC: nil
value of $LC_TIME: nil
value of $LANG: ENU
locale-coding-system: chinese-big5
default-enable-multibyte-characters: t
Major mode: Fundamental
Minor modes in effect:
file-name-shadow-mode: t
auto-image-file-mode: t
tooltip-mode: t
encoded-kbd-mode: t
mouse-wheel-mode: t
menu-bar-mode: t
global-font-lock-mode: t
unify-8859-on-encoding-mode: t
utf-translate-cjk-mode: t
line-number-mode: t
next-error-follow-minor-mode: Fol
Recent input:
C-n C-n C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-p
C-p C-p C-p C-p C-p C-p C-p C-p C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n C-n
C-n C-n C-n C-n C-n C-n C-p C-p C-p C-p C-p C-p C-p
C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p C-p
C-p C-p C-p C-p C-p C-n C-n C-n M-x e m a c s - b u
<tab> <backspace> <backspace> r e <tab> <backspace>
<backspace> C-g M-x r e p o r t <tab> <return>
Recent messages:
Auto-saving...done
Hit <space> to undo more
Finished undoing.
display-image
Mark set
[4 times]
Quit
Loading emacsbug...done
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: Cursor Moving on Image Broken?,
MJ Chan <=