Changeset 371a012 in mainline
- Timestamp:
- 2009-12-05T16:33:39Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 51ea01e
- Parents:
- ed372da
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/input.c
red372da r371a012 38 38 #include <io/color.h> 39 39 #include <vfs/vfs.h> 40 #include <clipboard.h> 40 41 #include <errno.h> 41 42 #include <assert.h> … … 449 450 } 450 451 452 static void tinput_sel_copy_to_cb(tinput_t *ti) 453 { 454 int sa, sb; 455 wchar_t tmp_c; 456 char *str; 457 458 tinput_sel_get_bounds(ti, &sa, &sb); 459 460 if (sb < ti->nc) { 461 tmp_c = ti->buffer[sb]; 462 ti->buffer[sb] = '\0'; 463 } 464 465 str = wstr_to_astr(ti->buffer + sa); 466 467 if (sb < ti->nc) 468 ti->buffer[sb] = tmp_c; 469 470 if (str == NULL) 471 goto error; 472 473 if (clipboard_put_str(str) != EOK) 474 goto error; 475 476 free(str); 477 return; 478 error: 479 return; 480 /* TODO: Give the user some warning. */ 481 } 482 483 static void tinput_paste_from_cb(tinput_t *ti) 484 { 485 char *str; 486 size_t off; 487 wchar_t c; 488 int rc; 489 490 rc = clipboard_get_str(&str); 491 if (rc != EOK || str == NULL) 492 return; /* TODO: Give the user some warning. */ 493 494 off = 0; 495 496 while (true) { 497 c = str_decode(str, &off, STR_NO_LIMIT); 498 if (c == '\0') 499 break; 500 501 tinput_insert_char(ti, c); 502 } 503 504 free(str); 505 } 506 451 507 static void tinput_history_seek(tinput_t *ti, int offs) 452 508 { … … 564 620 tinput_seek_vertical(ti, seek_forward, false); 565 621 break; 622 case KC_C: 623 tinput_sel_copy_to_cb(ti); 624 break; 625 case KC_V: 626 tinput_paste_from_cb(ti); 627 break; 566 628 default: 567 629 break;
Note:
See TracChangeset
for help on using the changeset viewer.