Skip to content

Commit 5682071

Browse files
author
c
committed
rectangular region fill, rectangular operations create less blanks
1 parent 41d99ab commit 5682071

File tree

4 files changed

+38
-29
lines changed

4 files changed

+38
-29
lines changed

README.org

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
- Move cursor with the arrow-keys on the keyboard =→ ↑ ↓ ←=
1212
- Quit =C-c C-c=
1313

14-
* Pure UNICODΕ text diagrams in Emacs
14+
* Pure UNICODE text diagrams in Emacs
1515
Draw diagrams like those:
1616

1717
Document a command:
@@ -162,16 +162,16 @@ Exit it with:
162162

163163
The current major mode is still active underneath =uniline-mode=.
164164

165-
While in =uniline-mode=, overwritting is active, as well as long lines
165+
While in =uniline-mode=, overwriting is active, as well as long lines
166166
truncation. Also, a hollow cursor is provided. Those settings are
167167
reset to their previous state when exiting =uniline-mode=.
168168

169169
* Drawing lines
170-
Use keybord arrows to draw lines.
170+
Use keyboard arrows to draw lines.
171171

172172
By default, drawing lines only happens over empty space or over other
173173
lines. If there is already text, it will not be erased. However, by
174-
hiting the control-key while moving, lines overwrite whatever there
174+
hitting the control-key while moving, lines overwrite whatever there
175175
is.
176176

177177
The buffer is "infinite" in bottom and right directions. Which means
@@ -218,7 +218,7 @@ The =<insert>= key is a prefix for other keys:
218218
- for drawing arrows, squares, crosses, o-shapes glyphs,
219219
- for handling rectangles,
220220
- for inserting =# = - += which otherwise change the brush style,
221-
- for trying a choice of monospaced fonts.
221+
- for trying a choice of mono-spaced fonts.
222222

223223
Why =<insert>=? Because:
224224
- =Uniline= tries to leave their original meaning to as much keys as
@@ -261,8 +261,8 @@ To change the direction of the arrow, use shift-arrow, for example:
261261
=S-<up>= will change from =→= to =↑=.
262262

263263
* Intersection glyphs =■ ◆ ●=
264-
There are a few other UNICODE characters which are monospace and
265-
symetric in the 4 directions. They are great at line intersections:
264+
There are a few other UNICODE characters which are mono-space and
265+
symmetric in the 4 directions. They are great at line intersections:
266266

267267
To insert a square =□ ■ ▫ ▪ ◇ ◆ ◊= type:
268268
=<insert>sss...= (=s= cycles, =S= cycles backward).
@@ -314,9 +314,9 @@ prefix them with =<insert>=. Example: =<insert>-= inserts a =-= and
314314
To draw a rectangle in one shot, select a rectangular region with
315315
=C-SPC= or =C-x SPC= and move the cursor.
316316

