/usr/share/jed/lib/mswmouse.sl is in jed-common 1:0.99.19-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 | %
% JED mouse interface
%
% These routines assume a 2 button mouse
%
% left : set point to mouse point
% right : paste from cut buffer moving point to mouse point
% drag left : mark a region and copy it to cut buffer
% shift left : split window mouse is in
% control left : delete window mouse is in
%
% Other buttons are undefined.
%
setkey ("mouse_set_point_open", "\e^@Dl"); % left button down
setkey ("mouse_set_point_close", "\e^@Ul"); % left button up
setkey ("mouse_yank_cutbuffer", "\e^@Dm"); % middle down
setkey ("mouse_yank_cutbuffer", "\e^@Dr"); % right down
setkey ("mouse_null", "\e^@Um"); % middle up
setkey ("mouse_null", "\e^@Ur"); % right up
% dragging
setkey ("mouse_drag", "\e^@^@l"); % left dragging
setkey ("mouse_drag", "\e^@^@r"); % right dragging
setkey ("mouse_null", "\e^@^@^L"); % C-left dragging
setkey ("mouse_drag", "\e^@^@^R"); % C-right dragging
setkey ("mouse_null", "\e^@^@L"); % S-left dragging
setkey ("mouse_null", "\e^@^@R"); % S-right dragging
% shifted
setkey ("mouse_split_window", "\e^@DL"); % Shift-left button down
setkey ("mouse_null", "\e^@UL"); % left button up
setkey ("mouse_yank_from_jed", "\e^@DM"); % middle down
setkey ("mouse_yank_from_jed", "\e^@DR"); % right down
setkey ("mouse_null", "\e^@UR"); % right up
setkey ("mouse_null", "\e^@UM"); % middle up
% ctrl
setkey ("mouse_delete_window", "\e^@D^L"); % left button down
setkey ("mouse_null", "\e^@U^L"); % left button up
setkey ("mouse_null", "\e^@D^M"); % middle down
setkey ("mouse_null", "\e^@D^R"); % middle down
setkey ("mouse_null", "\e^@U^M"); % middle up
setkey ("mouse_null", "\e^@U^R"); % middle up
define mouse_null ();
% loop through windows moving the point to the mouse point
% if same_window is false, and mouse is on status line, call status_fun
% It returns zero if the status function was used, otherwise, it returns 1
define mouse_point_mouse (force, same_window, push, status_fun)
{
variable n = nwindows ();
variable top, bot, dy, col, want_col;
while (n)
{
top = window_info('t');
bot = window_info('r') + top;
if ((MOUSE_Y >= top) and (MOUSE_Y < bot))
{
if (push) push_visible_mark ();
dy = MOUSE_Y - (top - 1 + window_line());
if (dy > 0)
{
dy -= down(dy);
eol();
if (force) loop (dy) newline();
}
else go_up(- dy);
eol();
col = what_column ();
want_col = window_info('c') + MOUSE_X - 1;
!if (force or (want_col <= col)) want_col = col;
() = goto_column_best_try(want_col);
return 1;
}
if (same_window)
{
if (push) push_visible_mark ();
if (MOUSE_Y >= bot)
{
go_down(MOUSE_Y - bot + 1);
}
else
{
go_up(top - MOUSE_Y);
}
x_warp_pointer ();
return 1;
}
if ((bot == MOUSE_Y) and (use_status_fun != NULL))
{
@status_fun ();
return 0;
}
otherwindow();
n--;
}
error ("Mouse not in a window.");
}
variable Mouse_Drag_Mode = 0;
variable Mouse_Buffer = " *Mouse buffer*";
variable Mouse_Delete_Region = 0;
define copy_kill_to_mouse_buffer ()
{
variable cbuf = whatbuf ();
variable pnt, n;
%
% We are not going to copy to the pastebuffer if the region is nil
%
n = what_line(); pnt = _get_point ();
push_spot();
pop_mark_1 ();
if ((what_line() == n) and (_get_point () == pnt))
{
pop_spot();
return;
}
push_mark();
pop_spot();
setbuf(Mouse_Buffer);
erase_buffer ();
setbuf (cbuf);
if (Mouse_Delete_Region) () = dupmark();
() = dupmark(); %/* for cut buffer */
x_copy_region_to_cutbuffer ();
copy_region(Mouse_Buffer);
if (Mouse_Delete_Region)
{
Mouse_Delete_Region = 0;
del_region();
}
message ("region copied.");
}
define mouse_next_buffer ()
{
variable n, buf, cbuf = whatbuf ();
n = buffer_list (); %/* buffers on stack */
loop (n)
{
=buf;
n--;
if (buf[0] == ' ') continue;
if (buffer_visible (buf)) continue;
sw2buf (buf);
loop (n) pop ();
return;
}
error ("All buffers are visible.");
}
custom_variable ("Mouse_Save_Point_Mode", 1);
%!%+
%\variable{Mouse_Save_Point_Mode}
%\synopsis{Mouse_Save_Point_Mode}
%\usage{Integer Mouse_Save_Point_Mode = 1;}
%\description
% If this variable is non-zero, the editing point will be restored to its
% original position when the left button is used to copy a region to the
% cutbuffer. If the variable is zero, the current point is left at the
% end of the copied region.
%!%-
private variable Mouse_Save_Point_Window;
private variable Mouse_Save_Point_Mark;
define mouse_set_point_open ()
{
Mouse_Drag_Mode = 0;
Mouse_Save_Point_Window = window_info ('t');
Mouse_Save_Point_Mark = create_user_mark ();
if (Mouse_Save_Point_Mode) Mouse_Save_Point_Mode = -1;
if (mouse_point_mouse (0, 0, 0, &mouse_next_buffer)
and Mouse_Save_Point_Mode)
{
Mouse_Save_Point_Mode = 1;
}
}
define mouse_set_point_close ()
{
if (Mouse_Drag_Mode)
{
copy_kill_to_mouse_buffer ();
Mouse_Drag_Mode = 0;
if ((MOUSE_BUTTON == 1) and (Mouse_Save_Point_Mode > 0))
{
loop (nwindows ())
{
if (window_info ('t') == Mouse_Save_Point_Window)
{
if (whatbuf () == Mouse_Save_Point_Mark.buffer_name)
goto_user_mark (Mouse_Save_Point_Mark);
break;
}
otherwindow ();
}
Mouse_Save_Point_Mode = -1;
}
}
else if (MOUSE_BUTTON == 3)
{
dupmark(); pop();
copy_kill_to_mouse_buffer ();
pop_mark_1 ();
}
}
define mouse_yank_from_jed ()
{
() = mouse_point_mouse (0, 0, 0, NULL);
if (bufferp(Mouse_Buffer)) insbuf(Mouse_Buffer);
}
define mouse_yank_cutbuffer ()
{
variable w = window_info ('t');
variable max_loops = nwindows ();
variable m = create_user_mark ();
if (mouse_point_mouse (0, 0, 1, &splitwindow))
{
pop_mark_1 (); % since we set it in the function call
while (max_loops and (w != window_info ('t')))
{
otherwindow ();
max_loops--;
}
if (max_loops)
{
goto_user_mark (m);
() = x_insert_cutbuffer ();
}
}
}
define delete_window ()
{
call("delete_window");
}
define mouse_mark_and_copy ()
{
Mouse_Drag_Mode = 0;
() = mouse_point_mouse (0, 0, 1, &delete_window);
}
define mouse_drag ()
{
!if (Mouse_Drag_Mode)
{
push_visible_mark ();
Mouse_Drag_Mode = 1;
}
() = mouse_point_mouse (0, 1, 0, NULL);
update_sans_update_hook (not(input_pending(0)));
}
define mouse_kill_region ()
{
Mouse_Delete_Region = 1;
mouse_mark_and_copy (0, 0, 1);
}
define mouse_split_window ()
{
() = mouse_point_mouse (0, 0, 0, NULL);
splitwindow();
}
define mouse_delete_window ()
{
() = mouse_point_mouse (0, 0, 0, NULL);
delete_window ();
}
|