User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.1) Gecko/20061201 Firefox/2.0.0.1 (Ubuntu-feisty) Build Identifier: It could be helpful to have a vertical text selection (column selection) in files, using some key binding, say, shift/ctrl+left mouse button to make a vertical selection. Reproducible: Always
Note to myself: Maybe this is possible with the following code: 1) Drag start and end coordinate (x,y), so we can figure out the iters that are selected. First detect the start and end row with the x-coordinates, when walk each line to detect the first iter that is in the y region. 2) A TextTag that looks like a selection (maybe there is a default tag for this). We 'highlight' the selected area (walk rows) so it looks like a selection. 3) Block the normal selection when the vertical selection keys are pressed. - Boolean when there is a column selection, so we can remove the tag after a normal click- or key-event. 4) On copy, append the iters for each row that are within the area and a \n between the lines. Delete could remove the selection on each line and tab indent before the first selected iter on each line (visa versa for shift tab). 5) We should also move the cursor the the end x,y coordinate so we have the same behavior as normal selection, that should also trigger the move-cursor properties so the statusbar is updated. On second thoughts it's not that hard, but support for multi-select-line tab (un)indent probably requires some code rewrite of the indent function. We should also be very careful with searching the iters, that's probably not very fast if we do this on each event. Maybe an idle timer for selection does the job, since we can simple ignore the event if there is still an idle event pending...
Ok, commited this in the nick_0_3 branch. You can start a vertical selection with Ctrl+Shift+Mouse. Please give it some testing...
(In reply to comment #2) > Ok, commited this in the nick_0_3 branch. You can start a vertical selection > with Ctrl+Shift+Mouse. > > Please give it some testing... > I can't compile it, it stops with this error: if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -DBINDIR=\"/usr/bin\" -DDATADIR=\"/usr/share\" -DLIBDIR=\"/usr/lib\" -DLIBEXECDIR=\"/usr/libexec\" -DG_LOG_DOMAIN=\"Mousepad\" -DLIBEXECDIR=\"/usr/libexec\" -DPACKAGE_LOCALE_DIR=\"/usr/share/locale\" -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/xfce4 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -Werror -DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-unix-print-2.0 -I/usr/include/gtk-2.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -MT mousepad-mousepad-statusbar.o -MD -MP -MF ".deps/mousepad-mousepad-statusbar.Tpo" -c -o mousepad-mousepad-statusbar.o `test -f 'mousepad-statusbar.c' || echo './'`mousepad-statusbar.c; \ then mv -f ".deps/mousepad-mousepad-statusbar.Tpo" ".deps/mousepad-mousepad-statusbar.Po"; else rm -f ".deps/mousepad-mousepad-statusbar.Tpo"; exit 1; fi if gcc -DHAVE_CONFIG_H -I. -I. -I.. -I.. -I.. -DBINDIR=\"/usr/bin\" -DDATADIR=\"/usr/share\" -DLIBDIR=\"/usr/lib\" -DLIBEXECDIR=\"/usr/libexec\" -DG_LOG_DOMAIN=\"Mousepad\" -DLIBEXECDIR=\"/usr/libexec\" -DPACKAGE_LOCALE_DIR=\"/usr/share/locale\" -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/xfce4 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -pthread -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -Wall -Werror -DDBUS_API_SUBJECT_TO_CHANGE -I/usr/include/dbus-1.0 -I/usr/lib/dbus-1.0/include -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/gtk-unix-print-2.0 -I/usr/include/gtk-2.0 -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/lib/gtk-2.0/include -I/usr/include/pango-1.0 -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12 -g -O2 -MT mousepad-mousepad-view.o -MD -MP -MF ".deps/mousepad-mousepad-view.Tpo" -c -o mousepad-mousepad-view.o `test -f 'mousepad-view.c' || echo './'`mousepad-view.c; \ then mv -f ".deps/mousepad-mousepad-view.Tpo" ".deps/mousepad-mousepad-view.Po"; else rm -f ".deps/mousepad-mousepad-view.Tpo"; exit 1; fi cc1: warnings being treated as errors mousepad-view.c: In function ‘mousepad_view_handle_clipboard’: mousepad-view.c:879: attention : ‘string’ may be used uninitialized in this function mousepad-view.c:881: attention : ‘previous_ln’ may be used uninitialized in this function make[3]: *** [mousepad-mousepad-view.o] Erreur 1 make[3]: quittant le répertoire « /home/maximilian/nickpad/mousepad » make[2]: *** [all] Erreur 2 make[2]: quittant le répertoire « /home/maximilian/nickpad/mousepad » make[1]: *** [all-recursive] Erreur 1 make[1]: quittant le répertoire « /home/maximilian/nickpad » make: *** [all] Erreur 2 maximilian@r200x:~/nickpad$ Hope this helps. Please be so kind to tell me where I should post command line outputs if this is not the right place.
Well in fact this warning is just bogus, but it should be fixed in rev. 25726.
Works like a charm :-) I will give it some testing the coming days. Thank you Nick
This feature has already landed in Mousepad 0.3.0, I believe it has been a "gift" from GtkSourceView :)
Yep, confirming this works as described (Ctrl+Shift+Mouse).