317-
You may also use =S-<arrow>= (=<arrow>= beeing any of the 4
317+
You may also use =S-<arrow>= (=<arrow>= being any of the 4
318318
directions) to extend the selection. The buffer grows as needed with
319-
white spaces to accomodate the selection. Selection extension mode is
319+
white spaces to accommodate the selection. Selection extension mode is
320320
active when =shift-select-mode= is non-nil.
321321

322322
If needed, change the brush with any of
@@ -460,7 +460,7 @@ a boundary.
460460

461461
Put the cursor anywhere in the hole. Then type:
462462

463-
=<insert> i=
463+
=INS i=
464464

465465
Answer by giving a character to fill the hole.
466466

@@ -476,6 +476,11 @@ by functions like =C-k= or =M-w=, which remove text from the buffer.
476476

477477
Typing =RET= aborts the filling operation.
478478

479+
A rectangular shape may also be filled.
480+
- Mark a region
481+
- =INS i=
482+
- answer which character should be used to fill.
483+
479484
There is no limit on the area to fill. Therefore, the filling
480485
operation may flood the entire buffer (but no more).
481486

@@ -561,7 +566,7 @@ call a macro in 4 directions, closing a square:
561566
#+end_example
562567

563568
* Which fonts?
564-
A monospace character font must be used. It must also support UNICODE.
569+
A mono-space character font must be used. It must also support UNICODE.
565570

566571
Not all fonts are born equal.
567572

@@ -577,7 +582,7 @@ Not all fonts are born equal.
577582
- =(set-frame-font "Source Code Pro" )=
578583

579584
Those fonts are known to support the required UNICODE characters, AND
580-
display them as monospace. There are fonts advertized as monospace
585+
display them as mono-space. There are fonts advertised as mono-space
581586
which give arbitrary widths to non-ASCII characters. That is bad for
582587
the kind of drawings done by =Uniline=.
583588

@@ -598,10 +603,10 @@ or
598603

599604
Beware that Emacs tries to compensate for missing UNICODE support by
600605
the current font. Emacs substitutes one font for another, character
601-
per character. The user may not notice until the dawings done under
606+
per character. The user may not notice until the drawings done under
602607
Emacs are displayed on another text editor or on the Web.
603608

604-
To know which font Emacs has choosen for a given character, type:
609+
To know which font Emacs has chosen for a given character, type:
605610

606611
=C-u C-x ==
607612

@@ -665,8 +670,8 @@ choice for everyone.
665670

666671
#+begin_example
667672

668-
╭────┬────────┬────╮ ╺┯━━━━┯┯━━┯┯━┯┯━━━━━━━━┯┯━━━━━━━┯┯━━━━━━┯╸
669-
│▒▒▒▒╰────────╯▒▒▒▒│ │ │╰is╯╰a╯│ ││ │╰arround
673+
╭────┬────────┬────╮ ╺┯━━━━┯┯━━┯┯━┯┯━━━━━━━━┯┯━━━━━━━┯┯━━━━━━┯╸
674+
│▒▒▒▒╰────────╯▒▒▒▒│ │ │╰is╯╰a╯│ ││ │╰around
670675
│▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒│ ╰this╯ ╰sentence╯╰hanging╯
671676
│▒▒▒╭─╮▒▒▒▒▒▒╭─╮▒▒▒│ △
672677
│▒▒▒╰─╯▒▒▒▒▒▒╰─╯▒▒▒│ │ △
@@ -764,12 +769,12 @@ this does not quite work:
764769
┃ ┗━━┛ ┃ ┏┛ ┃
765770
┗━━━━━━━━━┛ ┗━━━━━━┛
766771

767-
but that is ok:
772+
but that is OK:
768773
┏━━━┓
769774
┃ ┃
770775
┗━━━┛
771776

772-
that is ok too:
777+
that is OK too:
773778
╺════╦══╗ ╔════╗
774779
║ A║ ║ B ╚══╗
775780
╚══╝ ╚═══════╝
@@ -847,8 +852,8 @@ for =C-<insertchar>=, for example with =use-package= in your
847852
#+end_example
848853

849854
** Emacs on Windows
850-
On Windows the only native monospaced fonts are =Lucida Console= and
851-
=Courier New=. They are not monospaced for the Unicodes used by
855+
On Windows the only native mono-spaced fonts are =Lucida Console= and
856+
=Courier New=. They are not mono-spaced for the Unicodes used by
852857
=Uniline=.
853858

854859
Often, the =Consolas= font is present on Windows. It supports quite well
@@ -894,7 +899,7 @@ in your =$HOME/.emacs= file is great for that:
894899
:bind ("C-<insert>" . uniline-mode))
895900
#+end_example
896901

897-
In this example, =C-<insert>= was choosen. You can use whatever keys combination you want.
902+
In this example, =C-<insert>= was chosen. You can use whatever keys combination you want.
898903
=<insert>= happens to also be the key used inside =Uniline=.
899904

900905
* Related packages
@@ -960,6 +965,9 @@ In this example, =C-<insert>= was choosen. You can use whatever keys combination
960965

961966
* Author, contributors
962967
- Thierry Banel, author
968+
969+
Feedback:
970+
963971
- Joost Kremers https://github.com/joostkremers found a bug in the
964972
minor-mode key-binding definitions, and incompatibility with
965973
- DogLooksGood https://github.com/DogLooksGood gave feedback on

images/line-spacing.png

-255 Bytes
Loading

