bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#22873: Can we support multiple Cursors?


From: Keith David Bershatsky
Subject: bug#22873: Can we support multiple Cursors?
Date: Thu, 17 Mar 2016 21:00:32 -0700

Attached is the next draft patch -- multiple_cursors_006.diff -- that applies 
to Emacs master branch as of March 17, 2016, bearing commit 
"2fbdb1bb4c878f8ae17bd69d1b4ff51c47497e41".

This patch resolves the issue relating to a delay of the fake cursors appearing 
in Emacs for Windows.  The bug was caused because I had erroneously thought 
that the tail end of `redisplay_window' would be a sufficient location to 
calculate window-start/end for all circumstances, but it turned out that 
initializing fake cursors by merely setting the `mc-list` variable does not 
necessarily trigger the tail end of the former internal function.  Thus, there 
is now a second location at the beginning of `mc_calc' to determine 
window-start/end if it has not already been determined.  Other changes include 
setting up a struct prefix of `mc` in window.h for the pointers, except for the 
Lisp_Object `mc_cache' which apparently requires special treatment not lending 
itself to using a prefix.

That was the last of the known problems with fake cursors, so the next phase 
will be for me to try it out with a custom minor mode over the next few weeks 
to see what else may be needed.  The current draft patch has been lightly 
tested on Emacs for all three (3) window systems -- X11 (no toolkit), Windows 
(XP SP-3), and OSX (10.6.8).

(defun mc-test (&optional list)
"Draw fake cursors at all POS defined in the `mc-list'.  Multiple fake cursors
are supported by GUI versions of Emacs built for X, Windows and OSX.
Color vector is LSL (The Linden Scripting Language), rather than standard RGB.
`nsterm.m' uses `NSColor', which works well with LSL.  `w32term.c' uses
`PALETTERGB' or `RGB', and the conversion from LSL is done internally by
multiplying each element of the LSL color vector by 255.  `xterm.c' uses
`x_make_truecolor_pixel', which uses 16-bit RGB -- the conversion from LSL
happens internally by multiplying each element of the LSL color vector by 
65535."
(interactive)
  (setq mc-list (if list list '(
    (3 "hbar" [1.0 0.0 0.0])
    (4 "bar" [0.0 1.0 0.0])
    (5 "box" [0.0 0.0 1.0])
    (6 "hollow" [0.8 0.4 0.2])
    (7 ("hbar" 3) [1.0 0.0 1.0])
    (8 ("bar" 3) [0.0 1.0 1.0])))))

(global-set-key [f1] 'mc-test)

Attachment: multiple_cursors_006.diff
Description: application/diff


reply via email to

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