Fork us on GitHub Follow us on Facebook Follow us on Twitter

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


Ignore:
Timestamp:
2021-09-27T17:53:20Z (2 months ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
master
Children:
6c0766b
Parents:
a7a8f599
git-author:
Jiri Svoboda <jiri@…> (2021-09-27 17:52:09)
git-committer:
Jiri Svoboda <jiri@…> (2021-09-27 17:53:20)
Message:

Fix moving cursor/selecting by mouse click

File:
1 edited

Legend:

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

    ra7a8f599 r8603145  
    303303        errno_t rc;
    304304
    305         (void) pos_handle;
    306 
    307305        pane.sh_row = 1;
    308306        pane.sh_column = 1;
     
    810808
    811809        if (ev->type == POS_PRESS && ev->vpos < (unsigned)pane.rows) {
    812                 bc.row = pane.sh_row + ev->vpos;
    813                 bc.column = pane.sh_column + ev->hpos;
     810                bc.row = pane.sh_row + ev->vpos - pane.rect.p0.y;
     811                bc.column = pane.sh_column + ev->hpos - pane.rect.p0.x;
    814812                sheet_get_cell_pt(doc.sh, &bc, dir_before, &pt);
    815813
     
    817815
    818816                caret_move(pt, select, true);
     817                pane_update(&pane);
    819818        }
    820819}
     
    15211520static ui_evclaim_t pane_ctl_pos_event(void *arg, pos_event_t *event)
    15221521{
    1523         return ui_unclaimed;
     1522        gfx_coord2_t pos;
     1523
     1524        pos.x = event->hpos;
     1525        pos.y = event->vpos;
     1526
     1527        if (!gfx_pix_inside_rect(&pos, &pane.rect))
     1528                return ui_unclaimed;
     1529
     1530        pos_handle(event);
     1531        (void) gfx_update(ui_window_get_gc(edit.window));
     1532        return ui_claimed;
    15241533}
    15251534
     
    22192228    kbd_event_t *event)
    22202229{
     2230        pane.keymod = event->mods;
     2231
    22212232        if (event->type == KEY_PRESS) {
    22222233                key_handle_press(event);
Note: See TracChangeset for help on using the changeset viewer.