tests/bench12.el

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,4 @@
3636
yyyyyyyy
3737
yyyyyyyy
3838
yyyyyyyy
39-
4039
")

uniline.el

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1667,17 +1667,16 @@ See `uniline--choose-fill-char'."
16671667
(interactive)
16681668
(let ((char (uniline--choose-fill-char)))
16691669
(uniline--operate-on-rectangle
1670-
(goto-char beg)
16711670
(cl-loop
16721671
repeat height
1672+
for y from begy
16731673
do
1674-
(uniline--move-to-column begx)
1674+
(uniline--move-to-lin-col y begx)
16751675
(cl-loop
16761676
repeat width
16771677
do
16781678
(uniline--insert-char char)
1679-
(uniline--move-to-delta-column 1))
1680-
(uniline--move-to-delta-line 1)))))
1679+
(uniline--move-to-delta-column 1))))))
16811680

16821681
(defun uniline-draw-inner-rectangle (&optional force)
16831682
"Draws a rectangle inside a rectangular selection.
@@ -2499,7 +2498,7 @@ text within will be colored."
24992498
,uniline-hydra-moverect/hint
25002499
,(eval-when-compile
25012500
(uniline--color-hint
2502-
"move: ^←→↑↓^ trace: ^rR C-rR^ copy-paste: ^cky^ brush: ^-+=# DEL^ hint: ^TAB^")))
2501+
"move: ^←→↑↓^ trace: ^rR C-rR^ copy-paste: ^cky^ fill: ^i^ brush: ^-+=# DEL^ hint: ^TAB^")))
25032502
uniline-hydra-macro-exec/hint
25042503
`(if (eq uniline-hint-style t)
25052504
,uniline-hydra-macro-exec/hint
@@ -2712,6 +2711,8 @@ And backup previous settings."
27122711
\\[uniline-hydra-moverect/uniline-draw-outer-rectangle] draw an outer rectangle
27132712
\\[uniline-hydra-moverect/uniline-overwrite-inner-rectangle] overwrite an inner rectangle
27142713
\\[uniline-hydra-moverect/uniline-overwrite-outer-rectangle] overwrite an outer rectangle
2714+
├─Fill───────────────────────╴
2715+
\\[uniline-hydra-moverect/uniline-fill-rectangle] fill region with a character
27152716
├─Other──────────────────────╴
27162717
\\[uniline-hydra-moverect/uniline--hydra-rect-undo-and-exit] undo works outside selection
27172718
\\[uniline-hydra-moverect/uniline--hydra-rect-quit-and-exit] exit the rectangle sub-mode
@@ -2801,15 +2802,16 @@ And backup previous settings."
28012802
["rotate arrow ↑ up" uniline-rotate-up↑ :keys "INS S-<up> "]
28022803
["rotate arrow ← left" uniline-rotate-lf← :keys "INS S-<left> "]
28032804
["rotate arrow ↓ down" uniline-rotate-dw↓ :keys "INS S-<down> "])
2804-
("Rectangular selection" :active (region-active-p)
2805+
("Rectangular region" :active (region-active-p)
28052806
["move selection right" uniline-move-rect-ri→ :keys "INS <right>"]
28062807
["move selection left" uniline-move-rect-lf← :keys "INS <left> "]
28072808
["move selection up" uniline-move-rect-up↑ :keys "INS <up> "]
28082809
["move selection down" uniline-move-rect-dw↓ :keys "INS <down> "]
28092810
["trace rectangle inside selection" uniline-draw-inner-rectangle :keys "INS r"]
28102811
["trace rectangle around selection" uniline-draw-outer-rectangle :keys "INS R"]
28112812
["overwrite rectangle inside selection" uniline-overwrite-inner-rectangle :keys "INS C-r"]
2812-
["overwrite rectangle around selection" uniline-overwrite-outer-rectangle :keys "INS C-R"])
2813+
["overwrite rectangle around selection" uniline-overwrite-outer-rectangle :keys "INS C-R"]
2814+
["fill" uniline-fill-rectangle :keys "INS i"])
28132815
("Fill & contour"
28142816
["contour" uniline-contour]
28152817
["contour overw" (uniline-contour t)]

0 commit comments

Comments
 (0)