about summary refs log tree commit diff stats
path: root/code
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2009-07-19 16:35:19 +0200
committerhut <hut@lavabit.com>2009-07-19 16:35:19 +0200
commitad6460c301cb27c6b57d3d0f30b2674fdc5779a7 (patch)
tree19512781714cd0422db650ac3f896690070c3207 /code
parent252d8f1959095793c783622b0f062439ca08391d (diff)
downloadranger-ad6460c301cb27c6b57d3d0f30b2674fdc5779a7.tar.gz
added doubleclick, with configurable mouseinterval
Diffstat (limited to 'code')
-rw-r--r--code/cli.rb4
-rw-r--r--code/keys.rb17
2 files changed, 14 insertions, 7 deletions
diff --git a/code/cli.rb b/code/cli.rb
index 60f74e75..3c0f506e 100644
--- a/code/cli.rb
+++ b/code/cli.rb
@@ -73,8 +73,8 @@ module CLI
 	MOUSE_MASK_ON = Ncurses::ALL_MOUSE_EVENTS | Ncurses::REPORT_MOUSE_POSITION
 	MOUSE_MASK_OFF = 0
 
-	def init_mouse
-		Ncurses.mouseinterval( 0 )
+	def init_mouse( interval )
+		Ncurses.mouseinterval( interval )
 		Ncurses.mousemask( MOUSE_MASK_ON, [] )
 	end
 
diff --git a/code/keys.rb b/code/keys.rb
index f553cf24..5916c69c 100644
--- a/code/keys.rb
+++ b/code/keys.rb
@@ -483,7 +483,14 @@ module Fm
 
 		when Option.mouse && '<mouse>'
 			log mouse.bstate
-			if mouse.press3? or mouse.press1?
+			if mouse.press1? or
+				mouse.press3? or
+				mouse.click1? or
+				mouse.click3? or
+				mouse.doubleclick1?
+
+				left = ! (right = mouse.press3? or mouse.click3?)
+
 				if mouse.y == 0
 				elsif mouse.y >= CLI.lines - @bars.size - 1
 				else
@@ -494,26 +501,26 @@ module Fm
 					case mouse.x
 					when ranges[0]
 						descend
-						if mouse.press1?
+						if left
 							@pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1
 							descend
 						end
 					when ranges[1]
 						descend
-						if mouse.press1?
+						if left
 							@pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1
 						end
 					when ranges[2]
 						@pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1
 
-						if mouse.press3?
+						if right or mouse.doubleclick1?
 							@buffer.clear
 							if mouse.ctrl? then press('L') else press('l') end
 						end
 					when ranges[3]
 						@buffer.clear
 						if mouse.ctrl? then press('L') else press('l') end
-						if mouse.press1? and currentfile.dir?
+						if left and currentfile.dir?
 							@pwd.pos = get_offset( @path[-1], lines ) + mouse.y - 1
 						end
 					end
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 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500