[Top][All Lists]

[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: Sun, 30 Jul 2017 10:39:45 -0700


-  The patch applies to commit a30e7e12ed8465e2565dd318d921bc87f52ce18e from 
03/28/2016.  address@hidden is unable to use the current master branch for 
daily workflow due to certain unrelated bugs.  Until those unrelated bugs are 
resolved, @lawlist will continue using earlier versions of the master branch.  
@lawlist is tentatively thinking of moving forwards in time to October 1, 2016 
bearing commit bb2ef5c6f7058b149adc9230a3db7d1fbd423c51, but testing will be 
needed prior thereto.]


-  `mc_store_previous_values':  Recording values of the current command loop 
(to be compared against the previous command loop) has been consolidated into 
one function, which makes the modification to `xdisp.c` cleaner.

-  Bug Fixes:  Enabling error checking when configuring the build revealed a 
few errors in the code that have now been corrected.  It turned out that 
`update_window_end` is called in about 99% of the locations where multiple 
cursors need to be removed.  A previous attempted optimization of `mc_calc` 
prevented cursor removal, and that bug has now been fixed.  Fixed two crashes; 
one was caused by an improper usage of `intern_c_string`, and another was 
caused by attempting to remove cursors directly from `xdisp.c` instead of 
letting `update_window_end` do its job.


-  Track down the cause for the 1% of the time when multiple fake cursors are 
not being removed.  [It may have something to do with redisplay being 
interrupted due to keyboard activity, or perhaps when windows/frames are 
changing size?]

-  Optimize drawing and removal of multiple fake cursors.

-  Implement a way to properly calculate x, y, hpos, vpos when overlays are 
present.  The overlay after-string property wreaks havoc on the current method 
of calculating coordinates.

-  Try and motivate one or more real programmers to take over from here.


-  The first stage is the creation/removal of fake cursors.

-  The second stage will be built-in functionality similar to the multiple 
cursors library by Magnar Sveen.


-  STEP #1 (clone master branch):  git clone -b master 

-  STEP #2:  cd over to the root of the `emacs` source directory cloned in the 
first step above.

-  STEP #3 (hard reset):  git reset --hard 

The following message is displayed in the terminal:  "HEAD is now at a30e7e1 
Mention the `M-q' changes"

-  STEP #4 (put the patch in place):  Copy the latest patch 
(multiple_cursors_008.diff) to the root of the emacs source directory cloned in 
the first step above.

-  STEP #5 (apply the patch):  git apply multiple_cursors_009.diff

-  STEP #6:  ./autogen.sh

-  STEP #7:  Configure the build for X, MS Windows, or OSX; e.g.,:  ./configure 

-  STEP #8:  make

-  STEP #9:  make install

-  STEP #10:  Launch the newly built Emacs, and copy the following function to 
the `*scratch*` buffer, and type `M-x mc-test`.

(defun mc-test ()
"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.
Popular forms of specifying colors such as \"red\" and \"#FF0000\" are now
supported, as well as LSL color vectors such as [1.0 0.0 0.0].  For those users
who choose the former familiar methods of specifying colors with strings,
`mc_color_vector_calculate' will convert those strings to LSL color vectors.
The color vectors are commonly referred to as LSL (The Linden Scripting 
`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 
  (let ((buffer (get-buffer-create "*MC-TEST*")))
    (with-current-buffer buffer
      (insert "This is a test!")
      (setq mc-list '((1 "hbar" "red")
                      (2 "bar" "yellow")
                      (3 "box" "#00FF00")
                      (4 "hollow" "#0000FF")
                      (5 ("hbar" 3) [1.0 0.0 1.0])
                      (6 ("bar" 3) [0.0 1.0 1.0]))))
    (select-window (display-buffer buffer))
    ;;; The trigger in `keyboard.c` is not activated in this example, so we
    ;;; Force the multiple cursors to be drawn.
    (mc-draw-erase (selected-window))))

Attachment: multiple_cursors_009.diff
Description: application/diff

reply via email to

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