Changeset dd13349 in mainline for uspace/app/edit/edit.c


Ignore:
Timestamp:
2012-08-18T21:24:02Z (12 years ago)
Author:
Martin Sucha <sucha14@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
6560960, 7eaeec1, aa492fe
Parents:
d17a4a9
Message:

edit: Implement HOME/END keys using move to sol/eol spt instead of inifinite relative movement.

This fixes HOME key in the first line of document.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • uspace/app/edit/edit.c

    rd17a4a9 rdd13349  
    111111#define BUF_SIZE 64
    112112#define TAB_WIDTH 8
    113 #define ED_INFTY 65536
    114113
    115114/** Maximum filename length that can be entered. */
     
    507506static void key_handle_movement(unsigned int key, bool select)
    508507{
     508        spt_t pt;
    509509        switch (key) {
    510510        case KC_LEFT:
     
    521521                break;
    522522        case KC_HOME:
    523                 caret_move_relative(0, -ED_INFTY, dir_after, select);
     523                tag_get_pt(&pane.caret_pos, &pt);
     524                pt_get_sol(&pt, &pt);
     525                caret_move(pt, select, true);
    524526                break;
    525527        case KC_END:
    526                 caret_move_relative(0, +ED_INFTY, dir_before, select);
     528                tag_get_pt(&pane.caret_pos, &pt);
     529                pt_get_eol(&pt, &pt);
     530                caret_move(pt, select, true);
    527531                break;
    528532        case KC_PAGE_UP:
Note: See TracChangeset for help on using the changeset viewer.