Dear rxvt-unicode list,

The below patches change two minor annoyances in rxvt-unicode.  These
aren't too important, but I've got to start in some way before hacking
rxvt-unicode more seriously.


The first patch makes mouse selection easier in some cases.  My
problem was the following.  I'm running urxvt without a border, and I
usually align the windows to the corners of the screen in which case
the window manager border is just outside the display.  This gives me
lots of space.  Now when the window is snapped to the right of the
display, you can't easily extend the selection of a long line to the
end of the screen line, because there's no way to move the mouse
pointer to the right of the rightmost column.  In this case you can
only select with the mouse till the beginning of the next line, which
includes a newline if the logical line is not continued, or I have to
move the window.  This kind of selection is often necessary if I want
to copy a few lines of text from a text displayed by less, because
then less explicitly breaks long lines with newlines, and I do not
want to include those newlines in the paste but replace them with
nothing or spaces as approperiate.

As a possible solution, this simple patch makes it so that if you
extend your selection by dragging or right-clicking to the rightmost
pixel of the rightmost column of the terminal window, that counts as
selecting including the last column of that line.  If the window has
no inner border and is snapped to the right of the display, it's easy
to move the mouse to that last pixel, otherwise you can just drag past
the end of the window as usual.  This feature is always active, it
cannot be disabled currently (I hope that's not a problem).

The patch seems to compile and work for me, but I haven't really done
much testing yet.  The patch is attached with name
urxvt-selectright.patch.  Apply inside the rxvt-unicode-9.06 directory
with 'patch -p1 < urxvt-selectright.patch' .


The second patch is trivial: it sets the .DELETE_ON_ERROR pragma in
the makefile.  If you're using gnu make, this causes that if there's
an error or you interrupt make with a signal, it deletes any files
that a rule started to create but has not finished.  The opposite,
which make normally does, can sometimes generate strange effects
because make thinks a partially written file is up-to-date (this is a
bug that's actually affected me), though this rarely comes up because
the linker detects a partially written object file.  The pragma has no
effect if you're using a make that does not know it.  Thus, this
pragma should be set in almost all makefiles.

The patch is attached with name urxvt-deleteonerror.patch.  Apply
inside the rxvt-unicode-9.06 directory with 'patch -p1
<urxvt-deleteonerror.patch' then rerun configure.


For reference, I used to use rxvt-unicode version 9.05 compiled from
vanilla source and just updated to version 9.06.  This is on a
linux-amd64 with the base system being debian lenny, with debian's
xorg and vanilla gcc 4.3.3.  Here are the configuration options I just
compiled the new version of urxvt with, the set of configuration
options I used to compile the one I used for longer are sadly lost.

 --prefix=/usr/local --enable-xft --enable-font-styles
--disable-afterimage --disable-transparency --disable-fading
--disable-next-scroll --enable-frills --enable-iso14755
--enable-selectionscrolling --enable-mousewheel --enable-smart-resize
--enable-pointer-blank --enable-perl --enable-warnings

And here are the usual set of command line I use to start urxvt.  The
encoding varies between iso-8859-2 and utf-8, and the window size
varies as well.

-ls -geometry 80x25 +sb -b 0 -bg \#000000 -fg \#c0c0c0 --colorBD
\#ffffff --color0 \#000000 --color1 \#aa0000 --color2 \#00aa00
--color3 \#aa5500 --color4 \#0000ff --color5 \#aa00aa --color6
\#00aaaa --color7 \#c0c0c0 --color8 \#555555 --color9 \#ff5555
--color10 \#55ff55 --color11 \#ffff55 --color12 \#5588ff --color13
\#ff55ff --color14 \#55ffff --color15 \#ffffff -cr \#c0f0a0 -fn
"x:-*-fecupboard-medium-r-*-*-20-*-*-*-*-*-iso10646-1,x:-*-terminus-bold-r-*-*-20-*-*-*-*-*-iso10646-1"
--boldFont "" -vb -sbg --print-pipe false --pointerBlank
--pointerBlankDelay 2147483647 -pe -searchable-scrollback,-readline
++iso14755_52

Ambrus
diff --git a/src/rxvt.h b/src/rxvt.h
index e19f201..067bd8c 100644
--- a/src/rxvt.h
+++ b/src/rxvt.h
@@ -609,6 +609,8 @@ typedef struct _mwmhints
 
 /* convert pixel dimensions to row/column values.  Everything as int32_t */
 #define Pixel2Col(x)            Pixel2Width((int32_t)(x))
+#define Pixel2ColSelectionExtend(x) \
+                                ((int32_t)(x) / (int32_t)fwidth + ((int32_t)ncol * (int32_t)fwidth - 1 == (int32_t)(x) && 1 < (int32_t)fwidth))
 #define Pixel2Row(y)            Pixel2Height((int32_t)(y))
 #define Pixel2Width(x)          ((int32_t)(x) / (int32_t)fwidth)
 #define Pixel2Height(y)         ((int32_t)(y) / (int32_t)fheight)
diff --git a/src/screen.C b/src/screen.C
index 715e845..81493fd 100644
--- a/src/screen.C
+++ b/src/screen.C
@@ -3282,7 +3282,7 @@ rxvt_term::selection_delimit_word (enum page_dirn dirn, const row_col_t *mark, r
 void
 rxvt_term::selection_extend (int x, int y, int flag) NOTHROW
 {
-  int col = clamp (Pixel2Col (x), 0, ncol);
+  int col = clamp (Pixel2ColSelectionExtend (x), 0, ncol);
   int row = clamp (Pixel2Row (y), 0, nrow - 1);
 
   /*
diff --git a/Makefile.in b/Makefile.in
index 1bf148b..491776d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -28,8 +28,6 @@ VPATH =		@srcdir@
 first_rule: all
 dummy:
 
-.DELETE_ON_ERROR:
-
 subdirs = src doc
 
 RECURSIVE_TARGETS = all allbin alldoc tags clean distclean realclean install
_______________________________________________
rxvt-unicode mailing list
[email protected]
http://lists.schmorp.de/cgi-bin/mailman/listinfo/rxvt-unicode

Reply via email to